$ ls -l drwxr-xr-x 5 cc eng 4096 Jun 24 16:51 action drwxr-xr-x 4 cc eng 4096 Jun 24 16:51 comedy drwxr-xr-x 6 cc eng 4096 Jun 24 16:51 drama -rw-r--r-- 1 cc eng 0 Jun 24 16:51 genres.txt
-l option lists files and directories as a table. Here there are four rows, with seven columns separated by spaces. Here’s what each column means:
- Access rights. These indicate the read, write, and execute permissions on the file or directory allowed to the owner, the group, and all users. You can read more about file permissions.
- Number of hard links. This number counts the number of child directories and files. This number includes the parent directory link (
..) and current directory link (
- The username of the file’s owner. Here the username is
- The name of the group that owns the file. Here the group name is
- The size of the file in bytes.
- The date & time that the file was last modified.
- The name of the file or directory.
In addition to using each option separately, like
ls -a or
ls -l, multiple options can be used together, like
ls -alt. We can group letter options for other commands in the same way.
ls -alt lists all contents, including hidden files and directories, in long format, ordered by the date and time they were last modified.
Let’s navigate to the comedy/ directory. Check your current position using
pwd, and use a single
cd command to get there.
To view all files and directories in comedy/, including the hidden ones, in a long table format, sorted by time last modified.