O'Reilly logo

Ten Steps to Linux Survival by James Lehmer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

ls command
Figure 2-1. 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.

ls -l command
Figure 2-2. ls -l command ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required