I like the way Linux commands are designed to give you an idea of their function. The normal everyday tree around us is that living green wooden structure with green leaves on branches and most times with fruits. All these functional parts (leaves, braches, roots, etc) are arranged in such a manner to produce a fully grown tree. This arrangement is both essential and unique to every tree in many different ways. Ranging from its development and growth to its aesthetic attraction to animals (the bee would be a very good example).
The Linux file system (FS), as have been said before, is the layout of hierarchy and arrangement of directories (and also including files). Put simply it is the arrangement structure of files and directories in the Linux operating system. Just like that green tree, the arrangement of directories in Linux follow closely a unique pattern and so nearly all Linux distributions use a similar directory structure (with minimal inter-distro variations). This would aid transfer of knowledge, among other things, when it comes to moving from one distro to another. The familiarity with the structure of the Linux file system is essential in a number of ways.
It simplifies the creation of administrative shell scripts designed to be used by system administrators.
It also helps Linux users troubleshoot software installations, or plan the addition of major software packages onto the Linux file system (the directory when apps are supposed to be installed are known before hand).
Linux has proven equal to the tasks, as it is equipped with very important commands to view the structure of its file system; some of them like ls have been highlighted in previous posts. Here we would be using the tree command.
The tree command is used to show a detailed picture – the root or base directory layout, along with associated directories. To get an overview of your home you can use it this way;
The command displays the structure of the File System in the form of a map to provide navigation directions to the Linux user.
Remember that the ls can also be used to get an overview of the FS of any Linux distro;
The result or output from both commands shows, without mincing words, that the tree command is more detailed and does the work better.
In the image above, you see that the tree command displays the directory structure of the File system in the form of a tree. Just like our opening tree analogy, it tells you where you can find the leaves, roots, flowers and the various directions of the branches.
The tree command is used in this way;
tree [OPTIONS] /path/to/directory
tree [OPTIONS] directory-path
Relevant options include the following;
-a : see all files
-d : see only directories
-c : to see colourised output
-u : display file owner
-g : display group owner
To be able to use tree command you must ensure that it is installed in your system. If the reverse is the case and you’ll find out that the tree command is not installed in your system you can do so like (after connecting to the internet of course);
# dnf install tree [RHEL/Cent-OS/fedora]
$ sudo apt –get install tree [Debian/Ubuntu]
As you use the tree command please take note that the command please take note that the command does not print hidden files (those with filename beginning with a dot).
and also (as in most cases), do not be surprised if you find fewer or more directories in your own Linux system, depending on your distro and version of your kernel (this is the little variation in the array of Linux distro when it comes to FS structure we talked about in the beginning of the post). The reason for this little variation or difference include the fact that when some apps are installed in your system, they create new directories and updating software packages might also remove or change the name of some directories.
Anyway that way of thinking is not far-fetched from the command concept that we would be talking about in this post.
- How to Disable Fast Start in Ubuntu-Windows Dual booting Setup. - December 31, 2020
- HOW TO INSTALL AUDACITY AUDIO EDITOR IN LINUX - October 31, 2020
- How to Create Files And Directories With Passwords in Linux [VIDEO] - September 29, 2020