常用命令 命令名稱 使用身份 cat user cd user cp user date user env user export user head user less user ln user lndir user ls user mkdir user more user mv user PATH user PS1 user pwd user rm user rmdir user tail user touch user tr user umask user vi user 功能說明 範例 顯示檔案內容 cat myfile.txt 次常用 cal user bc user rdate root alias user echo user dmesg user hexdump user hostname user uname user free user man user top user uptime user linux 重要命令 1/4 程序管理 kill user ps user jobs user at user fg user bg user sleep user 關機 reboot root poweroff root shutdown root 身份切換 sudo user/root su user/root 壓縮與解壓縮 gunzip user gzip user tar user bzip2 user bunzip2 user zip user unzip user compress user uncompress user xz user 工具程式 strip user file user cc/gcc/g++ user as user ld user nm user readelf user make user 儲存體管理 du user dd root df user linux 重要命令 2/4 sync root mount root umount root fdisk root mkfs.vfat root mkfs.ext2 root mkfs.ext3 root 程式修補與差異 diff user patch user 搜尋 grep user find user which user locate user 身份與權限 chmod user chown user chgrp root passwd user useradd root userdel root who user id user last user 模組 mknod root insmod root lsmod root modprobe root rmmod root 網路設定與連線 ping user ifconfig root netstat user route root iwconfig root iwlist root ssh user sftp user scp user linux 重要命令 3/4 wget user ip 軟體安裝與系統更新 apt-get root dkpg root Filename meta‐characters 假設目前目錄有以下 new1, new2, new3, new4, new5, new6, new10 等檔案。 結果 ls new* ls new? ls new[2-5] ls new[25] Quoting 執行命令 結果 echo ‘Single quotes “protect” double quotes’ echo “Well, isn’t that \”special\”?” echo “You have `ls | wc -l` files in `pwd`” x=100; echo “The value of \$x is $x” command forms 執行命令 功能 ls -l > file.txt & pwd; cd; ls cmd1 `cmd2` cmd1 | cmd2 | cmd3 cmd1 && cmd2 && cmd3 cmd1 || cmd2 || cmd3 redirection 執行命令 功能 gcc hello.c > file gcc hello.c >> file cat < file cat << _EOF gcc hello.c 2>file gcc hello.c >file 2>&1 gcc hello.c >file1 2>file2 linux 重要命令 4/4