One, the cat command
1, Cat use: Display the contents of the file
Ex:cat a.txt #显示a the contents of the. txt file
Cat/proc/uptime
第一个值表示系统从开机到现在的时间(s)第二个值表示系统开机后空闲的时间(s)系统空闲比:第二个值/第一个值
2. Command format: Cat [options] File name
Ex:cat/etc/sysconfig/network-scripts/ifcfg-eth0 #查看网络配置文件
3. Options
-b:非空行加上序号ex:cat -b/etc/sysconfig/network-scripts/ifcfg-eth0
-A :showall == -vETex:cat -A/etc/sysconfig/network-scripts/ifcfg-eth0 #将每行末尾换行符转换成$输出
-v:--show-nonprinting 使用^和M-引用,除LFD和TAB-E,--show-ends 在每行结束处显示"$"ex:cat -E/etc/sysconfig/network-scripts/ifcfg-eth0
-T, --show-tabs 将跳格字符显示为^Iex: cat -T a.txt #将a.txt文件中的TAB表示成^I输出
Ii. TAC Command
1. TAC Use
TAC: Flashback browse, for viewing time-updated files such as system logs
2. Command format
TAC [Options] File name
Ex:tac a.txt #倒序浏览a. txt files
3. Options
-b:before to add a separator flag before a row, not a line end
-r:regex 将分隔标志视作正则表达式来解析ex:tac -r a.txt
-s:separator 使用指定字符串代替换行符做分隔标志ex:tac -s aa.txt
Third, more &less command
(i), more orders
1、more more:全屏方式分页显示文件内容,常和管道符连用2、命令格式 more [选项] 文件名 ex:more/var/log/dmesg #查看dmesg日志文件
3. Operation method
1、enter:向下逐行滚动2、space:向下逐页翻动3、q:退出
(ii), less order
1. Less
Less: Same as more features, but more extended, often used with pipe characters
2. Command format
less [选项] 文件名ex:less/var/log/dmesg
3. Operation method
1、PgUP :上翻页2、PgDn :下翻页3、‘/’键查找内容,‘n’下一个内容,‘N’上一个内容
Iv. head&tail Command
1. Head
head:查看文件开头的前十行(默认)ex:head/var/log/dmesg #显示dmesg文件的前十行
Option:-n:n for Row count
EX:HEAD-11/VAR/LOG/DMESG #显示dmesg文件的前11行
2, tail
tail:查看文件末尾的后十行(默认)ex:tail/var/log/dmesg #显示dmesg文件的后十行
Options:
1、-n:n代表行数ex:tail -11 /var/log/dmesg #显示dmesg文件的后11行
2,-F: Tracking the content changes at the end of the file, real-time display of updated content
Linux Basic Content Display command