File copy¶
Move file or folder¶
mv test/file-a /dev/file-b
mv test/folder-a/ folder-b/
mv /path/folder/* /anotherpath/folder/ #hidden files will be excluded
Delete file and folder¶
Copy folder¶
cp -option1 -option2 source destination
cp -r ./source/ /dest/ #copy source folder into dest folder
cp -a ./source/. ./dest/ #content in source to dest, reserve all file attributes
#example
cp -avr /home/books /usb/backup
-a: Preserve the specified attributes such as directory and file mode, ownership, timestamps,
if possible additional attributes: context, links, xattr, all.
-v: Verbose output.
-r: Copy directories recursively.
copy from ssh-connected machine to current machine¶
scp: secure copy allows us to securely transfer files between machines over SSH.
sftp: SSH File Transfer Protocol allows browsing and transferring files between machines securely.