how to use cd command code example

Example 1: navigate to a directory linux

/* File & Directory Commands
To navigate into the root directory, use */ "cd /" /*
To navigate to your home directory, use */ "cd" /*or*/ "cd ~" /*
To navigate up one directory level, use*/ "cd .." /*
To navigate to the previous directory (or back), use */ "cd -"

Example 2: move into folder cmd

The cd command can be used to change into a subdirectory,

cd subdirectory_name						-> To go one level into subdir
cd subdirectory_name/subsubdirectory_name	-> To go two levels into subdir

move back into the parent directory,

cd ..\       -> To go back one level
cd ..\..\    -> To go back two levels

move to previos directory,

cd -

move all the way back to the root directory or move to any
given directory

cd C:/Give_Path_to_directory

Example 3: cd command

The cd command can be used to change into a subdirectory,

cd subdirectory_name						-> To go one level into subdir
cd subdirectory_name/subsubdirectory_name	-> To go two levels into subdir

move back into the parent directory,

cd ..\       -> To go back one level
cd ..\..\    -> To go back two levels

move to previos directory,

cd -

move all the way back to the root directory or move to any
given directory

cd C:/Give_Path_to_directory

Example 4: ubuntu navigate to directory in windows

cd /mnt/e/username/folder1/folder2

Example 5: cd command windows

cd <folder>

Tags:

Go Example