Linux Practice

Linux Practice

https://www.kernel.org/

http://www.gnu.org/

Coreutils - GNU core utilities

https://www.gnu.org/software/coreutils/

System context

uname: Print system information

Print all information

$ uname -a
Linux debian-512mb-sgp1-01 3.16.0-4-amd64 #1 SMP Debian 3.16.43-2+deb8u2 (2017-06-26) x86_64 GNU/Linux

Print the kernel release

$ uname -r
3.16.0-4-amd64

Print the kernel version

$ uname -v
#1 SMP Debian 3.16.43-2+deb8u2 (2017-06-26)

hostname: Print or set system name

Get the hostname

$ hostname
mysql.example.com
$ cat /etc/hostname
mysql.example.com

Set the hostname. Note, that this is effective only until the next reboot. Edit /etc/hostname for permanent change.

$ hostname redis.example.com
$ hostname
redis.example.com
$ cat /etc/hostname
mysql.example.com

$ echo redis.example.com > /etc/hostname
$ reboot ## REBOOT!!! ##
$ hostname
redis.example.com

uptime: Print system uptime and load

uptime prints the current time, the system's uptime, the number of logged-in users and the current load average.

$ uptime
 03:48:42 up 28 min,  2 users,  load average: 0.00, 0.00, 0.00
# 讀取系統(tǒng)平均負(fù)載。后面的分?jǐn)?shù),分母表示系統(tǒng)進(jìn)程總數(shù),分子表示正在運(yùn)行的進(jìn)程數(shù),最后一個(gè)數(shù)字表示最近運(yùn)行的進(jìn)程 ID。
$ cat /proc/loadavg
0.00 0.00 0.00 1/74 1248

# 讀取 CPU 核心數(shù)目
$ grep 'model name' /proc/cpuinfo | wc -l
1
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容