加入收藏 | 设为首页 | 会员中心 | 我要投稿 济南站长网 (https://www.0531zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

Common Linux log files name and usage--reference

发布时间:2021-01-24 03:29:30 所属栏目:Linux 来源:网络整理
导读:副标题#e# div id="post-body-7256318887016413630" class="post-single-body post-body" div dir="ltr"If you spend lot of time in Linux environment,it is essential that you know where the log files are located,and what is contained in each and

Example 10: Viewing compressed log filesAfter a specific time all the system log files are rotated,and compressed. You can uncompress it on the fly,and pipe the output to another unix command to view the file as explained below.<div class="block-panel">Display the first N lines of a compressed file.$ zcat file.gz | head -250

<div class="block-panel">Display the last N lines of a compressed file.$ zcat file.gz | tail -250

<div class="block-panel">Ignoring the last N lines of a compressed file.$ zcat file.gz | head -n -250

<div class="block-panel">Ignoring the first N lines of a compressed file.$ zcat file.gz | tail -n +250

<div class="block-panel">Viewing the lines matching the pattern$ zcat file.gz | grep -A2 'error'

<div class="block-panel">Viewing particular range of lines identified by line number.$ zcat file.gz | sed -n -e 45p -e 52p

reference:http://www.coolcoder.in/2013/12/common-linux-log-files-name-and-usage.html

(编辑:济南站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

热点阅读