• Linux 常用命令


    1. 常用命令

    1.1 查看端口占用

    lsof -i:40002
    
    netstat -tunlp|grep 40002
    

    1.2. 压缩文件

    tar -zcvf 0514.tar.gz core-s-20405-1584510786  nohup.out log/20200318.log
    # 将 corexxx,nohup.out,log/xx.log 三个文件一起压缩成 0514.tar.gz
    
    tar -zcvf xjssmartinvest.tar.gz --exclude=xjssmartinvest/Release/log/* xjssmartinvest
    # 压缩排除指定路径
    tar -zcvf aCloudLocal.tar.gz --exclude *.log --exclude *.log.gz aCloudLocal
    # 压缩排除指定的文件类型
    tar
    -xzvf marketsev.tar.gz # 解压缩 marketsev.tar.gz

    1.3. 利用 tcpdump 抓包

    tcpdump tcp -i eth0 -s 0 -c 50 and dst port 60192 or src port 60192 -w ./target.cap
    
    # eth0:网卡名称,可用 ifconfig 获取
    # 50:抓取的包的大小
    # dist port 60192:监听端口
    # -w ./target.cap :写入当前路径下的文件 target.cap

    1.4. 查看系统配置

    cat /proc/cpuinfo 
    lscpu
    # 查看CPU详细信息
    
    cat /proc/meminfo
    free -m
    # 查看内存信息
    
    df -l
    查看硬盘信息

      

    1.5. 设置定时任务

    #方式1:
    vim /etc/crontab
    -- 修改配置文件
    crontab /etc/crontab
    -- 保存生效
    crontab -l
    -- 查看
    
    #方式2:
    crontab -e
    -- 新建定时任务并修改配置
    crontab -l
    -- 查看

      

    1.6. 查看资源利用率

    -- 查看利用率
    top
    
    -- 查看指定进程利用率
    top -p29264 -p25514
    
    -- 查看详细
    # press 1

      

    1.7. 防火墙

    -- 查看 80 端口是否开放
    firewall-cmd --query-port=80/tcp
    
    -- 开启 80 端口
    firewall-cmd --zone=public --add-port=80/tcp --permanent
    
    -- 重启防火墙
    firewall-cmd --reload
    
    -- 查看端口开启的列表
    firewall-cmd --list-port
    
    
    -----------------------
    -- 关闭防火墙
    systemctl stop firewalld.service #停止firewall
    systemctl disable firewalld.service #禁止firewall开机启动
    
    -- 修改 iptables
    vi /etc/sysconfig/iptables

    1.8 卸载

    # service zabbix stop   //这个命令是停止服务
    # rpm -qa | grep zabbix // 这个命令就会查看该操作系统上是否已经安装zabbix
    # yum remove zabbix(根据搜索出的类表依次卸载)  //这个命令是卸载zabbix
    有的话,我们就通过 rpm -e 命令 或者 rpm -e --nodeps 命令来卸载掉 # rpm -e zabbix(根据搜索出的类表依次卸载)  // 普通删除模式 # rpm -e --nodeps zabbix(根据搜索出的类表依次卸载)  // 强力删除模式,如果使用上面命令删除时,提示有依赖的其它文件,则用该命令可以对其进行强力删除
  • 相关阅读:
    The jQuery UI CSS Framework(中文说明)
    锁定表头和固定列(Fixed table head and columns)
    html5学习二(canvas)
    浅析深究什么是SOA
    页面加载完毕后执行js函数的方法
    Spring AOP详解(转)
    db2move详解
    DB2 命令总汇
    Ubuntu下Apache的配置
    maven打包的一些问题
  • 原文地址:https://www.cnblogs.com/bruce-he/p/12970620.html
Copyright © 2020-2023  润新知