Navigate to parent directory in Linux
To navigate to the parent directory of the current working directory in Linux, we can use the change directory cd command.
Execute the cd command and pass the double dot ..
as argument to the command, as shown in the following.
cd ..
Or you can use the following format.
cd ../
Example
In this example, we will navigate to the parent directory from a current working directory of /tutorialkart/logs
.
We are at the current working directory /tutorialkart/logs
.
root@tutorialkart# pwd
/tutorialkart/logs
We have executed the change directory cd command.
root@tutorialkart# cd ../
Then we moved to the /tutorialkart
, which is the parent directory of /tutorialkart/logs
.
root@tutorialkart# pwd
/tutorialkart
Now, let us navigate to the parent directory of /tutorialkart
, which is /
or root directory.
Now, we are the the current working directory of /tutorialkart
.
root@tutorialkart# pwd
/tutorialkart
We have to execute the change directory cd command with the ..
argument to move to the parent directory.
root@tutorialkart# cd ../
We have moved to the parent directory.
root@tutorialkart# pwd
/
Conclusion
In this Linux Tutorial, we learned how to navigate to the parent directory from the current working directly using change directory cd command.