UNIX Publication - Debian: http://unix.pub/docs/debian/ - APT用法: http://unix.pub/docs/debian/apt_usage/ - dpkg用法: http://unix.pub/docs/debian/dpkg_usage/ - Debian发行版: http://unix.pub/docs/debian/DebianReleases/ - Debian基本命令备忘录: http://unix.pub/docs/debian/Debian-Basic-Command-Memo/ - Debian软件包: http://unix.pub/docs/debian/debian_packages/ - Distribution: http://unix.pub/docs/distributions/ - Lilidog: http://unix.pub/docs/distributions/Lilidog/ - WDMyCloud vs Debian: http://unix.pub/docs/WDMyCloud/ - WD MyCloud Home安装运行Debian 11: http://unix.pub/docs/WDMyCloud/Running-Debian-11-on-WD-MyCloud-Home/ - WD MyCloud安装Debian Jessie: http://unix.pub/docs/WDMyCloud/Install-Debian-Jessie-on-WD-MyCloud-Gen1/ - WDMycloud救砖: http://unix.pub/docs/WDMyCloud/WDMycloud_Recovery/ - WDMycloud安装Debian: http://unix.pub/docs/WDMyCloud/WDMycloud_Crack_install_debian/ # Debian基本命令备忘录 ## 浏览目录 - `pwd` 显示工作目录 - `cd foo` 修改当前目录为foo - `cd` 进入当前用户目录(/home/$USER 或 ~/) - `cd ..` 进入上级目录 - `ls foo` 查看foo目录下内容 - `ls -a` 查看所有文件,包含隐藏文件 - `ls -l` 显示文件大小和属性 ## 文件/目录操作 - `mv source target` 移动source内容到target - `cp source target` 复制source内容到target - `cp -R source target` 复制source内目录到target (递归) - `ln source link` 为source创建硬链接link - `ln -s source link` 为source创建符号链接link - `touch foo` 创建foo文件或更新其修改时间 - `mkdir dirA` 创建目录dirA - `mkdir -p dirA/dirB` 创建目录以及上级目录 - `rm foo` 删除文件foo - `rm -f file` 删除写保护的文件 - `rmdir dirA` 删除空目录dirA - `rm -R dirB` 删除目录dirB (递归其中所有内容) - `du -h file or dir` 显示文件或目录大小 ## 查看/对比文件 - `wc file` 打印文件的字节计数、字数和行数 - `cat file` 显示文件内容 - `more file` 按页显示文件内容 '空格键'=下一页,'回车键'=下一行, 'u'=向上 - `less file` 显示文件内容,并可精确控制(Left/Right/Up/Down/PageUp/PageDown) - `head -n x file` 显示前x行内容 - `tail -n x file` 显示后x行内容 - `tail -f file` 动态显示最后一行内容 - `diff file1 file2` 显示两个文件的不同 - `diff -u file1 file2` 显示两个文件的不同 (补丁语法) - `comp file1 file2` 比较两个二进制文件 - `comp file1 file2 n N` compares file1 from the octet n and file2 from octet N ## 用户/群组管理 - `whoami` 显示当前用户名和id - `who` 显示当前所有登录用户 - `id` 显示当前用户id信息 (uid & gid & groups) - `id user` 显示用户id信息 (管理员可用) - `finger user` 查看用户相关信息 - `write user` 发送一条消息到当前用户终端 - `tty` 显示当前终端名 - `su - sudo` 切换到管理员模式 - `passwd` 修改当前用户密码 - `adduser` 添加用户 - `deluser` 删除用户 - `addgroup` 添加组 - `delgroup` 删除组 ## 进程管理 - `ps` 列出运行中的进程 - `ps ax` 列出所有运行中的进程 - `ps aux` 打印用户标识的所有流程 - `pstree` 以树的形式显示所有进行 - `top` 半图形化显示当前所有进程 - `kill signal pid` 以pid中止进程 - `pkill signal name` 以name中止进程 kill/pkill所用**Signals**分类: Signal | Mode | Action ---|---|--- -1 | HUP | 重载进程配置文件 -2 | INT | 中断进程 -3 | QUIT | 退出进程 -9 | KILL | 杀死进程 (尽量避免使用,试试'-15'先) -15 | TERM | 正常完成进程 -18 | STOP | 冻结进程 -20 | CONT | 恢复已冻结的进程 ## 硬件信息 - `lsusb` 列出USB设备 ``` (base) root@aly:~# lsusb Bus 001 Device 002: ID 0627:0001 Adomax Technology Co., Ltd QEMU Tablet Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub ``` - `lspci` 列出PCI设备 ``` (base) root@aly:~# lspci 00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02) 00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II] 00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II] 00:01.2 USB controller: Intel Corporation 82371SB PIIX3 USB [Natoma/Triton II] (rev 01) 00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03) 00:02.0 VGA compatible controller: Cirrus Logic GD 5446 00:03.0 Communication controller: Red Hat, Inc. Virtio console 00:04.0 SCSI storage controller: Red Hat, Inc. Virtio block device 00:05.0 Ethernet controller: Red Hat, Inc. Virtio network device 00:06.0 Unclassified device [00ff]: Red Hat, Inc. Virtio memory balloon (base) root@aly:~# ``` - `cat /proc/cpuinfo` 显示处理器信息 ``` (base) root@aly:~# cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 85 model name : Intel(R) Xeon(R) Platinum stepping : 4 microcode : 0x1 cpu MHz : 2499.998 cache size : 33792 KB physical id : 0 siblings : 2 core id : 0 cpu cores : 1 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 22 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves arat bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs taa itlb_multihit mmio_stale_data retbleed gds bhi bogomips : 4999.99 clflush size : 64 cache_alignment : 64 address sizes : 46 bits physical, 48 bits virtual power management: processor : 1 vendor_id : GenuineIntel cpu family : 6 model : 85 model name : Intel(R) Xeon(R) Platinum stepping : 4 microcode : 0x1 cpu MHz : 2499.998 cache size : 33792 KB physical id : 0 siblings : 2 core id : 0 cpu cores : 1 apicid : 1 initial apicid : 1 fpu : yes fpu_exception : yes cpuid level : 22 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves arat bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs taa itlb_multihit mmio_stale_data retbleed gds bhi bogomips : 4999.99 clflush size : 64 cache_alignment : 64 address sizes : 46 bits physical, 48 bits virtual power management: ``` - `cat /proc/partitions` 显示挂载的分区 ``` (base) root@aly:~# cat /proc/partitions major minor #blocks name 254 0 41943040 vda 254 1 1024 vda1 254 2 195584 vda2 254 3 41745391 vda3 ``` - `lspci | egrep "3D|Display|VGA"` 显示显卡型号 ``` (base) root@aly:~# lspci | egrep "3D|Display|VGA" 00:02.0 VGA compatible controller: Cirrus Logic GD 5446 ``` - `lspci | grep -i "net" | cut -d: -f3` 显示网卡型号 ``` (base) root@aly:~# lspci | grep -i "net" | cut -d: -f3 Red Hat, Inc. Virtio network device ``` - `lspci | grep -i audio | cut -d: -f3` 显示声卡型号 ## 网络信息 - `hostname` 设置或显示主机名 - `ping machine` ping主机 - `traceroute machine` 显示路由追踪 - `netstat` 按进程显示网络链接 - `netstat -a` 按服务显示网络链接 - `lsof` 显示文件和网络使用列标 - `ip address` 显示接口配置 - `route` 显示路由表 - `curl ifconfig.me` 显示公网IP