linux中tail命令---用于查看文件内容 

最基本的是cat、more和less。 
1. 如果你只想看文件的前5行,可以使用head命令,如: 
head -5 /etc/passwd 
2. 如果你想查看文件的后10行,可以使用tail命令,如: 
tail -10 /etc/passwd 或 tail -n 10 /etc/passwd 
tail -f /var/log/messages 
参数-f使tail不停地去读最新的内容,这样有实时监视的效果 用Ctrl+c来终止! 
3. 查看文件中间一段,你可以使用sed命令,如: 
sed -n '5,10p' /etc/passwd 
这样你就可以只查看文件的第5行到第10行。

相关文章:

  • 2021-07-22
  • 2021-11-21
  • 2021-11-21
  • 2021-06-28
  • 2022-01-07
  • 2021-10-23
  • 2021-12-05
猜你喜欢
  • 2021-11-17
  • 2022-12-23
  • 2022-01-03
  • 2021-11-21
  • 2022-12-23
  • 2021-07-09
  • 2022-12-23
相关资源
相似解决方案