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
# 读取系统平均负载。后面的分数,分母表示系统进程总数,分子表示正在运行的进程数,最后一个数字表示最近运行的进程 ID。
$ cat /proc/loadavg
0.00 0.00 0.00 1/74 1248

# 读取 CPU 核心数目
$ grep 'model name' /proc/cpuinfo | wc -l
1
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容