Linux CD command  What is it? + Parameters ▷ 2021

Know what is the CD command for in a Linux terminal will help you get the most out of it now use it correctly when you need to get infformation of a certain directory.

For this we invite you to read this article. You can find all the information, in detail, about CD command and what are the parameters that accepts on a console with Linux OS.

But this is not all you will see in this post., we will also explain the step by step that you must do to use, correctly, Linux commands when you want to change directory.

What is the CD command and what is it for in the Linux operating system?

You should not forget that the structure with which Linux works is Command + Argument within a directory, folder, and file environment. This is why there are a lot of commands that you can use in the terminal. One of those is CD, which is directly related to the location of the directories.

The CD command is a utility used in the Linux operating system to know the path of a directory and get all kinds of additional information. It is also used to change to the directory that has been visited before or to the immediate superior where you are.

Its syntax for navigating the directory tree is CD [OPCIÓN que desees ingresar] Nombre del fichero que quieres encontrar. In case of not adding the argument, the command returns the home directory that the user has. That is, if you enter CD [OPCIÓN], in case the command in question is accompanied by a middle dash (-), the command executes the opening of the above directory. By this we mean that you will be able to receive the data from the parent directory, the one that contains the file you are looking for.

What are the parameters accepted by the CD command in Linux?

The parameters that are usually used in the CD command within a Linux terminal are:

  • /f: used to modify the unit and the file in which you are at the moment of executing the action.
  • [unidad]: this parameter is used to indicate the disk drive on which the command is to be executed. For example, it can be to: or F:. You must bear in mind that this option will change according to the number of units you have on your computer.
  • [ruta]: This parameter is used with the CD command to specify the path or path of the directory from which information is to be obtained.
  • [..]: 2 points are placed when specific information is needed about a subdirectory immediately below the current one. This is also known as a child file.
  • /?: with this argument you can get help on the operation of the CD command. It is very useful because it will help you at all times, so we recommend that you always have it at hand to be able to move forward quickly.
  • -: when you want to go to a user’s home directory, you will have to use the middle dash. In this way you will be able to know all the data that is housed in this section.
  • ~: This symbol is used to go to the Linux home page.
  • ls: this argument is added to list the contents of a file.

Learn step by step how to use the CD command in the Linux terminal

Learn step by step how to use the CD command in the Linux terminal

The steps you will have to do to use the CD command in a Linux environment it will depend on the type of action you need me to execute.

In case you want to know the file tree or the path, you will have to enter:

internet@pasoapaso:~$ cd Android


To change to the previous directory, you will have to type:

internet@pasoapaso:~/Android/examples$ cd ..


If what you are looking for is to access the directory you have already visited before, you will have to do:

internet@pasoapaso:~/Android/example$ cd

internet@pasoapaso:~$ cd -



When you have to list the content that a directory has, you will have to execute:

internet@pasoapaso:~$ cd Descargas/
internet@pasoapaso:~/Descargas$ ls

In case you have forgotten the name of the directory in which you want to investigate, you will have to enter in the Linux terminal:

internet@pasoapaso:~$ cd /etc/h

This will give you back all the Names of the files that start with the letter H.

If you have any questions, leave them in the comments, we will answer you as soon as possible, and it will also be of great help to more members of the community. Thanks! 😉

Felix Bathrobe

Author: Félix Albornoz

I have been working in the technology sector for more than 20 years helping companies and users to develop and train in this field. Always learning new things.

You may be interested:

Leave a Comment