In Linux, file management depends on numerous commands, including ls, touch, mkdir, and many more. The “ls” command intends to overview all the files/directories available in the current working directory (or at a specific path). Moreover, the ls command offers various options that extend the command’s functionality. In this article, the purpose, working, and functionality of the “ls” command will be illustrated in detail.
The guideline of this article is demonstrated below:
- What is the “ls -l” Command in Linux?
- What is the “ll” Command in Linux?
- Difference Between “ls -l” and “ll” Commands in Linux.
What is ls -l Command in Linux?
The “ls -l” command displays the long listing information of all the available content in the specified file or directory arranged in the table format. The “ls” command contains important supported options to get the desired output.
The working of the “ls” command depends on its syntax.
The syntax of the ls -l command is defined below:
$ ls [OPTION]... [FILE]...
The supported options of the “ls” command can be viewed via the following command:
$ ls --help
The output of “ls –help” displays the “ls -l” command syntax and arguments along with their description, as shown in the below screenshot:
What is the ll Command in Linux?
The ll command in Linux displays the details of all files and directories along with the date, time, size, root user name, group user name, and permissions. The syntax of the ll command is given below:
$ ll [Options]
To get the more option of “ll” command, use the “ll –help” command as shown below:
$ ll --help
Difference Between the ls -l and ll Commands in Linux
Although the functionality of the ls -l and the ll command is the same. To explore the difference, we will illustrate a few examples where the ls -l and ll command is executed. Let’s look at the examples:
Example 1: Using ls -l in PWD
Suppose the user is in the root directory and wants to see the information about all files and directories. For this purpose, run the “ls -l” command on the terminal and hit the “Enter” key:
$ ls -l
The output of the “ls -l” command only displays the files and directories of the current (root) directory.
Example 2: ll in a PWD
But if the user runs the “ll” command, then all the files, hidden files, and directories will be shown in the output as shown below:
The output of ll Linux command contains 9 columns. The purpose of these columns is illustrated below:
- In the first column, file permissions for each file and directory. The “ – (hyphen) indicates the file”, “d indicates the directory”, and “r indicates that the file/directory is readable”. Similarly, w is writable, and x represents the executable characteristics of that file/directory.
- In the second column, the number of links associated with the file/directory.
- In the third column, there is the name of the actual user or root user of the current Linux system.
- In the fourth column, the group user information is displayed.
- In the fifth column, the current file/directory size is mentioned in bytes.
- In the sixth column, the date and time of the particular file/directory are specified
- In the last column, the path of the file/directory is quoted.
That’s the difference between “ls -l” and “ll”.
The “ls -l” command displays all the files and directories in pwd. In contrast, the “ll” command specifies all the files and directories and some important information such as permissions, date, size, time, and the number of links. This article has provided a detailed view of “ls -l” and “ll” commands along with the significant difference.