56 Chapter 4 – A Beginner’s Guide to the Server
Introduction to Unix
Web Design in a Nutshell, eMatter Edition
mv
mv [source] [target]
This basic command moves files and directories around on the system or renames
them. Table 4-1 shows the results of variousmvoperations.
Example
Rename a file:
% mv art.html artists.html
Move a file from one directory to another:
% mv art.html ../richard/work
pg
pg [options] [filename]
This displays the contents of the file on the screen, one page at a time. After each
screen is displayed, you are prompted to display the next page by pressing the
RETURN key. Pressh (or?) for help with additional commands. Pressq to quit.
Useful pg Commands
-l Display one more line
n Move to pagen
+ or -n
Move forward or backward bynpages
passwd
passwd [user]
This creates or changes a password associated with a user name. Only the owner
or a privileged user can change a password.
pwd
pwd
This will tell you what directory you are currently in (yourworking directory).
Table 4-1: Results of Various mv Operations
Source Target Result
File name Rename file asname
File Existing file Overwrite existing file with the source
file
Directory name Rename directory asname
Directory Existing directory Move directory to be a subdirectory of
the existing directory
One or more files Existing directory Move files to directory