~/writing/工程/Terminal $ cat command-cheatsheet.md

📔 常用命令速查归档

主要是一些常用命令的笔记,方便回来查。

DATE
TAGS
工程 · 笔记
READ
1 分钟
NO.
011

System

  • Linux 查看 CPU 信息

    BASH
    cat /proc/cpuinfo
    • 查看型号
    BASH
    cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
    • Linux 物理 CPU 个数
    BASH
    cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l
    • Linux 查看每个物理 CPU 中 core 的个数
    BASH
    cat /proc/cpuinfo | grep "cpu cores"| uniq
    • Linux 查看逻辑 CPU 的个数
    BASH
    cat /proc/cpuinfo | grep "processor" | wc -l
  • Linux 查看实时系统资源

    BASH
    # Option 1 (Recommend): pip install bpytop
    bpytop
    
    # Option 2
    top
  • Linux 查看端口占用

    BASH
    # Option 1
    lsof -i:<PORT_NUM>  # Check who is occupying <PORT_NUM>
    
    # Option 2
    netstat -tunlp | grep <PORT_NUM>
  • Linux 间接观察文件大小增速(在拷贝文件/解压文件时)

    BASH
    watch -n 0.1 ls -al

Tmux

  • 查看所有 tmux 会话

    BASH
    # Command
    tmux ls  # Shortcut: Ctrl+B S
  • 新建 tmux 会话

    BASH
    # Command
    tmux new -s <session-name>
  • 分离 tmux 会话

    BASH
    # Command
    tmux detach  # Shortcut: Ctrl+B D
  • 重连 tmux 会话

    BASH
    # Command
    tmux attach -t <session-name>

引用本文

BIBTEX
@misc{brandozhang20211121,
  title  = {常用命令速查归档},
  author = {Brando ZHANG},
  year   = {2021},
  url    = {https://brando.dev/zh-hans/posts/command-cheatsheet/},
  month  = nov
}