linux常用命令

1、执行jar程序、切能在后台运行

$ nohup java -jar test.jar >temp.txt &

2、jobs命令和 fg命令:

     那么就会列出所有后台执行的作业,并且每个作业前面都有个编号。如果想将某个作业调回前台控制,只需要 fg + 编号即可。 $ fg 2

3、查看某端口占用的线程的pid

      netstat -nlp |grep :8080

4、查询指定进程的PID

     ps -ef | grep zookeeper

5、查看是否有某个运行的进程命令

     ps aux | grep my_post

6、查询指定进程名或者PID的占用情况

     ps -aux | grep zookeeper

     ps -aux | grep 2181

7、查看更详细的内存占比

      cat /proc/10997/status

8、文件压缩及解压

    tar -zcvf /home/xahot.tar.gz /xahot

    tar -zcvf 打包后生成的文件名全路径  要打包的目录(例子:把/xahot文件夹打包后生成一个/home/xahot.tar.gz的文件。)
    tar -zxvf /usr/local/test.tar.gz
    zip –q –r xahot.zip  /home/wwwroot/xahot
    unzip xahot.zip
    压缩命令详解引用:https://www.cnblogs.com/Alan-Jones/p/7488179.html
9、防火墙的开启、关闭、查看状态
      service方式
      查看防火墙状态:service iptables status
      开启防火墙:service iptables start
      关闭防火墙:service iptables stop
      iptables 方式
      查看防火墙状态:/etc/init.d/iptables status
      重启防火墙:/etc/init.d/iptables restart
      暂时关闭防火墙:/etc/init.d/iptables stop

     





原文地址:https://www.cnblogs.com/lgzbj2006/p/9781543.html