Linux Commands

cd Up One Level Linux

We often use directories when working on a computer system. The directory is nothing but a folder or a location where a file is stored. We store our files in different directories. And sometimes we may need to change the folders. Instead of going to the folder directly, we can do this using cd (Change Directory) command.

On Linux and other Unix-like operating systems, the cd command can change the current working directory. Working in the current directory of a computer is also referred to as the user’s current directory. In this article, we will dive deeper into the cd command and give you a brief on cd up one level Linux.

cd Up One Level Linux

You are always in a home directory when you open the terminal. To change the directory and move to another directory cd command is used in the following ways.

Root directory navigation: Type “cd/” to enter the root directory.

Home directory navigation: we use the “cd~” or “cd” command to move into the home directory.

$cd ~

Up to one level: moving up one level in the directory, we use the “cd..” command in the following way:

$cd ../

Back one level: we use the “cd-” command to return back to the previous folder.

$cd -

Multiple level navigation: we can use a complete path to go to the specific directory along with the cd command in the following way:

$cd /home/Downloads

Remember, there is space between cd and the specified path.

Directory name having spaces: if your directory name contains the spaces in the name, then the name should be written inside the quotes in the following way: e.g., “My home route” is my directory name the I will write as:

$cd 'My home route.'

Conclusion

In this article, we have discussed the current working directory and cd command. Also, we have seen how to use the cd command in multiple navigations. We hope you enjoyed the article. Please visit our website to read more articles.

About the author

Prateek Jangid

A passionate Linux user for personal and professional reasons, always exploring what is new in the world of Linux and sharing with my readers.