tar 命令:
Main operation mode:
-A, --catenate, --concatenate append tar files to an archive
-c, --create create a new archive
-d, --diff, --compare find differences between archive and file system
--delete delete from the archive (not on mag tapes!)
-r, --append append files to the end of an archive
-t, --list list the contents of an archive
--test-label test the archive volume label and exit
-u, --update only append files newer than copy in archive
-x, --extract, --get extract files from an archive
※值得注意几个地方
2)使用--delete、-u、-r、-A的时候,后面跟的备份文件都必须为未压缩的,若备份文件已经压缩,需要使用gunzip先解压,操作完后再gzip;
也就是说,不能对tar.gz、tar.bz2等文件直接操作的;
3)备份打包时,默认为相对路径;而排除匹配式默认也是全路径匹配的
所以,在打包时,会提示:“tar: Removing leading `/' from member names”
除非你使用-P参数或特定的参数指定
4)在使用--exclude参数时,需要注意几点:
a)其后可以用“=文件”或“空格 文件”两种方式;
b)其后跟的模式需与前面指定要打包的路径一致,例如:
tar -czvf /tmp/test.tar.gz ./ --exclude ./mysql
tar -czvf /tmp/test.tar.gz * --exclude mysql
tar -czvf /tmp/test.tar.gz /var/lib --exclude /var/lib/mysql
这与find的使用是类同的。
c)若排除的是目录,目录名后面不应该加“/”号,另外,在部分版本的tar中(不同平台或版本较低),需要在目录后面加*号,如“--exclude ./mysql/*”
d)如果要同时排除多个文件或目录,需加入多个--exclude参数,例如:
tar -czvf /tmp/test.tar.gz ./ --exclude ./mysql --exclude ./backup --exclude ./database
netstat 命令
ls 命令
Mandatory arguments to long options are mandatory for short options too.
-a, --all do not ignore entries starting with .
-A, --almost-all do not list implied . and ..
--author with -l, print the author of each file
-b, --escape print octal escapes for nongraphic characters
--block-size=SIZE use SIZE-byte blocks. See SIZE format below
-i, --inode print the index number of each file
-I, --ignore=PATTERN do not list implied entries matching shell PATTERN
-r, --reverse reverse order while sorting
-R, --recursive list subdirectories recursively
-s, --size print the allocated size of each file, in blocks
-S sort by file size
--sort=WORD sort by WORD instead of name: none -U,
extension -X, size -S, time -t, version -v
--time=WORD with -l, show time as WORD instead of modification
time: atime -u, access -u, use -u, ctime -c,
or status -c; use specified time as sort key
if --sort=time
--time-style=STYLE with -l, show times using style STYLE:
full-iso, long-iso, iso, locale, +FORMAT.
FORMAT is interpreted like `date'; if FORMAT is
FORMAT1<newline>FORMAT2, FORMAT1 applies to
non-recent files and FORMAT2 to recent files;
if STYLE is prefixed with `posix-', STYLE
takes effect only outside the POSIX locale
-t sort by modification time
-T, --tabsize=COLS assume tab stops at each COLS instead of 8
-u with -lt: sort by, and show, access time
with -l: show access time and sort by name
otherwise: sort by access time
-U do not sort; list entries in directory order
-v natural sort of (version) numbers within text
-w, --width=COLS assume screen width instead of current value
-x list entries by lines instead of by columns
-X sort alphabetically by entry extension
-1 list one file per line
gzip 命令