Click here to view code image
matthew@seymour:~$ ls -laR > listing.txt
TIP
The previous command sends the output of ls -laR to a file called
listing.txt and demonstrates part of the power of the Linux command
line. At the command line, you can use files as inputs to commands, or you
can generate files as outputs, as shown. For more information about
redirects and combining commands, see Chapter 14, “Automating Tasks
and Shell Scripting.” In the meantime, note that you can read the contents
of the text file by using the command less listing.txt, which lets
you read the file bit by bit, using the arrow keys to navigate in the file (or
Enter to move to the next line), the spacebar to move to the next page, and
q to exit when done.
Changing Directories with cd
Use the cd command to move within the file system from one directory to
another. It might help you remember this command to think of it meaning
change directory. The most basic usage of cd is as follows:
Click here to view code image
matthew@seymour:~$ cd somedir
This command looks in the current directory for the somedir subdirectory
and then moves you into it. You can also specify an exact location for a
directory, like this:
Click here to view code image
matthew@seymour:~$ cd /home/matthew/stuff/somedir
You can also use the cd command with several shortcuts. For example, to
quickly move up to the parent directory, the one above the one you are
currently in, use the cd command like this:
Click here to view code image
matthew@seymour:~$ cd ..
To return to your home directory from anywhere in the Linux file system, use
the cd command like this:
Click here to view code image
matthew@seymour:~$ cd