Red Hat ENTERPRISE LINUX 3 - STEP BY STEP GUIDE Manual page 42

Table of Contents

Advertisement

28
Note
Always make sure you know which working directory you are in before you state the relative path to
the directory or file you want to get to. You do not have to worry about your position in the file system,
though, when you state the absolute path to another directory or file. If you are not sure, type
and your current working directory is displayed, which can be your guide for moving up and down
directories using relative pathnames.
Command
cd
cd ~
cd /
cd /root
cd /home
cd ..
cd ~otheruser
cd /dir1/subdirfoo
cd ../../dir3/dir2
Table 3-1.
Options
cd
Now that you are starting to understand how to change directories, see what happens when you change
to root's login directory (the superuser account). Type:
cd /root
If you are not logged in as root, you are denied permission to access that directory.
Denying access to the root and other users' accounts (or login directories) is one way your Linux
system prevents accidental or malicious tampering. Refer to Section 3.13 Ownership and Permissions.
To change to the root login and root directory, use the
su -
Tip
The command
su
When you type
su
inside your login shell (your user's home directory). Typing
login shell; it is as if you had logged in as root originally.
Function
Returns you to your login directory
Also returns you to your login directory
Takes you to the entire system's root directory
Takes you to the home directory of the root, or superuser,
account created at installation; you must be the root user
to access this directory
Takes you to the home directory, where user login
directories are usually stored
Moves you up one directory
Takes you to otheruser's login directory, if otheruser has
granted you permission
Regardless of which directory you are in, this absolute
path takes you directly to
dir1
This relative path takes you up two directories, then to
dir3
means substitute users and it allows you to log in as another user temporarily.
by itself and press [Enter], you become root (also called the superuser) while still
subdirfoo
, then to the
directory
dir2
command.
su -
makes you become root with root's
su -
Chapter 3. Shell Prompt Basics
, a subdirectory of
pwd

Advertisement

Table of Contents
loading

This manual is also suitable for:

Enterprise linux 3

Table of Contents