centos中常用命令

一:使用 CentOS 常用命令查看 cpu

centos 查看一段时间内cpu占用 centos 查看 cpu_centos 查看一段时间内cpu占用


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

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

centos 查看一段时间内cpu占用 centos 查看 cpu_centos_02


二.使用 CentOS 常用命令查看 cpu 是 32 位还是 64 位

查看 CPU 位数(32 or 64)

centos 查看一段时间内cpu占用 centos 查看 cpu_常用命令_03


三:使用 CentOS 常用命令查看当前 linux 的版本

more /etc/redhat-release

cat /etc/redhat-release

centos 查看一段时间内cpu占用 centos 查看 cpu_CentOS_04


四: 使用 CentOS 常用命令查看内核版本

uname -r

uname -a

centos 查看一段时间内cpu占用 centos 查看 cpu_CentOS_05


五: 使用 CentOS 常用命令查看当前时间

date

centos 查看一段时间内cpu占用 centos 查看 cpu_centos 查看一段时间内cpu占用_06


六: 使用 CentOS 常用命令查看硬盘和分区

df -h

fdisk -l 也可以查看分区

centos 查看一段时间内cpu占用 centos 查看 cpu_centos 查看一段时间内cpu占用_07


du -sh

可以看到全部占用的空间

du /etc -sh

可以看到这个目录的大小

centos 查看一段时间内cpu占用 centos 查看 cpu_CentOS_08


七: 使用 CentOS 常用命令查看安装的软件包

查看系统安装的时候装的软件包

rpm -qa

rpm -qa | wc -l

yum list installed | wc -l

centos 查看一段时间内cpu占用 centos 查看 cpu_centos中的常用命令_09


八: 使用 CentOS 常用命令查看 selinux 情况

sestatus

sestatus | cut -f2 -d:

cat /etc/sysconfig/selinux

centos 查看一段时间内cpu占用 centos 查看 cpu_centos中的常用命令_10


九: 使用 CentOS 常用命令查看 ip,mac 地址

ifconfig

centos 查看一段时间内cpu占用 centos 查看 cpu_常用命令_11


查看网关及路由信息

route

centos 查看一段时间内cpu占用 centos 查看 cpu_centos_12


查看dns

cat /etc/resolv.conf

centos 查看一段时间内cpu占用 centos 查看 cpu_常用命令_13


十:使用centos命令查看主机名

hostname

centos 查看一段时间内cpu占用 centos 查看 cpu_centos中的常用命令_14


十一: 使用centos命令查看系统资源使用情况

uptime

centos 查看一段时间内cpu占用 centos 查看 cpu_centos 查看一段时间内cpu占用_15


十二:实用命令

wget 网站 下载资源

tar zvxf 压缩包名称 解压

十三:centos文件常用命令

创建/改变文件系统命令

umount /dev/sdb1

mkfs -t ext4 /dev/sdb1

mount /dev/sdb1 /media

改变文件权限命令

chmod

改变某个文件的拥有者,并包含子目录

chown aa.txt:root -R test

查看文本并加上行号

cat -n aa.txt

合并两个文件的内容

cat aa.txt bb.txt > cc.txt

合并两个文件且追回到指定文件

cat aa.txt bb.txt >> cc.txt

清空某个文件

cat /dev/null > aa.txt

编辑文件的命令

Vi 的两种命令模式:命令模式,编辑模式

:w 保存当前文件

:q 直接退出

:wq 先保存后退出

十四:shoutdown -r now 重启

shoutdown -h now 关机

reboot 重启

poweroff 关机

十五:开机自启设置

vim /etc/rc.d/rc.local

chkconfig servicename on/off