Linux ls command

The ls is the list command in Linux. It will show the full list or content of your directory. Just type ls and press the enter key. The whole content will be shown.

ls is a command used to list computer directories and files in Unix-like and Unix operating systems. It is developed by the Single Unix Specification and POSIX.
It’s available inside the EFI shell, as a component of the UnxUtils group of native Win32 ports of basic GNU Unix-like utilities as an isolated package for Microsoft Windows, or as a component of the MSX-DOS2 Tools of ASCII for MSX-DOS version 2.

The numerical computing environments GNU Octave and MATLAB contain an ls function with the same functionality. In several other environments like Microsoft Windows, OS2, and DOS, the same functionality is given by the dir command. The different implementations include different options, as with almost every utility. We can check the documentation given by the command for suitable options and usage.

Brief History of ls

An ls utility occurred in the AT&T UNIX first version, the title acquired from the same command in Multics also titled ‘ls’, an acronym for the “list” term. ls is a component of the X/Open Portability Guide from issue 2 of 1987. It was acquired into the POSIX.1 first version and the Single Unix Specification.


Unix-like and Unix operating systems manage the thought of a working directory. ls lists several files inside the working directory when used without arguments. In that directory, the files are listed if a directory is mentioned. The arguments might include directories and files.

Names beginning with the “.” symbol are hidden. The “.” directory is known as the working directory, and the “..” symbol is known as its parent directory. By default, they are shown. All files are displayed using -a. File names explicitly specified are listed always.

ls only displays names without options. Multiple options might be combined. The basic options are:

  • -h: It shows result sizes in a human readable format (for example, 2G 234M, 1K, etc.). This option is not a component of the POSIX standard. However, implemented in many systems, e.g., Solaris 9 in 2002, FreeBSD 4.5 in 2002, and GNU coreutils in 1997.
  • -l: It stands for long format. It shows Unix file types, number of hard links, permissions, group, owner, last modified name and date-time, and size. If the changed date is older than six months, the time is substituted with the year. A few implementations add extra flags to permissions.

It is possible to display different items with different types of colors. It is an area in which implementations differ:

  • FreeBSD ls applies the -G option. It inspects only the Unix file permission and type and utilizes the termcap database.
  • GNU ls applies the –color option. It inspects the Unix file extension, permission, and type and utilizes its database to manage colors controlled using dircolors.

ref: [1]

Tinggalkan Balasan

Alamat email Anda tidak akan dipublikasikan. Ruas yang wajib ditandai *