How do I move or rename a directory or file?



  • The "mv" command has two purposes, one, to move a file or directory to another location under the UNIX directory structure, and two, to rename a file or directory.

    To move a file or directory

    $ mv "name of your file" "new location of file"
    eg:
    $ mv filelist /var/tmp
    

    For directories, it's the same

    $ mv "name of directory" "new location of directory"
    eg:
    $ mv olddir /var/tmp
    

    To rename a file or directory

    $ mv oldfile newfile
    or
    $ mv olddir newdir
    

Log in to reply
 

© Lightnetics 2024