linux常用命令-查看文本/cat,tac,more,less,head,tail
2017-02-12 19:02
761 查看
cat:连接并显示文件
NAME
cat - concatenate files and print on the standard output
[root@localhost ~]# cat /etc/issue
Red Hat Enterprise Server release 6.6 (Santiago)
\m
[root@localhost ~]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Sun Jun 21 02:15:00 2015
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=57d85756-7680-4c7c-9125-6ad67dae2c45 / ext4 defaults 1 1
UUID=2622a4b4-ddc9-47a3-aa2b-f06bc9bec085 /boot ext4 defaults 1 2
UUID=33d94759-fa01-4c4f-b4ac-bf3a1fe5e84f swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
[root@localhost ~]# cat /etc/issue /etc/fstab
Red Hat Enterprise Server release 6.6 (Santiago)
\m
#
# /etc/fstab
# Created by anaconda on Sun Jun 21 02:15:00 2015
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=57d85756-7680-4c7c-9125-6ad67dae2c45 / ext4 defaults 1 1
UUID=2622a4b4-ddc9-47a3-aa2b-f06bc9bec085 /boot ext4 defaults 1 2
UUID=33d94759-fa01-4c4f-b4ac-bf3a1fe5e84f swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
[root@localhost ~]#
-n, --number(显示行号)
number all output lines
[root@localhost ~]# cat -n /etc/issue
1 Red Hat Enterprise Server release 6.6 (Santiago)
2 \m
3
-E, --show-ends(显示结束符号$,windows结束符为$+回车)
display $ at end of each line
[root@localhost ~]# cat -E /etc/issue
Red Hat Enterprise Server release 6.6 (Santiago)$
\m$
$
tac:倒叙显示文本
NAME
tac - concatenate and print files in reverse
[root@localhost ~]# cat /etc/issue
Red Hat Enterprise Server release 6.6 (Santiago)
\m
[root@localhost ~]# tac /etc/issue
\m
Red Hat Enterprise Server release 6.6 (Santiago)
more、less:分屏查看
more支持向后翻屏,翻到文章尾部后退出
less不会退出
head:输出文件首部
NAME
head - output the first part of files
[root@localhost ~]# head /etc/inittab
# inittab is only used by upstart for the default runlevel.
#
# ADDING OTHER CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# System initialization is started by /etc/init/rcS.conf
#
# Individual runlevels are started by /etc/init/rc.conf
#
# Ctrl-Alt-Delete is handled by /etc/init/control-alt-delete.conf
#
tail:输出文件尾部
NAME
tail - output the last part of files
[root@localhost ~]# tail /etc/inittab
# Default runlevel. The runlevels used are:
# 0 - halt (Do NOT set initdefault to this)
# 1 - Single user mode
# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)
# 3 - Full multiuser mode
# 4 - unused
# 5 - X11
# 6 - reboot (Do NOT set initdefault to this)
#
id:5:initdefault:
[root@localhost ~]#
-f, --follow[={name|descriptor}] (查看文件尾部后续追加内容)
output appended data as the file grows; -f, --follow, and --follow=descriptor are
equivalent
NAME
cat - concatenate files and print on the standard output
[root@localhost ~]# cat /etc/issue
Red Hat Enterprise Server release 6.6 (Santiago)
\m
[root@localhost ~]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Sun Jun 21 02:15:00 2015
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=57d85756-7680-4c7c-9125-6ad67dae2c45 / ext4 defaults 1 1
UUID=2622a4b4-ddc9-47a3-aa2b-f06bc9bec085 /boot ext4 defaults 1 2
UUID=33d94759-fa01-4c4f-b4ac-bf3a1fe5e84f swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
[root@localhost ~]# cat /etc/issue /etc/fstab
Red Hat Enterprise Server release 6.6 (Santiago)
\m
#
# /etc/fstab
# Created by anaconda on Sun Jun 21 02:15:00 2015
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=57d85756-7680-4c7c-9125-6ad67dae2c45 / ext4 defaults 1 1
UUID=2622a4b4-ddc9-47a3-aa2b-f06bc9bec085 /boot ext4 defaults 1 2
UUID=33d94759-fa01-4c4f-b4ac-bf3a1fe5e84f swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
[root@localhost ~]#
-n, --number(显示行号)
number all output lines
[root@localhost ~]# cat -n /etc/issue
1 Red Hat Enterprise Server release 6.6 (Santiago)
2 \m
3
-E, --show-ends(显示结束符号$,windows结束符为$+回车)
display $ at end of each line
[root@localhost ~]# cat -E /etc/issue
Red Hat Enterprise Server release 6.6 (Santiago)$
\m$
$
tac:倒叙显示文本
NAME
tac - concatenate and print files in reverse
[root@localhost ~]# cat /etc/issue
Red Hat Enterprise Server release 6.6 (Santiago)
\m
[root@localhost ~]# tac /etc/issue
\m
Red Hat Enterprise Server release 6.6 (Santiago)
more、less:分屏查看
more支持向后翻屏,翻到文章尾部后退出
less不会退出
head:输出文件首部
NAME
head - output the first part of files
[root@localhost ~]# head /etc/inittab
# inittab is only used by upstart for the default runlevel.
#
# ADDING OTHER CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# System initialization is started by /etc/init/rcS.conf
#
# Individual runlevels are started by /etc/init/rc.conf
#
# Ctrl-Alt-Delete is handled by /etc/init/control-alt-delete.conf
#
tail:输出文件尾部
NAME
tail - output the last part of files
[root@localhost ~]# tail /etc/inittab
# Default runlevel. The runlevels used are:
# 0 - halt (Do NOT set initdefault to this)
# 1 - Single user mode
# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)
# 3 - Full multiuser mode
# 4 - unused
# 5 - X11
# 6 - reboot (Do NOT set initdefault to this)
#
id:5:initdefault:
[root@localhost ~]#
-f, --follow[={name|descriptor}] (查看文件尾部后续追加内容)
output appended data as the file grows; -f, --follow, and --follow=descriptor are
equivalent
相关文章推荐
- Linux中查看文本文件内容命令cat/tac/nl/more/less/head/tail/vi总结
- Linux中查看文本文件内容命令cat/tac/nl/more/less/head/tail/vi总结
- Linux基础文本查看命令之 cat,tac,more,less,head,tail
- linux查看文本命令(cat、tac、more、less、head、tail)
- Linux中查看文本文件内容命令cat/tac/nl/more/less/head/tail/vi总结
- Linux基础之文本查看命令(cat,tac,rev,head,tail,more,less)
- Linux命令:查看文件内容cat|tac|more|less|head|tail|nl|od
- Linux下查看文件常用命令—cat,more,less,head,tail,od,file
- Linux 常用命令——cat, tac, nl, more, less, head, tail, od
- 文本文件查看命令:cat, tac, more, less, tail, head
- Linux下查看文件常用命令-cat,more,less,head,tail
- Linux显示文本的命令(cat, tac,more,less,head,tail,nl)
- Linux下查看文件常用命令—cat,more,less,head,tail
- linux常用命令touch,cat,tac,more,less,head,tail
- Linux文本查看命令 cat ,more ,less ,head,tail
- linux基础命令-文件查看类命令cat/tac/more/less/tail/head
- linux查看日志文件内容命令sed、cat、tac、more、less、head、tail、echo 1、按时间查询 sed -n '/2017-09-20 14:00:/,/2017-
- 【Linux命令详解】12、文本内容显示―[ cat、tac、more、less、tail、head]
- linux常用命令-查看文件内容(tail/head/cat/more/less)
- Linux 常用命令——cat, tac, nl, more, less, head, tail, od