--- layout: page category-page: basic category-title: Basic commands author: Joy Albertini tags: directory path mv file title: mv ---
The mv
move a file from a directory to another:
Device-name:Current-position username$ mv path/name-file path2
You can verify the success of the operation by using the command ls with argument the path.
With mv you can rename a file: Device-name:Current-position username$ mv path/name-file mv path/newname-file
mv /home/user/desktop/file.txt /home/user/desktop/subfolder1/
-i
Prompt(request confirm) before overwriting the file (Overrides previous -f or -n options, and override file permission) -n
Don't permit to overwrite existing file -v
(verbose) will output information explaining what it's doing -f
(Force) force overwriting without prompting (overrides previous -i or -n options).