Information Technology Reference
In-Depth Information
/test/Solaris/9:
sysadmin
/test/Solaris/9/sysadmin:
311-014 311-015
#
A single file can be renamed in the current directory or moved to another
directory and renamed at the same time. In the following example, the first
mv
command renames the
311-014
file. The second command moves it to
another directory (the parent or
..
directory). The third command moves
the
311-015
file to the parent directory and renames it at the same time
(assuming there is no
part2
subdirectory off the parent).
# ls
311-014 311-015
# mv 311-014 part1
# mv part1 ..
# mv 311-015 ../part2
#
Deleting Files Using the rm Command
The
rm(1)
command is used to delete one or more files specified as com-
mand-line arguments. The files to be deleted can be complete filenames,
multiple files selected using metacharacters, or any combination. Multiple
filenames must be separated by spaces. The
-i
command-line argument pro-
vides interactive control over the remove command. Normally, if the
rm
command encounters a write-protected file it will prompt to confirm its
removal. However, if the
-f
command-line argument is specified, write-
protected files are removed with confirmation. The
-f
command-line argu-
ment cannot be specified with
-i
command-line argument. For example:
# ls
file1 file2 xfile
# rm xfile file*
# ls
#
File and directory names that begin with a dot character, such as .profile, are not
included in multiple file/directory specifications using leading metacharacters. For
example, *profile does not include .profile. The files that begin with a dot must be
specified separately using a preceding dot, such as .p*.