 |
|
Listing directory contents
Oracle Tips by Burleson Consulting |
Listing directory contents
The ls command is used to list the contents (sub-directories and
files) of a directory. There are several options to the ls
command that determine both the content and order of the
listing displayed.
Without specifying any options, ls displays sub-directory and
file names. The following is a description of some of the
options that are commonly used to display additional
information:
Option
Purpose
- a
Display all … normally
hidden files, those prefixed with a period (.), are
not displayed.
- l
Display long … include
permissions, ownership, size, date/time, and file
name in the display
- t
Sort the display by
date/time
Here are some examples of ls command displays using the
above options:
Directory:~/examples
$ ls
declaration.txt gettysburg.txt preamble.txt
Directory:~/examples
$ ls -al
total 20
drwxrwxr-x 2 tclark tclark 4096 Jan 13 17:48 .
drwx------ 4 tclark tclark 4096 Jan 13 18:29 ..
-rw-rw-r-- 1 tclark tclark 2230 Jan 13 17:47
declaration.txt
-rw-rw-r-- 1 tclark tclark 1310 Jan 13 17:48
gettysburg.txt
-rw-rw-r-- 1 tclark tclark 360 Jan 13 17:48
preamble.txt
Directory:~/examples
$ ls -alt
total 20
drwx------ 4 tclark tclark 4096 Jan 13 18:29 ..
drwxrwxr-x 2 tclark tclark 4096 Jan 13 17:48 .
-rw-rw-r-- 1 tclark tclark 360 Jan 13 17:48
preamble.txt
-rw-rw-r-- 1 tclark tclark 1310 Jan 13 17:48
gettysburg.txt
-rw-rw-r-- 1 tclark tclark 2230 Jan 13 17:47
declaration.txt
Directory:~/examples
$
The above book excerpt is from:
Easy Linux
Commands
Working Examples of Linux Command Syntax
ISBN:
0-9759135-0-6
Terry Clark