Linux Cheat Sheet ‘ls’

One of the most common commands in Linux is the ‘ls’ command. It dates back to 1961 and is used to “list” files and directories on a filesystem.

To list files and directories:

user@host:/etc/bind$ ls
bind.keys  db.0  db.127  db.255  db.empty  db.local  externals  internals  named.conf  named.conf.default-zones  named.conf.local  named.conf.options  rev  rndc.key  zones.rfc1918

To list file details (long):

user@host:/etc/bind$ ls -l 
total 56
-rw-r--r-- 1 root root        1991 Apr 27  2021 bind.keys
-rw-r--r-- 1 root root         237 Dec 17  2019 db.0
-rw-r--r-- 1 root root         271 Dec 17  2019 db.127
-rw-r--r-- 1 root root         237 Dec 17  2019 db.255
-rw-r--r-- 1 root root         353 Dec 17  2019 db.empty
-rw-r--r-- 1 root root         270 Dec 17  2019 db.local
drwxr-sr-x 2 root bind        4096 Jan 25 14:26 externals
drwxr-sr-x 2 root bind        4096 Jan 23 00:05 internals
-rw-r--r-- 1 root bind         466 Jun 16  2021 named.conf
-rw-r--r-- 1 root bind         498 Dec 17  2019 named.conf.default-zones
-rw-r--r-- 1 root bind         752 Jan 24 23:36 named.conf.local
-rw-r--r-- 1 root bind           0 Jan 24 23:34 named.conf.options
drwxr-sr-x 2 root bind        4096 Jan  9 14:56 rev
-rw-r----- 1 bind Debian-snmp  101 Jan 23 00:54 rndc.key
-rw-r--r-- 1 root root        1244 Jan  8 21:39 zones.rfc1918

List all files:

user@host:/etc/bind$ ls -l 
.  ..  bind.keys  db.0  db.127  db.255  db.empty  db.local  externals  internals  named.conf  named.conf.default-zones  named.conf.local  named.conf.options  rev  rndc.key  zones.rfc1918

List all files with details:

user@host:/etc/bind$ ls -al 
total 64
drwxr-sr-x   5 root bind        4096 Jan 25 22:10 .
drwxr-xr-x 104 root root        4096 Jan 26 13:43 ..
-rw-r--r--   1 root root        1991 Apr 27  2021 bind.keys
-rw-r--r--   1 root root         237 Dec 17  2019 db.0
-rw-r--r--   1 root root         271 Dec 17  2019 db.127
-rw-r--r--   1 root root         237 Dec 17  2019 db.255
-rw-r--r--   1 root root         353 Dec 17  2019 db.empty
-rw-r--r--   1 root root         270 Dec 17  2019 db.local
drwxr-sr-x   2 root bind        4096 Jan 25 14:26 externals
drwxr-sr-x   2 root bind        4096 Jan 23 00:05 internals
-rw-r--r--   1 root bind         466 Jun 16  2021 named.conf
-rw-r--r--   1 root bind         498 Dec 17  2019 named.conf.default-zones
-rw-r--r--   1 root bind         752 Jan 24 23:36 named.conf.local
-rw-r--r--   1 root bind           0 Jan 24 23:34 named.conf.options
drwxr-sr-x   2 root bind        4096 Jan  9 14:56 rev
-rw-r-----   1 bind Debian-snmp  101 Jan 23 00:54 rndc.key
-rw-r--r--   1 root root        1244 Jan  8 21:39 zones.rfc1918

Leave a comment

Your email address will not be published. Required fields are marked *