mv (move) command is used to move one or more files or directories from one place to another in file.

1. Rename a file

$ mv [previous-file-name] [new file name]

$ mv mdce.txt adce.txt

2. Move the content of one to another file

$ mv [Source-file-name] [destination file name]

$ mv aman.txt abhi.txt

This command move the content of aman.txt into the abhi.txt, file aman.txt will be delete after moving the data.

3. Move the directory

$ mv software hardware

Note : In this case the hardware directory doesn't exit.

This command move whole directory even files also into the hardware directory.

you can also move the content of that directory using mv command.

$ mv software hardware

Note : In this case the hardware directory doesn't exit.

- move the directory software into the hardware.
- rename the directory hardware to the software.

Now directory software contains the software folder which renamed from hardware.


Your feedback is important for us :)