rsync is very useful program to backup the files.
-a is archive mode, it will reverse the created date of the files.
-v is the verbose, it can give you more information when rsync is running.
-z means to compress file data during the transfer.
-h means to output numbers in a human-readable format.
--delete is to delete the files in destination but not in the sources ( just like to create the identical copy).
rsync -avzh --delete --ignore-errors xxx@server:/test/ ./external_drive/
Suppose you want to login from your laptop to a server by ssh, each time you probably will be asked to input the password. Here are instructions to skip this step, but make sure your laptop will be safe, and no other people will use it.
Step 1:
in your laptop
ssh-keygen -t rsa -b 2048
, and hit enter key to accept the default setting.
Step 2:
in your laptop
ssh-copy-id username@XXXserver
That is all you need to do, next time you won't need to input the password.
cut command is useful for extracting data. Suppose we have
field1 field2 field3 fiedl4 ----------------------------------------- aaaaaa bbbbbb cccccc dddddd aaaaaa bbbbbb cccccc dddddd aaaaaa bbbbbb cccccc dddddd
cut -d ' ' -s -f 1,3 source.txt
aaaaaa cccccc aaaaaa cccccc aaaaaa cccccc
find command has many applications:
suppose we want to find the files we edited within 5 days ago.
find . -mtime -5 -iname "*.txt"
. means the current folder
-mtime means the modified time
-iname means the file name and ignore the case
- - - - - - - - - - - - - - - - - - - - - - - - -
find . -size +5M
find / -type f -size +10M -exec ls -lh {} \; 2>/dev/null