Linux:压缩命令

压缩命令:
  *.Z             compress   程式压缩的档案;  
  *.bz2         bzip2   程式压缩的档案;  
  *.gz           gzip   程式压缩的档案;  
  *.tar         tar   程式打包的资料,并没有压缩过;  
  *.tar.gz   tar   程式打包的档案,其中并且经过   gzip   的压缩
compress   filename     压缩文件     加[-d]解压     uncompress
gzip   filename       压缩     加[-d]解压     zcat   123.gz   查看压缩文件内容
bzip2   -z   filename     压缩     加[-d]解压       bzcat   filename.bz2     查看压缩文件内容
tar   -cvf   /home/123.tar   /etc     打包,不压缩
tar   -xvf   123.tar       解开包
tar   -zxvf   /home/123.tar.gz     以gzip解压
tar   -jxvf   /home/123.tar.bz2     以bzip2解压
tar   -ztvf   /tmp/etc.tar.gz       查看tar内容
cpio   -covB     >   [file ¦device]       份份
cpio   -icduv   <   [file ¦device]       还原
 
vi一般用法
一般模式                             编辑模式                                     指令模式
h   左                               a,i,r,o,A,I,R,O                           :w   保存
j   下                                 进入编辑模式                                 :w!   强制保存
k   上                                 dd   删除光标当前行                       :q!   不保存离开
l   右                                 ndd   删除n行                                   :wq!   保存后离开
0   移动到行首                 yy   复制当前行                                 :e!   还原原始档
$   移动到行尾                 nyy   复制n行                                     :w   filename   另存为
H   屏幕最上                     p,P   粘贴                                           :set   nu   设置行号
M   屏幕中央                     u     撤消                                             :set   nonu   取消行号
L   屏幕最下                     [Ctrl]+r   重做上一个动作               ZZ   保存离开
G   档案最后一行             [ctrl]+z   暂停退出                         :set   nohlsearch       永久地关闭高亮显示
/work   向下搜索                                                                       :sp   同时打开两个文档  
?work   向上搜索                                                                       [Ctrl]+w   两个文档设换
gg   移动到档案第一行                                                             :nohlsearch         暂时关闭高亮显示
 
认识SHELL
alias         显示当前所有的命令别名             alias   lm= "ls   -al "       命令别名         unalias   lm   取消命令别名
type             类似which
exprot         设置或显示环境变量
exprot   PATH= "$PATH ":/sbin     添加/sbin入PATH路径
echo   $PATH         显示PATH路径
bash             进入子程序
name=yang           设定变量
unset   name         取消变量
echo   $name         显示变量的内容
myname= "$name   its   me "       &       myname= &apos;$name   its   me &apos;           单引号时$name失去变量内容
ciw=/etc/sysconfig/network-scripts/           设置路径
env             列出所有环境变量
echo   $RANDOM         显示随意产生的数
set             设置SHELL
PS1= &apos;[/u@/h   /w   /A   #/#]/$   &apos;           提示字元的设定
      [root@linux   ~]#   read   [-pt]   variable           -----------读取键盘输入的变量
      参数:
      -p     :后面可以接提示字元!
      -t     :后面可以接等待的『秒数!』
declare         声明   shell   变量
ulimit   -a       显示所有限制资料
  ls   /tmp/yang   &&   echo   "exist "   ¦ ¦   echo   "not   exist "
  意思是说,当   ls   /tmp/yang   执行后,若正确,就执行echo   "exist "   ,若有问题,就执行echo   "not   exist "  
  echo   $PATH   ¦   cut   -d   &apos;: &apos;   -f   5               以:为分隔符,读取第5段内容
  export   ¦   cut   -c   10-20             读取第10到20个字节的内容
  last   ¦   grep   &apos;root &apos;         搜索有root的一行,加[-v]反向搜索
  cat   /etc/passwd   ¦   sort         排序显示
  cat   /etc/passwd   ¦   wc             显示『行、字数、字节数』
正规表示法
[root@test   root]#   grep   [-acinv]   &apos;搜寻字串 &apos;   filename
              参数说明:
              -a   :将   binary   档案以   text   档案的方式搜寻资料
              -c   :计算找到   &apos;搜寻字串 &apos;   的次数
              -i   :忽略大小写的不同,所以大小写视为相同
              -n   :顺便输出行号
              -v   :反向选择,亦即显示出没有   &apos;搜寻字串 &apos;   内容的那一行!
  grep   -n   &apos;the &apos;   123.txt           搜索the字符   -----------搜寻特定字串              
  grep   -n   &apos;t[ea]st &apos;   123.txt         搜索test或taste两个字符---------利用   []   来搜寻集合字元
  grep   -n   &apos;[^g]oo &apos;   123.txt           搜索前面不为g的oo-----------向选择   [^]  
  grep   -n   &apos;[0-9] &apos;   123.txt     搜索有0-9的数字
  grep   -n   &apos;^the &apos;   123.txt   搜索以the为行首-----------行首搜索^
  grep   -n   &apos;^[^a-zA-Z] &apos;   123.txt     搜索不以英文字母开头
  grep   -n   &apos;[a-z]$ &apos;   123.txt         搜索以a-z结尾的行----------   行尾搜索$
  grep   -n   &apos;g..d &apos;   123.txt           搜索开头g结尾d字符----------任意一个字元   .  
  grep   -n   &apos;ooo* &apos;   123.txt           搜索至少有两个oo的字符---------重复字元   *
sed         文本流编辑器         利用脚本命令来处理文本文件
awd         模式扫描和处理语言
  nl   123.txt   ¦   sed   &apos;2,5d &apos;       删除第二到第五行的内容
diff           比较文件的差异
cmp             比较两个文件是否有差异
patch         修补文件
pr               要打印的文件格式化 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章