Chapter 2. Step 2: Getting Around
Now that you’re logged in, the first thing you’ll want to do is inspect what is going on and how the system is configured. To do that, you need to list files and directories, and move around within the filesystem. This chapter covers these basics.
Where Am I?
Some command prompts are set to show the current directory path. Others
are not, and it can be tough to remember where you are in the filesystem. The pwd
(print working directory) command shows you:
bash-4.2$ pwd /etc/init.d
Unlike in Windows, which is case-insensitive (but case-aware),
in Bash and in Linux in general, case matters. By convention, most
Linux commands are lowercase. If you try to type in an uppercase PWD
,
you will get a Command Not Found error.
Listing Files
In Bash, the ls
(list) command is used to show directories and
files. It is similar to the DIR
command in Windows Command Prompt.
Figure 2-1 shows a simple sample of an ls
command.
Some ssh
sessions use color highlighting, as shown in these
screenshots (in this case, green means the file is executable). Some do
not. So don’t be surprised if you see colors!
To see a more detailed listing of the files and directories, you can use
the ls -l
command, as shown in Figure 2-2.
Get Ten Steps to Linux Survival now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.