
每日分享三个Linux命令,悄悄培养读者的Linux技能。
显示文件开头内容
head [选项] 文件
参数:
head file.txt
默认显示文件前10行。
head -n 3 file.txt
head -n -10 file.txt
head -c 20 file.txt
head -c -2- file.txt
显示文件尾部内容
tail [选项] 文件
参数:
tail file.txt
默认显示文件尾部后10行内容。
tail -n 5 file.txt
tail -c 10 file.txt
tail -f file.txt
tail +10 file.txt
反向显示文件内容
tac [选项] 文件
参数:
注:与cat命令相反,从尾部开始显示。
tac file.txt
tac -v file.txt
[3] Linux每日智囊-“info,tree,stat”
[4] Linux每日智囊-“whatis,touch,which”
[5] Linux每日智囊-“mkdir,rmdir,rm”
[8] Linux每日智囊-“rename,basename,dirname”
[9] Linux每日智囊-“chown,chgrp,chmod”
[10] Linux每日智囊-“cat,more,less”