centos 6.X 常用命令

service xxx restart? ? ? ? ? 重啟服務(wù)(xxx為服務(wù)名稱)

service httpd restart ?

service mysqld restart ??


chkconfig --list ? ? ? ? ? ? ? ?開機(jī)啟動(dòng)列表

chkconfig --add xxx? ? ? ? 增加開機(jī)啟動(dòng)服務(wù)(xxx為服務(wù)名稱)

chkconfig --add mysqld

chkconfig xxx on ? ? ? ? ? ?設(shè)置開機(jī)啟動(dòng)(xxx為服務(wù)名稱)

chkconfig xl2tpd on

chkconfig iptables on

chkconfig ipsec on


rm -rf /home/xxx ? ? ? ? ? ? ?刪除目錄(xxx為目錄名)

df -hl ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?查硬盤空間


passwd xxx ? ? ? ? ? ? ? ? ? ? ?設(shè)置用戶密碼(xxx為用戶名)


traceroute xxx ? ? ? ? ? ? ? ? ? 路由工具(xxx為網(wǎng)址或ip)

last | grep still | grep ppp ? ? PPTP VPN在線用戶查詢


其他命令

# uname -a?#查看內(nèi)核/操作系統(tǒng)/CPU信息

# head -n 1 /etc/issue?? #查看操作系統(tǒng)版本

# cat /proc/cpuinfo????? #查看CPU信息

# hostname?????????????? #查看計(jì)算機(jī)名

# lspci -tv????????????? #列出所有PCI設(shè)備

# lsusb -tv????????????? #列出所有USB設(shè)備

# lsmod????????????????? #列出加載的內(nèi)核模塊

# env??????????????????? #查看環(huán)境變量

資源

# free -m??????????????? #查看內(nèi)存使用量和交換區(qū)使用量

# df -h????????????????? #查看各分區(qū)使用情況

# du -sh <目錄名>??????? #查看指定目錄的大小

# grep MemTotal /proc/meminfo?? #查看內(nèi)存總量

# grep MemFree /proc/meminfo??? #查看空閑內(nèi)存量

# uptime???????????????? #查看系統(tǒng)運(yùn)行時(shí)間、用戶數(shù)、負(fù)載

# cat /proc/loadavg????? #查看系統(tǒng)負(fù)載

磁盤和分區(qū)

# mount | column -t????? #查看掛接的分區(qū)狀態(tài)

# fdisk -l?????????????? #查看所有分區(qū)

# swapon -s????????????? #查看所有交換分區(qū)

# hdparm -i /dev/hda???? #查看磁盤參數(shù)(僅適用于IDE設(shè)備)

# dmesg | grep IDE?????? #查看啟動(dòng)時(shí)IDE設(shè)備檢測(cè)狀況

網(wǎng)絡(luò)

# ifconfig?????????????? #查看所有網(wǎng)絡(luò)接口的屬性

# iptables -L??????????? #查看防火墻設(shè)置

# route -n?????????????? #查看路由表

# netstat -lntp????????? #查看所有監(jiān)聽端口

# netstat -antp????????? #查看所有已經(jīng)建立的連接

# netstat -s???????????? #查看網(wǎng)絡(luò)統(tǒng)計(jì)信息

進(jìn)程

# ps -ef???????????????? #查看所有進(jìn)程

# top??????????????????? #實(shí)時(shí)顯示進(jìn)程狀態(tài)

用戶

# w????????????????????? #查看活動(dòng)用戶

# id <用戶名>??????????? #查看指定用戶信息

# last?????????????????? #查看用戶登錄日志

# cut -d: -f1 /etc/passwd?? #查看系統(tǒng)所有用戶

# cut -d: -f1 /etc/group??? #查看系統(tǒng)所有組

# crontab -l???????????? #查看當(dāng)前用戶的計(jì)劃任務(wù)

服務(wù)

# chkconfig --list?????? #列出所有系統(tǒng)服務(wù)

# chkconfig --list | grep on??? #列出所有啟動(dòng)的系統(tǒng)服務(wù)

程序

# rpm -qa??????????????? #查看所有安裝的軟件包

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

推薦閱讀更多精彩內(nèi)容