In this article, we explain one of the basic Linux commands for beginners, i.e. the
ls command, with its most frequently used command options.
What is Linux?
Linux is a family of open-source operating systems based on the Linux kernel. The first Linux system kernel was released on September 17, 1991, by Linus Torvalds.
Read more …
There are also quite a number of customized Linux distributions, such as Kali Linux, REMnux etc. Kali Linux is a Debian-based distribution developed, funded and maintained by Offensive Security for ethical hackers for the purposes of Penetration Testing, Security Research & Assessment, and Computer Computer Forensics & Reverse Engineering. REMnux, on the other hand, is a Linux distro curated for reverse-engineering and malware analysis purposes.
I think Linux is a great thing, in the big picture. It’s a great hacker’s tool, and it has a lot of potential to become something more.Jamie Zawinski
Read more educational and inspirational cyber quotes at our page 100+ Best Cyber Security & Hacker Quotes.
ls Command – List Directory Contents
ls command is used to display a list of the files and directories within the file system or to view detailed information (metadata) on specified files and directories.
List information about the FILE(s) (the current directory by default). Basic usage:
ls [OPTION] ... [FILE] ...Use
-ato list all entries (including the hidden ones that start with
-lto list with more details, such as file permissions, file size etc.
To list just the files in a directory without any additional information, use
Listing Hidden Files
To list all the files in a directory, including the hidden files, without any additional information, use
ls -a. Hidden files begin with a period and not displayed by default.
$ ls -a
Listing With Detailed Information
To list all the files in a directory, including the hidden files, with additional information (long listing), use
ls -la. Note that command options can be combined, thus
ls -l -a is the same with
$ ls -la
The additional information (file permissions, file ownership etc.) displayed for the
my-script.sh file is described in more detail in Figure 4.
Denoting File Types
To denote files types with special characters, use
ls -F. The
/ symbol denotes a directory, the
@ symbol denotes a linked file, and the
* symbol represents an executable file.
$ ls -F
Listing by File Date and Time
To list files by time, use
ls -t. To reverse the order of listing,
-r option could be combined with the
$ ls -t
Listing Recursively All Files in a Directory
To list files recursively in a directory, use
$ ls -R
Listing Metadata for a Directory
To list metadata for a directory without listing the directory contents, use
$ ls -ld
To explore more
ls command options, please visit the man pages by typing
$ man ls on the terminal.
To learn more on Linux, you could also visit our Linux Resources Page.