練習 1:查看磁碟使用率最高的檔案系統
df -h
# 找出 Use% 最高者,掛載點為 /
練習 2:掛載/卸載 USB 與 ISO
USB
mkdir -p ~/usb
mount /dev/sdb1 ~/usb
# 使用後
umount ~/usb
ISO
mkdir -p ~/iso
mount -o loop image.iso ~/iso
umount ~/iso
練習 3:建立檔案並設定權限 -r--r-----
touch test
chmod 440 test
# 驗證
ls -l test
練習 4:建立檔案權限 -rw-------
touch test2
chmod 600 test2
練習 5:查看 /etc/inittab 權限與擁有者
ls -l /etc/inittab
# 輸出:-rw-r--r-- 1 root root ... -> 擁有者 root,群組 root
練習 6:尋找 /etc 下大於 5KB 的目錄
find /etc -type d -size +5k
練習 7:找 root 家目錄下以 t 開頭的檔案,存入 /root/result
find /root -name "t*" -type f > /root/result
練習 8:建立 f1、f2 合併為 f3
ls -la /root > ~/f1
df -h > ~/f2
cat ~/f1 ~/f2 > ~/f3
練習 9:建立符號連結與硬連結
# 符號連結
ln -s /etc/fstab ~/fstab.link
# 硬連結
ln /etc/inittab ~/inittab.hard
練習 10:inode 差異驗證
touch test
ln test test.hard
ln -s test test.soft
ls -i test test.hard test.soft
# 硬連結 inode 相同,符號連結 inode 不同
練習 11:重建檔案後連結行為
echo "new" > test
cat test.hard # 仍顯示舊內容(同 inode,資料區塊未變)
cat test.soft # 顯示新內容(指向路徑)