Open System Services Shell and Utilities Reference Manual (G06.25+, H06.03+)
Table Of Contents
User Commands (m - o) mv(1)
Environment Variables
The following environment variables affect the execution of the mv command:
LC_MESSAGES
Determines the locale’s equivalent of y or n (for yes/no queries).
UTILSGE Specifies that HP extensions to the root directory should be omitted when the ini-
tial directory is root and a recursive operation occurs in an OSS shell command.
Application programs that test this variable might also honor its settings.
The UTILSGE value can be any of the following:
NOE Omit the /E directory.
NOG Omit the /G directory.
NOG:NOE Omit both the /G and /E directories.
The effect of assigning a value to UTILSGE environment variable is the same
as specifying the -W NOG or -W NOE flag in the command.
EXAMPLES
1. To rename a file, enter:
mv file1 file2
This renames file1 to file2.Ifafile named file2 already exists, its old contents are
replaced with those of file1.
2. To move a directory, enter:
mv dir1 dir2
This moves dir1 to dir2. It moves all files and directories under dir1 to the directory
named dir2, if the second directory exists. Otherwise, the directory dir1 gets renamed
dir2.
3. To move a file to another directory and give it a new name, enter:
mv file1 dir1/file2
This moves file1 to dir1/file2. The name file1 is removed from the current directory, and
the same file appears as file2 in the directory dir1.
4. To move a file to another directory, keeping the same name, enter:
mv file1 dir1
This moves file1 to dir1/file1.
5. To move several files into another directory, enter:
mv file1 dir1/file2 /u/dir2
This moves file1 to /u/dir2/file1 and dir1/file2 to /u/dir2/file2.
6. To use mv with pattern-matching characters, enter:
mv dir1/* .
This moves all files in the directory dir1 into the current directory (.), giving them the
same names they had in dir1. This also empties dir1. Note that you must type a space
527188-003 Hewlett-Packard Company 6−27