8
Chapter 1
boot initrd.img.old mnt sbin vmlinuz
dev lib opt srv vmlinuz.old
etc lib64 proc tmp
home lost+found root usr
This command lists both the files and directories contained in the
directory. You can also use this command on any particular directory, not
just the one you are currently in, by listing the directory name after the
command; for example,
ls /etc
shows what’s in the
/etc directory.
To get more information about the files and directories, such as their
permissions, owner, size, and when they were last modified, you can add
the
-l
switch after
ls
(the
l
stands for
long). This is often referred to as
long listing. Let’s try it here:
kali >
ls -l
total 84
drw-r--r-- 1 root root 4096 Dec 5 11:15 bin
drw-r--r-- 2 root root 4096 Dec 5 11:15 boot
drw-r--r-- 3 root root 4096 Dec 9 13:10 dev
drw-r--r-- 18 root root 4096 Dec 9 13:43 etc
--
snip
--
drw-r--r-- 1 root root 4096 Dec 5 11:15 var
As you can see,
ls -l
provides us with significantly more information,
such as whether an object is a file or directory, the number of links, the
owner, the group, its size, when it was created or modified, and its name.
I typically add the
-l
switch whenever doing a listing in Linux, but to
each their own. We’ll talk more about
ls -l
in Chapter 5.
Some files in Linux are hidden and won’t be revealed by a simple
ls
or
ls -l
command. To show hidden files, add a lowercase
–a
switch, like so:
kali >
ls -la
If you aren’t seeing a file you expect to see, it’s worth trying
ls
with the
a
flag When using multiple flags, you can combine them into one, as we’ve
done here with
-la
instead of
-l -a
.
Getting Help
Nearly every command, application, or utility has a dedicated help file in
Linux that provides guidance for its use. For instance, if I needed help
using the best wireless cracking tool, aircrack-ng, I could simply type the
aircrack-ng
command followed by the
--help
command:
kali >