UNIX 常用命令

小鬼豆發表於2020-08-09

UNIX 常用命令

50個最常用的Unix/Linux命令

tar grep find ssh sed
awk vim diff sort export
args ls pwd cd gzip
bzip2 unzip shutdown ftp crontab
service ps free top df
kill rm cp mv cat
mount chmod chown passwd mkdir
ifconfig uname whereis whatis locate
man tail less su mysql
yum rpm ping date wget

檔案和目錄:

這些命令允許你建立的目錄和處理檔案。

命令 描述
cat 顯示檔案內容
cd 改變當前目錄
chgrp 改變檔案或目錄之群組擁有權
chmod 改變檔案或目錄屬性
cp 拷貝檔案
file 顯示檔案型態
find 找尋檔案
grep 在本文件中找尋字串
head 顯示檔案的前幾行
ln 連結檔案或目錄
ls 將某一個目錄的內容顯示出來
mkdir 建立目錄
more 以分頁形式顯示資料
mv 搬移或重新命名檔案
od 以八進位檢視檔案內容
pwd 顯示現在工作目錄的路徑
rm 刪除檔案或目錄
rmdir 刪除子目錄,目錄內須無檔案
tail 顯示檔案的最後幾行
touch 改變檔案或目錄之最後修改時間

運算元據:

可以比較改變檔案的內容,並用下面的命令。

命令 描述
awk 模式和掃描處理語言
cmp 比較兩個檔案的內容
comm 比較排序資料
cut 挑出檔案的部份欄資料
diff 比較檔案或目錄之內容
dircmp 對二個目錄下的檔案進行比較
expand Expand tabs to spaces
join 結合兩個有共同的連結欄位的檔案
perl 資料操作語言
sed Stream text editor
sort 排序檔案內容
split 將檔案拆分為較小的檔案
csplit 將一個大的檔案分割成若干個較小的檔
tar 將檔案以儲存檔方式從磁帶或磁碟中取出或存放
tr 字元轉換的處理
uniq 去除檔案相同的行(須相鄰)
wc 計算檔案的行數、字數及字元數
vi 開啟 vi 檔案編輯器
vim Opens vim text editor
fmt Simple text formatter
spell Check text for spelling error
ispell Check text for spelling error
ispell Check text for spelling error
emacs GNU project Emacs
ex, edit Line editor
emacs GNU project Emacs
emacs GNU project Emacs

壓縮檔案:

檔案可能被壓縮以節省空間。壓縮檔案,可以建立和檢查:

命令 描述
compress 將檔案壓縮成 *.Z 格式
gunzip 解壓縮gzip壓縮檔案
gzip 壓縮方法,壓縮的檔名為 .gz
uncompress 將 *.Z 格式的壓縮檔解壓
unzip List, test and extract compressed files in a ZIP archive
zcat 顯示壓縮檔案的內容
cpio UNIX作業系統的一個檔案備份程式及檔案格式
zcmp Compare compressed files
zdiff Compare compressed files
zmore File perusal filter for crt viewing of compressed text
pack 對檔案進行壓縮
pcat 顯示壓縮檔的資料
unpack 對檔案進行解壓縮

獲取資訊:

各種UNIX手冊和文件上線。下面的 Shell 命令給出的資訊:

命令 描述
apropos Locate commands by keyword lookup
info Displays command information pages online
man 顯示命令用法
whatis Search the whatis database for complete words.
yelp GNOME help viewer

網路通訊:

這些命令是用來傳送和接收檔案從遠端主機到本地UNIX主機。

命令 描述
ftp File transfer program
rcp 拷貝檔案或目錄至遠端工作站,或自遠端工作站拷貝檔案或目錄
rlogin 進入遠端電腦系統
rsh Remote shell
tftp Trivial file transfer program
telnet 使終端連線到另一個主機
ssh Secure shell terminal or command connection
scp Secure shell remote file copy
sftp secure shell file transfer program
出於安全原因,有些命令在您的計算機可能會受到限制。

使用者之間的訊息:

UNIX 系統支援的螢幕上的訊息給其他使用者和世界各地的電子郵箱:

命令 描述
evolution Linux上的GUI郵件處理工具
mail 傳送或讀郵件程式
mesg 允許或拒絕郵件
parcel Send files to another user
pine Vdu-based mail utility
talk 與其他使用者通話
write 向其他使用者寫資訊

程式設計工具:

下面的程式語言和工具都是基於你已經安裝到你的 Unix。

命令 描述
dbx Sun debugger
gdb GNU debugger
make Maintain program groups and compile programs.
nm Print program’s name list
size Print program’s sizes
strip Remove symbol table and relocation bits
cb C program beautifier
cc ANSI C compiler for Suns SPARC systems
ctrace C program debugger
gcc GNU ANSI C Compiler
indent Indent and format C program source
bc Interactive arithmetic language processor
gcl GNU Common Lisp
perl General purpose language
php Web page embedded language
py Python language interpreter
asp Web page embedded language
CC C++ compiler for Suns SPARC systems
g++ GNU C++ Compiler
javac JAVA compiler
appletvieweir JAVA applet viewer
netbeans Java integrated development environment on Linux
sqlplus Run the Oracle SQL interpreter
sqlldr Run the Oracle SQL data loader
mysql Run the mysql SQL interpreter

系統命令:

這些命令列出或改變有關系統的資訊:

命令 描述
chfn Change your finger information
chgrp Change the group ownership of a file
chown 改變檔案的擁有者
date Print the date
determin Automatically find terminal type
du 顯示目錄所使用的磁碟空間
echo Echo arguments to the standard options
exit Quit the system
finger 可查詢本地機器或遠方機器使用者簡要資料
groupadd Create a user group
groups 檢查自己所屬的群組名稱及群組成員
homequota Show quota and file usage
iostat Report I/O statistics
kill 停止處理程式,通常先用 ps 命令查得 Process ID,再殺之
last Show last logins of users
logout 登出帳號
lun List user names or login ID
netstat Show network status
passwd 更改密碼
printenv Display value of a shell variable
ps Display the status of current processes
ps Print process status statistics
quota 顯示自己可用磁碟空間大小和限制
quotaon 設定檔案系統的使用者配額
quotaoff 關閉檔案系統的使用者配額
volcopy 拷貝整個檔案系統到磁帶或者另一個磁碟
reset Reset terminal mode
script Keep script of terminal session
script Save the output of a command or process
setenv 檢視或設定環境變數
stty Set terminal options
time Time a command
top Display all system processes
tset Set terminal mode
tty Print current terminal name
umask 顯示預設檢視檔案的許可權
uname Display name of the current system
uptime Get the system up time
useradd Create a user account
users Print names of logged in users
vmstat Report virtual memory statistics
w Show what logged in users are doing
who List logged in users
lpr 一般檔案之列印
lpq 檢查印表機狀態,及列印工作順序編號和使用者名稱
lprm 刪除印表機內之列印工作
fsck 檔案系統狀態報告與錯誤檢修

相關文章