File Operations
File Transfer
curl
-
Download and Save file with name extracted from the URL
curl https://example.com/my-file.sh -O -
Download and Save file with specified name
curl https://example.com/my-file.sh -O my-downloaded-file.sh
rsync
-
Commonly used command
rsync -avzP /PATH/TO/LOCAL/MY_FILE_FOLDER/ user@destination_machine:~/SOME_PARENT_FOLDER/
Explanation: (a)rchive, (v)erbose, (z)ip, (P)artial/(P)rogress.
SOURCEis the first argument,DESTINATIONcomes second. So, to copy from a remote machine, simply swap the arguments above.
- Example
rsync -avzP ~/Documents/assination_orders/ account_payables@[email protected]:~/Documents/orders_to_execute/
Archival, compression, extraction
tar
-
Create
tar zcvf target.tar.gz sourcefile -
Unpack
tar zxvf sourcefile -
List
tar ztvf sourcefile
(un)zip
-
Create zip archive from files
zip -r <target> <source_folder> -
Extract/expand zip archive
unzip <source_archive>