[root@centos01 ~]# more /etc/httpd/conf/httpd.conf
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html>
--More--(2%)
3、less——查看文件内容
less命令的作用与more命令相同,但扩展功能更多。基本语法格式如下:
交互操作方法:
Page Up键:向上翻页;
Page Down键:向下翻页;
“/”键:查找关键内容;
“n”:查找下一个关键内容;
“N”:查找上一个关键内容;
其他功能与more命令基本类似;
4、head、tail——查看文件内容
head、tail命令的基本语法格式如下:
head:查看文件开头的一部分内容(默认为10行);
tail:查看文件结尾的一部分内容(默认为10行);
应用举例:
[root@centos01 ~]# head -2 /var/log/messages <!--显示文件的开始2行内容-->
Jan 10 20:20:01 centos01 systemd: Started Session 9 of user root.
Jan 10 20:20:01 centos01 systemd: Starting Session 9 of user root.
[root@centos01 ~]#
[root@centos01 ~]# tail -3 /var/log/messages <!--显示文件的最后3行内容-->
Jan 10 23:10:01 centos01 systemd: Starting Session 30 of user root.
Jan 10 23:20:01 centos01 systemd: Started Session 31 of user root.
Jan 10 23:20:01 centos01 systemd: Starting Session 31 of user root.
[root@centos01 ~]#
[root@centos01 ~]# tail -f /var/log/messages
<!--动态跟踪文件尾部内容,便于实时监控文件内容的变化
(按Ctrl+c组合键终止)-->
Jan 10 23:01:01 centos01 systemd: Starting Session 29 of user root.
Jan 10 23:03:19 centos01 yum[11583]: Installed: httpd-tools-2.4.6-67.el7.centos.x86_64
Jan 10 23:03:19 centos01 yum[11583]: Installed: mailcap-2.1.41-2.el7.noarch
Jan 10 23:03:20 centos01 systemd: Reloading.
Jan 10 23:03:20 centos01 yum[11583]: Installed: httpd-2.4.6-67.el7.centos.x86_64
Jan 10 23:03:20 centos01 journal: g_dbus_interface_skeleton_unexport: assertion 'interface_->priv->connections != NULL' failed
Jan 10 23:10:01 centos01 systemd: Started Session 30 of user root.
Jan 10 23:10:01 centos01 systemd: Starting Session 30 of user root.
Jan 10 23:20:01 centos01 systemd: Started Session 31 of user root.
Jan 10 23:20:01 centos01 systemd: Starting Session 31 of user root.