

If we were in /home/alex, this would take us into /home, which becomes the new current directory. But we can also change directory this way: cd. Would change our current directory to /var/log. To change our current directory, we use the cd command (change directory). Pwd = Print Working Directory Changing Current (Working) Directory To see our current (working) directory we can type pwd john might have it at /home/john, and root (the super user/administrator) has it at /root. Every user starts in its home directory when they log in. For example, if we log in as the user “alex” on some server, our starting current directory might be /home/alex. When we’re working at the command line, we’re always “inside” a directory. This is also called the working directory. To understand a relative path we first have to explore what the current directory means. If we’d want to delete the Documents directory, we’d specify a path like /home/alex/Documents Current / Working Directory And we finally get to the file we want to access, Invoice.pdf.Īn absolute path can end with the name of a file, but also with the name of a directory. We can see the subdirectory names are separated by a /. Then we specify the subdirectories we want to descend into, in this case, first home, then alex, then Documents. The easiest to understand is the absolute path.Ībsolute paths always start out with the root directory /. This path can be written in two different ways: Absolute Path To access a file or directory on our command line, we must specify its file path or directory path. These subdirectories may also contain other subdirectories themselves. Under / there are a few subdirectories like bin, etc, home, usr, and so on. This is the top-level directory, there can be no other directories above it. The root is at the top, and its branches and leaves “grow” downwards.
:max_bytes(150000):strip_icc()/002_uses-of-linux-command-find-2201100-5bd8f0d64cedfd00264fc4e5.jpg)

Except, Linux’s filesystem tree is inverted. Why is it called this way? Because just like a tree we’d see in nature, this also has a root, branches, and leaves. Linux organizes files and directories in what it calls the filesystem tree. In this blog, we will see how to create, delete, copy and move files and directories in Linux.
