Type of paths
A path is a unique location to a file or a folder in a file system. A path to a file is a combination of / and alpha-numeric characters.
1. There are two types of paths that you can use
- Absolute
- Relative
An absolute path is defined as specifying the location of a directory from the root directory /.
A relative path begins with the name of a subdirectory in the current directory.
To check which is the current working directory for the shell, using the command pwd to print working directory
For example, if your current working directory is / when you issue the command pwd it will print /
Example:
- Relative
cd /
cd tmp
- Absolute
cd /tmp
They are equivalent.
2. There are two subdirectories in every directory
- . (dot)
- .. (dotdot)
Dot is the name of the current directory. If you issue ls . you will get the contents of the current directory.
Dotdot is the name of the parent directory
[you can try our ls. and ls.. ]