×We're Accepting Applications for our Women's Scholarship Through March 31st! Apply Now.
By the end of this chapter, you should be able to:
As you saw in the previous chapter, one of the most important commands you are going to be using is
ls, which lists the contents of a directory. If you type
ls in a directory you will see all sorts of content. For example, typing
ls in your home directory will show you all of the files and folders inside of that directory. Typically your home directory contains folders such as
Sometimes the default
ls command does not give us all the information we want. In such cases, we'll need to add some flags to get more details.
In the previous chapter, we saw how flags could be used to modify the behavior of
rm. Flags can change and even enhance commands and are added using a
- after the command. Flags are usually represented by single uppercase and lowercase letters. With the
ls command, we can pass in the
-a flag to list "all" files (including hidden files and folders). If we want the
ls command to give us more information about each file, we can pass in the
-l flag. To combine flags we can just use one
- and pass in each flag. So the command to use
ls and show all files and more detailed information about each one would be
Using flags for
ls will be essential when working with permissions as well as when you start working with
git. We will also see many other terminal commands which accept flags later in this course.
When you're ready, move on to Terminal Basics Exercises