###Symbolic Links###
Features:
1. Create shortcuts to objects on the file system
2. Support for 2-types of symlinks: soft (file containers) & hard (inodes)
3. Soft-links support directories
4. Hard-links do NOT support directories
5. Soft-links may traverse file systems, hard-links may not - due to inodes
6. Removal of soft-links will not remove the source content
7. Remove of the only hard-link, removes the file for good
8. Soft-links are of file type: 'l'
Usage:
1. 'ln -s source target'
a. 'ln -s ../parltest1.pl .' - create a soft-link of the same name as the source
Note: Soft-links depend heavily/entirely upon the filename container of the source file
Note: Soft-links SHOULD use Absolutely path
b. 'ln -s /etc .' - creates a soft-link to /etc
2. Hard Links - omitt the 's' option
a. 'ln ../perltest1.pl' - creates a hard-link, upping the reference count
b. 'ln perltest1.pl newhardperltest1.pl' - creates a hard-link with alternate name
Note: Hard-links always reference the same inode using the same and/or alternate names
Note: Soft-links are assigned distinct inodes, with ultimately reference the source file's name
c. Create hard-links with different permissions
c1. 'ln /home/linuxcbt/Debian_5x/perltest1.pl && chmod 644 perltest1.pl'
###Tar, Gzip, Bzip2, Zip###
Features:
1. Archiving
2. Compression
Gzip:
1. 'gzip -c filename > filename.gz'
a. 'seq 1000000 > 1million.txt && ls -lh 1mil*'
b. 'gzip -c 1million.txt > 1million.txt.gz'
b1. 'zcat 1million.txt.gz' - read the binary zgip format and render ASCII text
c. 'gunzip 1million.txt.gz'
c. 'gzip -l 1million.txt.gz' - enumerates sates of file
2. Bzip2
a. 'bzip2 -c 1million.txt > 1million.txt.bz2' - creates compressed file
b. 'bunzip2 1million.txt.bz2'
c. 'bzcat 1million.txt.bz2'
3. Zip & Unzip
a. 'zip 1million.txt.zip 1million.txt' - dest source - creates a zip file
b. 'unzip 1million.txt.zip' - decompresses
c. 'zip stuff.txt.zip *txt' - squeezes ALL 'txt files in current directory
d. 'unzip -l filename.zip' enumerates stats
e. 'zcat filename.zip' - extract on the fly and dump to STDOUT
Note: 'zcat' applies to both: zip & gzip
4. Tar - archive - rolls one or more files (including directories) into one p_w_picpath
a. 'tar -cvf alltxtfiles.tar *txt' - roll ALL txt files into 'alltxtfiles.tar'
b. 'tar -tvf alltxtfiles.tar' - enumerates the contents of the tarball
c. 'tar -xvf alltxtfiles.tar' - extracts the contents of the tarbal on current directory
d. 'tar -xvf alltxtfiles.tar 1000.txt 100k.txt' - extracts specific files from tarball
e. 'tar -czvf alltxtfiles.tar.gz *txt' - rolls a tarball with gzip compression
f. 'tar -cjvf alltxtfiles.tar.bz2 *txt' - rolls a tarball with bzip2 compression
RH135-3-other-usefull-tools
原创williamherry ©著作权
文章标签 职场 休闲 linux note 文章分类 运维
![](https://ucenter.51cto.com/images/noavatar_middle.gif)