Operation Manual
The Linux Command Line
157
Notes:
Listing the files and folders in a particular place
The “ls” command lists all contents of directory you’re working in. There are a
range of switches you can use with “ls” to make it display exactly the files you’re
interested in and all the useful information about those files. We’ve listed a few of
those switches here:
l “ls”, the command with no switches, lists all the file in the current directory.
l “ls -l” lists the files and displays the long version of the information about each
file or directory. Output may be colour-coded depending on the terminal
preferences that you have set.
l “ls -R” asks for a “recursive” list – that is, a list including the contents of
sub-directories as well as this directory.
l “ls -A” forces the system to show “hidden” files. Hidden files have names
that start with a dot, which won’t usually be visible when doing a normal
directory list.
Let’s look at two examples. In the first, we use the plain “ls” command with
no switches.
$ ls
An_Gott_und_meine_Mutter.mid Domestic Programming Test.mid
An_Gott_und_meine_Mutter.mscz Engineering Quantum Physics Tutoring
appliances FluidR3 _ GM.ins School Windaz
In the second, we use “ls -l”. This displays the files in long format, telling you,
among other things, the size, owner and security setting on each file.
$ ls -l
total 336
-rw-rw-r--. 1 brian brian 2429 Apr 2 20:27 An_Gott_und_meine_Mutter.mid
-rw-rw-r--. 1 brian brian 4085 Apr 2 19:52 An_Gott_und_meine_Mutter.mscz
drwxrwxr-x. 4 brian brian 4096 Apr 2 20:38 appliances
-rw-rw-r--. 1 brian brian 10919 Apr 2 19:52 brotplot.odt
Don’t worry, we’ll go into the details of this information later.
To find out more about the “ls” command, take a look at its Wikipedia Entry:
http://en.wikipedia.org/wiki/Ls