Skip to main content

Moving Files and Directories

Used to organize, rename, or move files and directories.


Move or Rename Files

Moves or renames a file or directory.

Command:

mv file.txt /home/user/

Rename a file:

mv oldname.txt newname.txt

Copy Files

Copies files from one place to another.

Command:

cp notes.txt /backup/

Copy Directories Recursively

Copies an entire directory, including its contents.

Command:

cp -r project /backup/