crontab [Scheduled Tasks], tar [compression], grep [Find]

Scheduled tasks:
1. Create a scheduled task: crontab -e -----> 3
* / 1 * * * * DATE >> /tmp/data.txt
view the scheduled tasks: crontab -l
If more than 64 bytes. , written to a file inside ----> as follows:
cd / tmp
vim crontab.sh
! ===== # / bash / bin
===== DATE >> /tmp/data.txt
! If you do not write # / bash / bin, then write the following scheduled tasks:
* / 1 * * * * / bin / bash /tmp/crontab.sh
! If you write a # / bash / bin, the following scheduled tasks write:
. * / 1 * * * * /tmp/crontab.sh

/Tmp/data.txt view with CAT
----------------------------------------- ------------
* * * * * the command to BE the executed
- - - - - -
| | | | | |
| | | | | --- pre-order execution
| | | | - ---- day of the week from 0 to 7 (Sunday which can represent 0 or 7)
| | | ------- 12 represents the month from 1 to
| | --------- represents a date from 1 to 31
| ----------- represents 1 to 23 hours (0 = 0:00)
------------- 1 to 59 per min represents minutes * or * / 1 represents

-u user: to set a user's crontab services;
-e: edit a user's crontab file content. If you do not specify a user, then edit the current user's crontab file.
-l: Displays the contents of a user's crontab file, if you do not specify a user, then displays the current contents of the user's crontab file.
-r: delete a user's crontab file from / var / spool / cron directory, if you do not specify a user, the default is to delete the current user's crontab file.
-i: When you delete a user's crontab file to the confirmation prompt
2.tar compression
-c: a directive to establish parameters of the compressed file (create meaning);
-x: unlock a file compression parameter instructions!
-t: View tarfile files inside!
Special attention c / x / t while there is an only, it is impossible to simultaneously compression and decompression.
-z: gzip whether the property has both? Namely the need to use gzip compression?
-j: whether bzip2 has both attributes? That is, whether compressed with bzip2?
-v: display the file compression process! The commonly used, but is not recommended for use during the execution of the background!
-f: Use the file name, please note that after f immediately by the file name
-p: Use the original properties of the original file (property does not vary according to the user)
-P: You can use an absolute path to compress!
-N: ratio followed by the date (yyyy / mm / dd) Also new will be packaged into a new file!

# All .txt files in the current directory to be packaged and compressed archive file this.tar.gz
tar czvf this.tar.gz ./*.txt
# Extract the this.tar.gz in the current directory to the current directory
tar xzvf this.tar.gz ./

# The files in the entire / etc directory all packaged into /tmp/etc.tar
tar -cvf /tmp/etc.tar / etc # packaging only, not compressed!
tar -zcvf /tmp/etc.tar.gz / etc # after packaging, as gzip compress
the tar -jcvf /tmp/etc.tar.bz2 / etc # package to compress bzip2
# Extracting file
the tar # -xf a.tar.gz
the tar -xf a.tar.gz -C / tmp # unpacking specified path
3.grep
find the row with the better, grep better a.txt
not find better contain rows, a.txt of Better -v grep
grep -v a.txt list of Better look in that file which
only show keyword search:, grep -o better a.txt
not case sensitive: grep -i better a.txt
display keyword search in which row:, grep -on better a.txt or grep -n better a.txt
grep -E and egrep equivalent
 
 

Guess you like

Origin www.cnblogs.com/startl/p/11883433.html
Recommended