In Linux, a core concept is that everything is treated as a file. These files are organized within a hierarchical structure known as the filesystem. Understanding this structure is key to navigating your system effectively.
The Directory Tree in Linux
The entire filesystem starts from a single top-level directory called the root directory, represented by a forward slash (/). From the root, the directory tree in linux branches out into various subdirectories, which can contain files and further subdirectories.
Here is a simplified example of what this structure looks like:
/
|-- bin
| |-- file1
| |-- file2
|-- etc
| |-- file3
| `-- directory1
| |-- file4
| `-- file5
|-- home
|-- var
Understanding File Paths
The location of any file or directory is described by its path. A path is a sequence of directories that leads from a starting point to a specific destination. For example, if you have a folder named pete inside the /home directory, and a Movies folder inside pete, the full path would be /home/pete/Movies.
What is the Full Form of PWD in Linux?
When navigating the filesystem, it's essential to know your current location. The command for this is pwd. The full form of pwd in linux is "print working directory." Its sole purpose is to display the full path of the directory you are currently in, starting from the root (/).
Using the linux pwd Command
To find your current directory linux, simply type the linux pwd command and press Enter. It prints the absolute path to your present location on the command line.
pwd
Where are you? Where am I? Give it a try to see your own current working directory.