Skip to Content
ls & Combining Options
$ 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

The -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:

  1. 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.
  2. 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 (.).
  3. The username of the file’s owner. Here the username is cc.
  4. The name of the group that owns the file. Here the group name is eng.
  5. The size of the file in bytes.
  6. The date & time that the file was last modified.
  7. 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.


Then type

ls -alt

To view all files and directories in comedy/, including the hidden ones, in a long table format, sorted by time last modified.

Folder Icon

Sign up to start coding

Already have an account?