The file system under Linux follows a hierarchical structure in the form of an inverted tree. Everything starts at the root represented by /.
Here are some important directories generally found at the root:
/bin: Contains essential programs accessible by all users./etc: Contains system configuration files./home: Contains users' personal folders./var: Contains variable files like system logs./tmp: Directory for temporary files./usr: Contains additional programs and files.Here's a simplified representation:
/
|-- bin
|-- etc
|-- home
| |-- user1
| |-- user2
|-- var
|-- tmp
|-- usr
A path designates the location of a file or directory in the system.
An absolute path always starts from the root (/) and specifies the exact location.
/home/user1/document.txt/etc/hostsA relative path is defined relative to the current directory (where you are in the system).
/home/user1:
document.txt refers to /home/user1/document.txt../user2 refers to /home/user2.: Represents the current directory...: Represents the parent directory./home/user1.
ls .. lists the contents of /home.cd ../user2 places you in /home/user2.Among the following paths, which ones are absolute?
/etc/passwddocument.txt/var/log/syslog../photos/etc/passwd and /var/log/syslog are absolute paths.
/home/user1, access /home/user2 using a relative path./home, access /etc using an absolute path.../ to go up one level, to be in /home, which would give the following path: ../user2./etc././.. or .. to navigate.