From MEPIS Documentation Wiki

Jump to: navigation, search


ls - List a directory's content

basic usage


will the contents of the current directory in alphabetical order.


ls is one of the most basic tools and will undoubtedly be the most commonly used. It sorts a directory alphabetically and prints them in the following colors:

  • a black or white entry, depending on your terminal settings, is a regular file
  • a dark blue entry is a directory, you can change to that directory with cd
  • a bright green entry is a symbolic link
  • a a purple entry is a hard link

to disable color formatting use

 ls --color=never

hidden files

ls, by default, does not show hidden files and directories. To enable the viewing of hidden folders and files you have several options.

 ls -a
ls -A

more listing information

ls only shows the file or directory name, to make it show more information use the following option.

 ls -l
  • the -l flag shows a lot of information on every file and folder.



command does the same thing. For more information on a specific file, use the stat command.

sort by modification time

ls -t

output data size in human readable format

To output the data size in human readable format, e.g. kB, MB instead of bytes, which can be rather long.

ls -h

combine switches

You can combine switches, aka flags or options. For instance,

ls -lth

will display the contents in a descriptive format, with file sizes in human readable format, and sorted accorded to their modification time.

additional options

This is meant to be an introduction and does not cover all of the command's data. For more information read

ls --help

or the manpage

Personal tools
In other languages