美文网首页小码农养成记
一些常用的 linux 指令(一)

一些常用的 linux 指令(一)

作者: F_wind | 来源:发表于2021-10-25 22:33 被阅读0次

    linux

    1. 查看硬盘容量

    查询当前目录下前 5 个最大的文件大小信息

    du -h -a|sort -rn|head -5  
    

    查询当前路径下各个文件大小

    du -h
    

    查询所有硬盘文件大小

    df -f
    
    1. 设置系统语言(不必重启)

    Linux下使用 locale 命令设置语言环境
    配置文件路径:/etc/locale.gen
    执行生效:locale-gen

    1. linux 给用户添加 sudo 权限
    vim /etc/sudoers 
    # 新增用户
    root ALL=(ALL) ALL 
    
    1. 端口检查

    检查所有端口

    lsof -i
    

    检查制定端口

    lsof -i:port
    netstat -pltn | grep port
    
    1. 生成随机数
    openssl rand -base64 6 
    
    1. 远程复制

    建立 ssh 通道,然后执行命令:

    # -r 复制文件
    scp -r localfile username@ip:path
    
    1. 检查 shell 脚本语法错误
    sh -n test.sh 
    

    相关文章

      网友评论

        本文标题:一些常用的 linux 指令(一)

        本文链接:https://www.haomeiwen.com/subject/jhosaltx.html