/ factorpad.com / tech / linux-essentials / ls-command.html
An ad-free and cookie-free website.
Beginner
Learn to list files and directories at the Linux command line.
Videos can also be accessed from the Linux Essentials Playlist on YouTube.
Linux ls Command Summary with Examples (3:49)
Our seventh word, or command to memorize is ls
from the category Navigation.
ls
allows you to list files in a
directory. In our last video we used
pwd
to find the directory name, now
with ls we can look inside it.
-options | description |
---|---|
-a |
List all files |
-l |
List files with details |
If it helps, think of commands as mini programs and most have this
structure. First, type the
command
, second the
-option(s)
and third the
argument(s)
.
The ls
command has over
30 options and its argument can be a different
directory than your current directory, or it can be a wildcard to show
files or directories of a certain type.
Now, we will focus on two options, but I think you'll benefit from
knowing other options, so please review the
man ls
page later.
First is ls -a
, which lists all files.
By default, files that start with a 'dot'
.
are for profile settings
and are not listed without -a
.
Second, -l
lists details of each
file (or directory).
So why is ls
an important command?
Well, Linux is an open language, and to get around and make it useful
you need to explore and view files.
And now you know how to do that.
Okay, the best way to embed this in your memory is by typing in your own terminal window.
Find this on your Mac using a program called Terminal. On Linux use Terminal or Konsole, and currently Microsoft is adding this functionality to Windows 10.
Here we go, start with ls
and no
options and no arguments and there is the text file we created in
video 5.
Next, type ls -a
to include
semi-hidden configuration files.
Third, let's use the ls -l
option
to see permissions, owners, file size, date modified and the file name.
And last, put two options together, in either order, and inspect.
Okay now you know how to use ls
.
And you know the syntax for commands, options and arguments.
One last tip about the ls
command.
Many users customize their ls
command to save keystrokes, and we'll cover how to do this later.
Okay, thanks for visiting today. I hope this was a fun introduction
to the ls
command.
For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the categories and a Q&A section, visit:
Subscribe at YouTube and follow @factorpad so we don't lose the connection. Who knows? We may beg to hire you some day.
pwd
command,
hit Back.cd
, click Next.
/ factorpad.com / tech / linux-essentials / ls-command.html
A newly-updated free resource. Connect and refer a friend today.