mv
The command that moves files and directories, which is also how you rename them.
It replaces an existing destination file without asking unless -i or -n is given.
In more detail
Within one filesystem a move only changes the name, so it is instant even for huge files. Like cp, it overwrites an existing destination without asking unless you add -i or -n.
Examples
mv draft.txt final.txtmv -n source.txt dest.txtRelated terms
- cp — The command that copies files, and with -R whole directory trees.
- rm — The command that deletes files, and with -r whole directory trees, permanently.
Taught in
- Making, Copying, Moving And Removing — Bash Scripting & Command Line Automation
- SELinux Contexts: Labels, restorecon And Rules That Last — Red Hat Certified System Administrator (EX200) Exam Prep
- The Plan That Wanted To Destroy Production — HashiCorp Terraform Associate (004) Exam Prep
- Write, Plan, Apply, And What Init Prepares — HashiCorp Terraform Associate (004) Exam Prep
- Input Variables, Outputs, And Which Value Wins — HashiCorp Terraform Associate (004) Exam Prep
- Moved And Removed Blocks: Refactoring Without Rebuilding — HashiCorp Terraform Associate (004) Exam Prep
- Inspecting And Repairing State From The CLI — HashiCorp Terraform Associate (004) Exam Prep
- Trap Sprint: Twelve Answers That Are Almost True — HashiCorp Terraform Associate (004) Exam Prep
- Forbidden, With Perfect Permissions: Paths, ACL Masks And SELinux Denials — CompTIA Linux+ (XK0-006) Exam Prep
- Files: Globs, Copies And Compression — LPIC-1 Linux Administrator (101-500 and 102-500) Exam Prep