• linux常用命令


    查看端口是否开启

    lsof -i:80

    查看端口是否占用,存在即已经被使用

    netstat –pna | grep 8080  

    列出当前系统打开文件(一切资源皆文件)(list open file)

    lsof -i | grep 8080 

    若netstat有,lsof无,考虑是否是ip有误

    开放端口命令: /sbin/iptables -I INPUT -p tcp --dport 8080 -j ACCEPT

    保存:/etc/rc.d/init.d/iptables save

    重启服务:/etc/init.d/iptables restart

    查看端口是否开放:/sbin/iptables -L -n

    复制目录及其子目录文件:cp -r  source target

    查看用户:cat /etc/passwd

    永久添加环境变量(影响所有用户)

    # vim /etc/profile
    在文档最后,添加:
    export PATH="/opt/STM/STLinux-2.3/devkit/sh4/bin:$PATH"
    保存,退出,然后运行:
    #source /etc/profile
     
    简略查看:export

    查看目录大小: du -hc        //h带大小单位    c显示目录及起子目录大小

    新建文件:touch fileA
    //如果fileA存在,使用touch指令可更改这个文件或目录的日期时间,包括存取时间和更改时间;
    //如果fileA不存在,touch指令会在当前目录下新建一个空白文件fileA。

    查看系统版本

    cat /etc/redhat-release

    uname -a

  • 相关阅读:
    博客园代码
    前端
    1338. Reduce Array Size to The Half
    1220. Count Vowels Permutation
    363. Max Sum of Rectangle No Larger Than K
    366. Find Leaves of Binary Tree
    443. String Compression
    8 · Rotate String
    886. Possible Bipartition
    LT 183 wood cut
  • 原文地址:https://www.cnblogs.com/wish5714/p/9144086.html
Copyright © 2020-2023  润新知