RHCE的第三篇学习笔记

本节主要内容

1、系统状态检测命令
2、工作目录切换命令
3、文本文件编辑命令
4、文件目录管理命令
5、打包压缩搜索命令

系统状态检测命令

ifconfig

同Windows的的ipconfig命令区别在于,ifconfig是interface config 的简写。需注意交互的网卡名,ip,mask,RX和TX。

uname -a

查看主机名、内核版本、编译时间

uptime

查看系统负载,是top命令的简化版,负载不要超过1,生产环境不要超过5

free -h

查看内存使用情况,一般带-h参数即可,-k -m -g 表示以KB MB GB为单位显示使用情况

who

显示当前登录本机的用户及使用的终端

last

显示登陆系统的所有用户

history

显示当前用户的历史命令,可使用!编码数字 的方式来重复。 历史记录可使用-c 参数来清除。

sosreport

收集本机服务和配置信息,用于分析和远程支撑。

工作目录切换命令

pwd

print work directory的缩写,显示当前工作目录。

cd /etc

切换工作路径。类似于Windows中的cd 命令,但参数更多。如:
cd - 返回上一次目录
cd … 返回上一级目录
cd ~ 返回当前用户home目录
cd ~username 返回username用户home目录

ls -al

显示目录中的文件信息,参数a表示显示隐藏文件,l表示显示文件详细信息。
若想查看目录的属性,使用-d参数,如:

[root@localhost linuxprobe]# ls -ld /etc
drwxr-xr-x. 132 root root 8192 May 10  2019 /etc

文本文件编辑命令

[root@localhost linuxprobe]# cat -n .bash_profile 
     1	# .bash_profile
     2	
     3	# Get the aliases and functions
     4	if [ -f ~/.bashrc ]; then
     5		. ~/.bashrc
     6	fi
     7	
     8	# User specific environment and startup programs
     9	
    10	PATH=$PATH:$HOME/.local/bin:$HOME/bin
    11	
    12	export PATH

查看文本文件(较小的),-n 参数可显示行号

[root@localhost linuxprobe]# more .bash_profile 
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
	. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH

查看文本文件(内容较多)

[root@localhost linuxprobe]# head -n 20 .bash_profile 
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
	. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH

查看头20行

[root@localhost linuxprobe]# tail -n 20 .bash_profile 
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
	. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH

显示后20行,但tail更为有用的参数是 -f ,即不断刷新文件内容,当需要不断刷新查看日志文件时,此命令更为有用,如:

[root@localhost log]# tail -f messages
May 14 23:08:49 localhost dbus[1046]: [system] Activating via systemd: service name='net.reactivated.Fprint' unit='fprintd.service'
May 14 23:08:49
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值