05 Moving and Copying
- Moving Files and Directories with
mv
mv
(Move) command performs a cut and paste in one step.- Requires two arguments: the item to move and the destination.
- Supports relative and absolute paths for flexibility.
- Can move multiple items at once by listing multiple files before the destination.
- Checking Moved Items
ls <directory>
can confirm a file’s new location without navigating into the directory.- GUI can be used to visually verify the changes.
- Copying Files and Directories with
cp
cp
(Copy) creates a duplicate of a file or folder.- Works like
mv
but leaves the original file untouched. - Requires two arguments: the item to copy and the destination.
- To copy a directory, use
cp -r
(recursive copy), ascp
alone only copies files.
- Using Options with Commands
- Many commands support options like
-r
for recursive copying. - Options modify behavior and are useful when handling directories.
Tab
completion helps avoid typos and speeds up command execution.
- Many commands support options like
Next in Playlist: 06 Removing Directories and Using the History