mv

The mv command is used to move a file or directory from one location to another location. You can also move multiple files.

The following example shows a listing of a directory, the move of file krsort.c to krsort.test.c within this directory, and a listing of the directory showing that the file has been moved:

$ ls -l
total 168
-rwxr-xr-x   1 denise   users    34592 Oct 31 15:17 krsort
-rwxr-xr-x   1 denise   users     3234 Oct 31 15:17 krsort.c
-rwxr-xr-x   1 denise   users     2756 Oct 31 15:17 krsort.dos
-rw-r--r--   1 denise   users     9922 Oct 31 15:17 krsort.q
-rwxr-xr-x   1 denise   users    3085 Oct 31 15:17 krsortorig.c
$ mv krsort.c krsort.test.c
$ ls -l total 168 -rwxr-xr-x 1 denise users 34592 Oct 31 15:17 krsort -rwxr-xr-x 1 denise users 32756 Oct 31 15:17 krsort.dos ...

Get HP-UX 11i System Administration Handbook and Toolkit, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.