zoukankan      html  css  js  c++  java
  • linux常用命令

    1、查看系统资源占用情况: top

    2、查看内存占用情况:df -h

    3、查看该目录下文件内存使用: du -ah --max-depth=1

    4、创建文件夹: mkdir "文件夹名称"

    5、创建多层文件夹: mkdir -p /a/b/c

    6、创建多层文件夹并赋予属性: mkdir -m [属性] a

    7、查看实时日志: tail -f

    8、修改权限: chmod

    9、移动文件: mv

    10、复制文件: cp

    11、查看端口号是否启用: netstat -apn | grep 端口号

    12、查看进程:ps aux | grep 名称

    13、杀死进程: kill -9 进程号

    14、centos 7默认是firewall 操作命令

    1. 查看防火墙状态:firewall-cmd --state
    2. 启动防火墙:systemctl start firewalld
    3. 关闭防火墙:systemctl stop firewalld
    4. 开机启动防火墙: systemctl enable firewalld
    5. 取消开机启动: systemctl disable direwalld
    6. 开启8080端口:firewall-cmd --permanent --zone=public --add-port=8080/tcp
    7. 限制某ip访问某端口:firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.0.200" port protocol="tcp"
      port="80" reject"
    8. 重新加载 firewall-cmd --reload

    15、iptables防火墙操作命令

    1. 查看防火墙状态: service iptables status

    2. 停止防火墙:service iptables stop

    3. 启动防火墙:service iptables start

    4. 重启防火墙:service iptables restart

    5. 永久关闭防火墙:chkconfig iptables off

    6. 永久关闭后重启:chkconfig iptables on  

    7. 开启80端口

      vim /etc/sysconfig/iptables # 加入如下代码 -A INPUT -m state
      --state NEW -m tcp -p tcp --dport 80 -j ACCEPT 保存退出后重启防火墙

    8. service iptables restart

    16、查看主机名称: hostnamectl

    设置主机名称: hostnamectl set-hostname 名称

    17、根据PID寻找程序路径 pwdx PID
    18、终止程序

    ctrl + c 强制中断程序,进程已经终止。
    ctrl + z 将任务中止(暂停任务),任务暂停之后可以通过fg(前台启动)和 bg(后台启动)重新运 行中止 的任务。

    19、查找二进制程序、代码等相关文件路径:whereis(选项)(参数)
    20、操作系统版本信息 :cat /etc/redhat-release
    21、根据pid获取进程端口号

    netstat -anopt |grep $pid|head -n 1|awk '{printf $4}'|cut -d: -f4
    

    22、根据名称获取进程pid

    ps -ef|grep seata | grep -v grep | awk '{print $2}'
    
  • 相关阅读:
    Codeforces 1457D XOR-gun
    华东交通大学2020年ACM“双基”程序设计竞赛 题解
    Codeforces-1433F-Zero Remainder Sum
    Codeforces-1430D- String Deletion
    Codeforces 1315D Recommendations
    Codeforces Skyscrapers (hard version)
    Codeforces-1470C(Chocolate Bunny)
    Hdu 6863
    杭电多校2020-7&&hdu 6769 In Search of Gold
    Codeforces-1384B2 Koa and the Beach (Hard Version)
  • 原文地址:https://www.cnblogs.com/pengcool/p/15578443.html
Copyright © 2011-2022 走看看