Linux命令查看文件内容
操作系统:CentOS 7.0
head、tail、cat命令主要用于查看文件内容,head是查看文件前的内容,tail命令是查看文件末尾内容,cat命令主要用于查看文件内容。
[sky9890@localhost tmp]$ head -10 /var/log/messages
head: 无法打开"/var/log/messages" 读取数据: 权限不够
[sky9890@localhost tmp]$ su #切换到root
密码:
[root@localhost tmp]# head -10 /var/log/messages #查看文件前10行
Aug 9 09:40:44 localhost journal: Runtime journal is using 6.1M (max allowed 49.1M, trying to leave 73.7M free of 485.4M available → current limit 49.1M).
Aug 9 09:40:44 localhost kernel: Initializing cgroup subsys cpuset
Aug 9 09:40:44 localhost kernel: Initializing cgroup subsys cpu
Aug 9 09:40:44 localhost kernel: Initializing cgroup subsys cpuacct
Aug 9 09:40:44 localhost kernel: Linux version 3.10.0-862.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC) ) #1 SMP Fri Apr 20 16:44:24 UTC 2018
Aug 9 09:40:44 localhost kernel: Command line: BOOT_IMAGE=/vmlinuz-3.10.0-862.el7.x86_64 root=/dev/mapper/centos-root ro crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet.UTF-8
Aug 9 09:40:44 localhost kernel: Disabled fast string operations
Aug 9 09:40:44 localhost kernel: e820: BIOS-provided physical RAM map:
Aug 9 09:40:44 localhost kernel: BIOS-e820: [mem 0x0000000000000000-0x000000000009efff] usable
Aug 9 09:40:44 localhost kernel: BIOS-e820: [mem 0x000000000009f000-0x000000000009ffff] reserved
[sky9890@localhost tmp]$ tail -fn 5 /var/log/messages
tail: 无法打开"/var/log/messages" 读取数据: 权限不够
tail: 没有剩余文件
[sky9890@localhost tmp]$ su #切换到root
密码:
[root@localhost tmp]# tail -fn 5 /var/log/messages #查看文件末尾5行,按ctrl+z结束
Sep 1 15:44:09 localhost dhclient[832]: bound to 192.168.153.128 -- renewal in 709 seconds.
Sep 1 15:44:09 localhost dbus[644]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Sep 1 15:44:09 localhost systemd: Started Network Manager Script Dispatcher Service.
Sep 1 15:44:09 localhost nm-dispatcher: req:1 'dhcp4-change' [eth0]: new request (3 scripts)
Sep 1 15:44:09 localhost nm-dispatcher: req:1 'dhcp4-change' [eth0]: start running ordered scripts...
[root@localhost /]# cat /tmp/test.txt #查看文件内容
My name is WuHaiMing
I am From Ping Xiang.
- linux查看日志文件内容命令tail、cat、tac、head、echo
- Linux下查看文件内容的命令
- Linux 文件内容查看命令
- Linux 查看文件内容的命令
- Linux中查看文件内容的命令cat、more、less三者的区别
- linux 查看文件内容的命令
- Linux查看文件内容命令:more(转)
- linux命令--查看文件内容
- Linux中查看文本文件内容命令总结
- Linux查看文件内容的命令汇总
- Linux上查看文件内容的命令
- linux 查看文件内容的命令
- Linux下查看文件内容的命令
- Linux基本命令――查看文件内容
- linux 查看文件内容的命令
- Linux 中查看文件第n行内容的命令
- Linux 中查看文件第n行内容的命令
- linux查看日志文件内容命令tail、cat、tac、head、echo
- (转)linux查看日志文件内容命令tail、cat、tac、head、echo
- Linux下查看文件内容的命令