centos常用命令

來源:互聯網
上載者:User

標籤:

一:查看cpu

more /proc/cpuinfo | grep “model name”
grep “model name” /proc/cpuinfo

如果覺得需要看的更加舒服

grep “model name” /proc/cpuinfo | cut -f2 -d:

二:查看記憶體

grep MemTotal /proc/meminfo

grep MemTotal /proc/meminfo | cut -f2 -d:

free -m |grep “Mem” | awk ‘{print $2}’

三:查看cpu是32位還是64位

查看CPU位元(32 or 64)

getconf LONG_BIT

四:查看當前linux的版本

more /etc/redhat-release
cat /etc/redhat-release

五:查看核心版本

uname -r

uname -a

六:查看目前時間

date

上面已經介紹如何同步時間了,

七:查看硬碟和分區

df -h

fdisk -l

也可以查看分區

du -sh

可以看到全部佔用的空間

du /etc -sh

可以看到這個目錄的大小

八:查看安裝的軟體包

查看系統安裝的時候裝的軟體包

cat -n /root/install.log

more /root/install.log | wc -l

查看現在已經安裝了那些軟體包

rpm -qa

rpm -qa | wc -l

yum list installed | wc -l

不過很奇怪,我通過rpm,和yum這兩種方式查詢的安裝軟體包,數量並不一樣。沒有找到原因。

九:查看鍵盤配置

cat /etc/sysconfig/keyboard

cat /etc/sysconfig/keyboard | grep KEYTABLE | cut -f2 -d=

十:查看selinux情況

sestatus

sestatus | cut -f2 -d:

cat /etc/sysconfig/selinux

十一:查看ip,mac地址

在ifcfg-eth0 檔案裡你可以看到mac,網關等資訊。

ifconfig

cat /etc/sysconfig/network-scripts/ifcfg-eth0 | grep IPADDR

cat /etc/sysconfig/network-scripts/ifcfg-eth0 | grep IPADDR | cut -f2 -d=

ifconfig eth0 |grep “inet addr:” |awk ‘{print $2}’|cut -c 6-

ifconfig   | grep ‘inet addr:’| grep -v ‘127.0.0.1′ | cut -d: -f2 | awk ‘{ print $1}’

查看網關

cat /etc/sysconfig/network

查看dns

cat /etc/resolv.conf

十二:查看預設語言

echo $LANG $LANGUAGE

cat /etc/sysconfig/i18n

十三:查看所屬時區和是否使用UTC時間

cat /etc/sysconfig/clock

十四:查看主機名稱

hostname

cat /etc/sysconfig/network

修改主機名稱就是修改這個檔案,同時最好也把host檔案也修改。

# du -sh # 查看指定目錄的大小

# uptime # 查看系統已耗用時間、使用者數、負載

# cat /proc/loadavg # 查看系統負載

# iptables -L # 查看防火牆設定
# route -n # 查看路由表
# netstat -lntp # 查看所有監聽連接埠
# netstat -antp # 查看所有已經建立的串連
# netstat -s # 查看網路統計資訊

# w # 查看活動使用者
# id # 查看指定使用者資訊
# last # 查看使用者登入日誌
# cut -d: -f1 /etc/passwd # 查看系統所有使用者
# cut -d: -f1 /etc/group # 查看系統所有組
# crontab -l # 查看目前使用者的計劃任務
# chkconfig –list # 列出所有系統服務
# chkconfig –list | grep on # 列出所有啟動的系統服務

centos常用命令

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.