PROGRAMS

ls

Article by:
Date Published:
Last Modified:

Overview

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:

1
$ 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.

1
$ 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:

1
$ ls -l /bin/sh

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

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

Authors

Geoffrey Hunter

Dude making stuff.

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License .

Tags

    comments powered by Disqus