Skip to content
Published On:
Mar 25, 2014
Last Updated:
Mar 25, 2014

The ls command lists directory contents. It is one of the most commonly used commands in a Linux environment. ls is similar to dir in a Windows environment.

List File/Folder Size

You can use the -l option to list file and folder sizes:

Terminal window
$ ls -l

By default, ls outputs file/folder sizes in bytes, no matter how large the file. To improve on this when using ls, use the -h flag to enable “human readable” output.

Terminal window
$ ls -lh

Finding What Shell You Are Using

You can use the ls program along with the flag -l (use the long list format) to determine what shell program you are using (bash, dash, Bourne, e.t.c).

Type the following command:

Terminal window
$ ls -l /bin/sh

If I was running bash, the program will output something like this:

Terminal window
lrwxrwxrwx 1 root root 4 Mar 25 10:02 /bin/sh -> bash