Linux常用的软件和命令

1.压缩软件rarlinux

[root@XiaoFeng opt]# wget http://www.rarlab.com/rar/rarlinux-x64-5.5.0.tar.gz
[root@XiaoFeng opt]# tar zxvf rarlinux-x64-5.5.0.tar.gz --directory=/usr/local 
[root@XiaoFeng opt]# cd /usr/local/rar/
[root@XiaoFeng rar]# make
[root@XiaoFeng rar]# rar help
[root@XiaoFeng rar]# rar x FileName.rar DirName  #解压
[root@XiaoFeng rar]# rar a FileName.rar DirName  #压缩
[root@XiaoFeng rar]# rar d test.rar file1.txt    #从文档中删除文件
[root@XiaoFeng rar]# tar zxvf FileName.tar        #解包tar
[root@XiaoFeng rar]# tar zcvf FileName.tar DirName#压缩tar

以上就是rar的常用命令,一个rar操作只能有一个命令,而选项却可以有多个。 

------------------------------------------------------------------------ 

  rar选项有很多,在此无法一一说明,只示范经常使用的几个 

  cl 将文件名转换为小写 

  cu 将文件名转换为大写 

  例:rar a -cl test.rar FILe.txt 

  FILe.txt在添加进test.rar之后,变为file.txt 

  df 文档操作后删除源文件 

  例:rar a -df test.rar file1.txt file2.txt dir1 

  将file1.txt,file2.txt,dir1压缩到test.rar中之后,删除源文件 

  ed 不添加空目录 

  例:rar a -ed test.rar dir1 

  添加dir1到test.rar中时,不对空目录进行操作 

  rar e -ed test.rar 

  解压test.rar时,不生成空目录 

o+ 覆盖已有文件 

  o- 不覆盖已有文件 

  例:rar x -o- test.rar 

  解压test.rar文件,但是如果碰到以存在的文件则不覆盖

p[password] 设定密码 

  例:rar a test.rar *.txt -p prettygirl 

  压缩文件设定密码为prettygirl,解压时无密码无法进行操作 

  如果觉得明码密码太过暴露,可以使用 

  rar a test.rar *.txt -p 

  则rar程序会询问你要使用什么密码,不回显 

t 压缩完毕后进行完整性检验 

  例:rar a test.rar /home -t 

  压缩完毕后进行检验,如果有问题则报错。

x 排除特定的文件 

  例:rar x test.rar -x *.txt 

  解压test.rar中除*.txt以外的文档 

  x@ 同上,不过这次所有排除的文件放在list文件列表中 

  y 所有操作均回答yes 

  例如有时解压时每碰到相同文件就问是否覆盖(Y/N),加上-y就可以默认选择Yes,不再询问

2.在xshell里使用  rz上传  sz下载

[root@XiaoFeng opt]# yum install lrzsz
[root@XiaoFeng opt]# sz filename
[root@XiaoFeng opt]# rz

输入rz回车后,会出现文件选择对话框,选择需要上传文件,一次可以指定多个文件,上传到服务器的路径为当前执行rz命令的目录.

3.创建用户和目录权限

[root@XiaoFeng opt]# adduser -g sjd1 sjd2       #建用户时指定组sjd1组名  sjd2用户名
[root@XiaoFeng opt]#   usermod -aG php-fpm sjd    #将用户sjd加入到php-pfm用户组
[root@XiaoFeng opt]# passwd sjd2             #设置sjd2用户的密码
[root@XiaoFeng opt]# userdel               #此命令只删除用户  -r 连用户的宿主目录一起删完
[root@XiaoFeng opt]# chmod -R 777 html/        #文件夹777  文件666  满的权限
[root@XiaoFeng opt]# chown -R mysql:mysql data/    #更改文件的属主和属组
[root@XiaoFeng opt]#   id sjd  #查看用户属性

4.RPM

[root@XiaoFeng opt]# rpm -qa |grep mysql      #查看是否安装rpm包的mysql
[root@XiaoFeng opt]# rpm -e mysql-5.0.77-4     #卸载包

5.进程查看

[root@XiaoFeng opt]# ps -aux            查看进程  ps -aux |grep tty    管道过滤
[root@XiaoFeng opt]# kill -9             进程id   结束进程
[root@XiaoFeng opt]# netstat -lntup      查看运行中的程序和端口
[root@XiaoFeng  opt]#  sudo fuser -k 80/tcp  杀死占用80端口的进程

6.历史命令

[root@XiaoFeng opt]# vim ~/.bash_history  #令保存着本次未保存之前的所有历史记录,可以删除你不想记录的命令
[root@XiaoFeng opt]# history -c       #清空本次留在缓存中的历史命令
[root@XiaoFeng opt]# history -w       #将当前历史命令缓冲区命令写入历史命令文件中
[root@XiaoFeng opt]# history -d <offset>  #删除历史记录中第offset个命令

7.对系统磁盘空间和目录文件等查看大小

[root@XiaoFeng opt]# df -h      #查看磁盘占用的空间  
[root@XiaoFeng opt]# du -sh .    #对当前目录下所有的目录和文件的大小进行汇总
[root@XiaoFeng opt]# du -sh *    #对当前目录下每一个目录和文件的大小分别进行汇总

8.其它常用

[root@XiaoFeng opt]# tail -f /var/log/nginx/error.log #查看错误日志
[root@XiaoFeng opt]# service nginx start/restart systemctl start/restart nginx.service  nginx -s stop
[root@XiaoFeng opt]# which nginx  nginx -V  more /etc/init.d/nginx  #查看ngnix安装目录
[root@XiaoFeng opt]# nginx -s reload  不重起服务重新加载更新的配置文件

9.留给封面

小风博客

打 赏

小风博客 - XiaoFeng Blog - 佘佳栋的个人博客
请点评论按钮,登录后发表评论
  • 最新评论
  • 总共1条评论
小风博客 - XiaoFeng Blog - 佘佳栋的个人博客

扫地僧:m, 收藏

2018-04-16 20:32:37 回复