The cd command uses a relative
path to change to a subdirectory of the current directory. It is easy to master
after little practice. The chart below shows what happens when you type cd alone or with various arguments. Try a few of these cd examples and then type pwd
(Print Working Directory) to see which directory you are currently in.
The following table lists commonly used UNIX commands, for
moving around in the file system.
|
Command |
Example |
Function |
|
ls |
ls
ls -l
ls –al
ls .
ls /usr |
list files in the current directory
list files in the current directory in a long listing
list all files including files beginning with a "."
list files in the /usr
directory |
|
pwd |
pwd |
print working directory - check the current directory |
|
cd |
cd |
change to your home directory |
|
cd
/home |
change directory to /home |
|
cd bob |
change directory to bob |
|
cd .. |
change up one directory (.. represents
parent dir) |
|
cd
../logs |
change up one directory and down to the logs directory |
|
mkdir |
mkdir tmp |
make directory tmp under
the present directory |
|
rmdir |
rmdir tmp |
remove directory tmp |
|
rm |
rm test |
remove the file test |
|
rm -f
test |
remove the file test without
prompting |
|
rm -rf tmp |
remove the directory tmp and all
subdirectories and files in tmp without prompting
(be very careful with this) |
|
cp |
cp test test.new |
copy the file test to test.new |
Use these filesystem symbols as
navigation shortcuts.
|
Symbol |
Definition |
|
. |
Current directory |
|
.. |
Parent directory |
|
/ |
When used by itself or at the beginning of a path it
represents the UNIX Root directory. When used within a path it is a
separator. |
These are the main directories of your system. You will be
working mostly in /home, /usr,
and /etc.
|
Directory |
Description |
|
/bin |
User utilities fundamental to both single-user and
multi-user environments. |
|
/dev |
Contains device nodes |
|
/etc
/etc/defaults
/etc/mail
/etc/periodic |
Contains servers configuration files such as
hosts, mail,
inetd.conf, master.passwd, resolv.conf
Default system configuration files.
Configuration files for mail transport agents such as sendmail and includes aliases, virtusertable, and access
files.
Scripts that run daily, weekly, and monthly, via cron. |
|
/ftp
/ftp/pub/username
/ftp/pub/incoming |
Anonymous ftp directory.
FTP-only user directories belong here.
Suggested anonymous up loadable directory |
|
/home
/home/username
/home/username/www/ |
Contains users’ home directories.
E-mail users belong here.
E-mail and Web users belong here. |
|
/tmp |
Temporary files that sometimes are periodically
deleted. |
|
/usr
/usr/local |
This directory contains the following subdirectories:
Contains directories like apache, man and frontpage. Contains additional server
programs |
|
/usr/local/apache
/usr/local/apache/
htdocs
/usr/local/apache/cgi-bin
/usr/local/apache/
conf
/usr/local/apache/
logs |
The virtual httpsd server’s root
directory that contains the following subdirectories:.
The Web (html) files for the primary domain. (Web files
for subhosts belong in /home/username/www/
/subhostdomain.name)
CGI and scripts directory
HTTPSD servers configuration files
HTTPSD servers log files |
|
/var |
Dynamic data files such as mail files and log files; also
contains cron, tmp, spool |
|
/var/spool/mqueue |
Contains mail messages waiting for delivery |
|
/var/log/messages |
Contains miscellaneous log |
|
/var/log/maillog |
Contains logs of E-mail activity |
|
/www |
Symbolic link to /usr/local/apache
|
|
/backup |
Contains an on disk copy of the account file system
from the previous night (read-only) |
|
/compat |
Linux compatibility files |
|
/root |
Root home directory |
|
/ports |
Collection of third party applications (read-only) |
|
/proc |
System processes |
|
/sbin |
System programs and administration utilities fundamental
to both single-user and multi-user environments. |
|
/skel |
Default “skeleton” files (core system binaries) for a new,
clean server. (read-only) |
Connect to your VPS v2 Virtual Server, cd to any
directory, and type ls
–l. A list of directories and files appears.