Debian 基本指令

基礎指令

查詢目前登入使用者(我是誰)

whoami

進入 root 權限

su -

顯示當前目錄

pwd

回到當前使用者家目錄

cd

回到上一層目錄

cd ..

回到上一個目錄

cd -

列出當前資料夾所有檔案以及隱藏檔

ls -la

查看檔案屬性

file 檔案名稱

系統相關

切換成全域英文語系

export LC_ALL=C

關機

shutdown now
or
systemctl shutdown now

重新開機

reboot
or
shutdonw -r now

登入系統 / 使用者

exit
or
logout

更新套件狀態

apt-get update

更新套件軟體

apt-get upgrade

移除模組

rmmod 模組名稱

載入模組

modprobe 模組名稱

修復開機 grub

update-grub

查詢系統各種東東

查詢硬碟分割區

lsblk

查詢 CPU 型號

cat /proc/cpuinfo

查詢 PCI 介面卡

lspci -k

查詢系統資訊

dmesg
or
dmidecode

查看系統模組按照名稱排序

lsmod | sort

查詢目標 IP 位址或是域名有無正常

ping IP/Domain

查詢使用者資訊

id 使用者名稱

查看記憶體與置換空間 (SWAP) 配置

free -h

查詢(當前)目錄容量

du -sh 路徑

查看系統所有已掛載的分區

df -h

使用者相關

重設使用者密碼

passwd 使用者名稱

新增使用者

useradd -m -s /bin/bash 使用者名稱

刪除使用者(不刪除家目錄)

userdel 使用者名稱

刪除使用者(刪除家目錄)

userdel -r 使用者名稱

新增群組

groupadd 群組名稱

刪除群組

groupdel 群組名稱

修改帳號資訊(將使用者加入 xxx 為次群組)

usermod -aG xxx 使用者名稱