《Linux 系列》- 经常使用命令- 文件浏览命令]

cat命令 :适合查看少许信息的文件

操做: cat file1
快捷查看当前文件的内容java

[root@localhost ~]# cat initial-setup-ks.cfg 
#version=RHEL7
# X Window System configuration information
xconfig  --startxonboot

# License agreement
eula --agreed
# System authorization information
auth --enableshadow --passalgo=sha512
# Use CDROM installation media
cdrom
# Run the Setup Agent on first boot
firstboot --enable

more命令

分页显示文件内容
操做: more file1
Enter :向下n行,默认1行
空格键:向下滚动一屏 或 Ctrl + F
B:返回上一屏 或 Ctrl + B
q:退出moreredis

[root@localhost ~]# more initial-setup-ks.cfg 
#version=RHEL7
# X Window System configuration information
xconfig  --startxonboot

# License agreement
eula --agreed
# System authorization information
auth --enableshadow --passalgo=sha512
# Use CDROM installation media
cdrom
# Run the Setup Agent on first boot
firstboot --enable
# System services
services --enabled="chronyd"
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8

ignoredisk --only-use=sda
# Network information
network  --bootproto=dhcp --device=eno16777736 --ipv6=auto --activate
network  --bootproto=dhcp --hostname=localhost.localdomain
--More--(50%)


less -mN命令 :使用于大量数据的查看

分页显示文件内容,并标注行号
操做: less -mN file1
快捷键同 more命令bash

[root@localhost ~]# less -mN initial-setup-ks.cfg 

      1 #version=RHEL7
      2 # X Window System configuration information
      3 xconfig  --startxonboot
      4 
      5 # License agreement
      6 eula --agreed
      7 # System authorization information
      8 auth --enableshadow --passalgo=sha512
      9 # Use CDROM installation media
     10 cdrom
     11 # Run the Setup Agent on first boot
     12 firstboot --enable


tail :适合看日志

能够快速查看文件后x行的内容
操做: tail -10 file1less

[root@localhost ~]# tail -10 initial-setup-ks.cfg 
@internet-browser
@java-platform
@multimedia
@network-file-system-client
@print-client
@x11
chrony

%end
相关文章
相关标签/搜索