cp
The cp command allows you to create a new file from an existing file. The command line format is:
% cp input-file-spec output-file-spec
where input-file-spec and output-file-spec are valid Unix file specifications. The file specifications indicate the file(s)
to copy from and the file or directory to copy to (output). Any part of the filename may be replaced by a wildcard
symbol (*) and you may specify either a filename or a directory for the output-file-spec. If you do not specify a
directory, you should be careful that any wildcard used in the input-file-spec does not cause more than one file to get
copied.
% cp new.c old.c
% cp new.* OLD (where OLD is a directory)
ls
command allows the user to get a list of files in the current default directory. The command line format is:
% ls file-spec-list
where file-spec-list is an optional parameter of zero or more Unix file specifications (separated by spaces). The file
specification supplied (if any) indicates which directory is to be listed and the files within the directory to list.
lpr
The lpr command tells the system that one or more files are to be printed on the default printer. If the printer is busy
with another user's file, an entry will be made in the printer queue and the file will be printed after other lpr requests
have been satisfied. The command line format is:
BLOCKQUOTE> % lpr file-spec-list
where file-spec-list is one or more Unix files to be printed on the default printer. Any part of the filenames may be
replaced by a wild card.
Here is more information about where the printers actually are and what kind of printers are available.
man
The man command is a tool that gives the user brief descriptions of Unix commands along with a list of all of the
command flags that the command can use. To use man, try one of the following formats:
% man command
% man -k topic
more
The more command will print the contents of one or more files on the user's terminal. The command line format is:
% more file-spec-list
more displays a page at a time, waiting for you to press the space-bar at the end of each screen. At any time you may
type q to quit or h to get a list of other commands that more understands.
mv
The mv command is used to move files to different names or directories. The command line syntax is:
% mv input-file-spec output-file-spec
where input-file-spec is the file or files to be renamed or moved. As with cp, if you specify multiple input files, the
output file should be a directory. Otherwise output-file-spec may specify the new name of the file. Any or all of the
filename may be replaced by a wild card to abbreviate it or to allow more than one file to be moved. For example:
% mv data.dat ./research/datadat.old
will change the name of the file data.dat to datadat.old and place it in the subdirectory research. Be very careful
when copying or moving multiple files.
rm
The rm command allows you to delete one or more files from a disk. The command line format is:
% rm file-spec-list
where file-spec-list is one or more Unix file specifications, separated by spaces, listing which files are to be deleted.
Beware of rm *! For example:
% rm *.dat able.txt
will delete the file able.txt and all files in your current working directory which end in .dat. Getting rid of
unwanted subdirectories is a little more difficult. You can delete an empty directory with the command rmdir
directory-name but you cannot use rmdir to delete a directory that still has files in it.
To delete a directory with files in it, use rm with the -r flag (for recursive).