[Share Experiences] 我的常用命令行
Tofloor
poster avatar
爱开发
deepin
2023-10-06 17:53
Author
  • 查看目录占用空间

    # 查看当前目录
    du -h -d 1 . | sort -rh
    # 查看其它目录
    du -h -d 1 ~/Downloads | sort -rh
    # 查看所有根目录
    sudo du -h -d 1 / | sort -rh
    
  • 下载资源

    # GitHub 相关
    git clone https://ghproxy.com/https://github.com/xxx/xxx.git
    
    wget https://ghproxy.com/https://github.com/xxx/xxx/archive/refs/heads/main.zip
    
  • 终端方式下载资源 / 拉取资源

    需要自建相关资源。依赖 https://github.com/rofl0r/proxychains-ng 项目

    proxychains4 wget https://huggingface.co/xxx/xxx/resolve/main/xxx.bin
    
    proxychains4 git clone https://github.com/xxx/xxx.git
    
  • 替换目录下所有文件中的 aaa 为 bbb

    find /your/directory -type f -exec sed -i 's/aaa/bbb/g' {} \;
    
  • curl 通过 socks5 访问网站

    curl -x socks5h://127.0.0.1:1089 https://www.google.com/
    
  • curl bash 方式执行脚本时,二进制程序从 github 下载的

    DURL=https://deno.land/install.sh    
    curl -fsSL $DURL | sed "s@https://github.com@https://mirror.ghproxy.com/https://github.com@g" | bash
    

    即是在 curl 与 bash 之间添加 sed "s@https://github.com@https://mirror.ghproxy.com/https://github.com@g"


    常用命令

    • readlink:输入文件(夹)的绝对路径

      $ readlink -f ~/Downloads
      /home/username/Downloads
      
Reply Favorite View the author
All Replies
爱开发
deepin
2023-10-06 17:53
#1

占用楼待用

Reply View the author
晚秋(lateautumn)
Moderator
2023-12-23 22:30
#2

收藏了like

Reply View the author