首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >ubuntu less分页查看log文件

ubuntu less分页查看log文件

作者头像
bear_fish
发布于 2018-09-19 12:38:16
发布于 2018-09-19 12:38:16
1.5K0
举报

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://cloud.tencent.com/developer/article/1342892

代码语言:txt
复制
              less命令查看 log 文件 

less  file.log  (打开了文件从第一行开始,若想移到最后一行 shift+g ctrl+b往前一页一页翻页查看)

j - 向前移动一行

k - 向后移动一行

G - 移动到最后一行

g - 移动到第一行

ctrl + F - 向前移动一屏

ctrl + B - 向后移动一屏

q / ZZ - 退出 less 命令

模仿 tail -f          Press F

向下10行 10j – 10

向上10行 10k 

  • CTRL+G – show the current file name along with line, byte and percentage statistics.
  • Less Command – Multiple file paging Method 1: You can open multiple files by passing the file names as arguments. $ less file1 file2 Method 2: While you are viewing file1, use :e to open the file2 as shown below. $ less file1 :e file2 Navigation across files: When you opened more than two files ( for e.g – less * ), use the following keys to navigate between files.
代码语言:txt
复制
- :n – go to the next file.
- :p – go to the previous file.

示例

查看命令历史使用记录并通过less分页显示

命令:

 history | less

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2017年01月06日,如有侵权请联系 cloudcommunity@tencent.com 删除
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档