2 - Directory Navigation
Posted in Linux , Linux Commands
Today as the second lesson lets talk about Directory Navigation.
What is a path?
A path is a unique location to a file or a folder in a file system of an OS. A path to a file is a combination of / and alpha-numeric characters
To see which directory you are currently in(current working directory) use the command "pwd"
This is my home and i want to go inside directory "Crux".
"pwd" command shows that my current working directory is "Crux"
1st "pwd" command shows that my current working directory is "penguin" and i want to go inside "Car" directory. "Car" directory" is inside "penguin" directory's parent parent directory or two levels up in the directory structure.Therefor using "../.." i go two directories upward and give the name of directory(Car) where i want to enter.
What is a path?
A path is a unique location to a file or a folder in a file system of an OS. A path to a file is a combination of / and alpha-numeric characters
What is the difference between absolute path and relative path?
An absolute path is defined as the specifying the location of a file or directory from the root directory(/).
In other words we can say absolute path is a complete path from start of actual filesystem from / directory.
Relative path is defined as path related to the present working directory.
To see which directory you are currently in(current working directory) use the command "pwd"
ex :
pwd - Print absolute path of working directory.
above example shows my current working directory.
To change working directory use the command "cd"
cd [directory] - As the directory give the name of directory you wishes to enter,it change the current directory
ex :
This is my home and i want to go inside directory "Crux".
"pwd" command shows that my current working directory is "Crux"
To change directory from present directory to another directory using relative path
cd [relative path]
ex :

These are the files inside my "Crux" directory .
Using realative path i want to go inside "Tux" directory from home.
To change directory from present directory to another directory using absolute path

These are the files inside my "Crux" directory .
Using realative path i want to go inside "Tux" directory from home.
To change directory from present directory to another directory using absolute path
cd [absolute path]
ex :
ex :
Using absolute path i want to go inside "Tux" directory from home.
With no arguments "cd" changes to the users home directory.
cd
cd
To change working directory to parent directory
cd ..
cd ..
To change working directory to previous working directory
cd -
cd -
To change working directory to present working directory.
cd .
This command is of no use because this will change the directory to present directory itself.
cd .
This command is of no use because this will change the directory to present directory itself.
To change working directory to parents parent directory or two levels up in the directory structure.
cd ../..
ex :
cd ../..
ex :
Change working directory to two levels up in the directory structure and enter to directory you have mentioned.
cd ../../[Directory]
ex :
cd ../../[Directory]
ex :
1st "pwd" command shows that my current working directory is "penguin" and i want to go inside "Car" directory. "Car" directory" is inside "penguin" directory's parent parent directory or two levels up in the directory structure.Therefor using "../.." i go two directories upward and give the name of directory(Car) where i want to enter.
Changing working directory without typing the whole name of the directory.
ex :
I want to go inside "Car" directory without mentioning "Car" fully.
To drop single characters you can use question mark(?).
To drop multiple characters you can use asterisk(*).
I want to go inside "Car" directory without mentioning "Car" fully.
To drop single characters you can use question mark(?).
To drop multiple characters you can use asterisk(*).
This will change the directory to Crux/Car, if Crux directory contain only one directory which starts with C letter.
Change directory to /home/cruxudo/Crux/Tux with out typing all the characters using <tab>
cd /h<tab>/c<tab>/C<tab>/T<tab>
Press tab to complete the directory name.
0 comments :