12.07.2015 Views

Red Hat Enterprise Linux 5 Administration Unleashed

Red Hat Enterprise Linux 5 Administration Unleashed

Red Hat Enterprise Linux 5 Administration Unleashed

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

104CHAPTER 4Understanding <strong>Linux</strong> ConceptsNavigating the FilesystemNow that you understand a bit about how the filesystem is organized and how to invokea shell prompt, you need to know how to navigate through it using the command line.By default, the prompt looks like the following:[tfox@smallville ~]$The first word before the @ symbol is the username of the person currently logged in, andthe word after the @ symbol is the hostname of the system. The part that follows thespace after the hostname is referred to as the current working directory. In this case, the ~symbol means that the current working directory is the home directory of the user. Whenyou start a terminal, the default directory is your home directory.To change to a different directory, use the cd command. The can either be the full path to the directory or a directory relative to the current directory.The full path is the path through the filesystem to the desired directory starting with theroot directory (/) such as /home/tfox/ for my home directory or /var/log/ for the log filesdirectory. Specifying a directory relative to the current working directory means that youdon’t begin the directory with the root directory. Instead, you begin it with a directoryinside the current working directory such as documents/ for the /home/tfox/documents/directory if you are already in the /home/tfox/ directory. If the directory doesn’t beginwith a forward slash for the root directory, the current working directory is assumed for thebeginning of the path. When specifying a relative directory, you can specify more than onelevel deep such as documents/project1/.When giving a relative directory, you can also specify up one or more directories with the.. notation. For example, if the current working directory is /var/log/samba/, executingthe command cd ../httpd takes you up one directory and then down into the httpddirectory, placing you in the /var/log/httpd/ directory.Notice that the shell prompt changes as you change directories. If you change to thedocuments/ directory, the prompt changes to the following:[tfox@smallville documents]$Notice that the prompt does not show where the current working directory is relative tothe entire filesystem. It just shows the name of the current directory by itself. To outputthe full path to the current working directory, execute the pwd command. In our example,the pwd command displays:/home/tfox/documentsTo create a directory, use the mkdir command. Again, the canbe relative to the current directory or it can be the full path. For example, to create adirectory named project1/ in the /home/tfox/documents/ directory either change intothe /home/tfox/documents/ directory and then execute the mkdir project1 command, orexecute the mkdir /home/tfox/documents/project1/ command from any directory.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!