#輸出檔案末尾行(預設10行),當檔案有追加時,會輸出後續新增的行,不會中斷輸出,除非ctrl+c中斷
#-f 即 --follow=file.log
tail -f file.log
#輸出檔案末尾包含關鍵字的行,當檔案有追加時,會輸出後續新增的行,不會中斷輸出,除非ctrl+c中斷
#-f 即 --follow=file.log
tail -f file.log | grep "關鍵字"
#輸出檔案的後100行中包含關鍵字的行(-n 100 即 --lines=100)
tail -n 100 file.log | grep "關鍵字"
#輸出檔案的後100行中包含關鍵字的行和該行的後10行
tail -n 100 file.log | grep "關鍵字" -a10
#輸出檔案的後100行中包含關鍵字的行和該行的前10行
tail -n 100 file.log | grep "關鍵字" -b10
#輸出檔案的後100行中包含關鍵字的行和該行的前後10行
tail -n 100 file.log | grep "關鍵字" -b10 -a10
#輸出檔案的後100行中包含關鍵字的行和該行的前後10行 關鍵字加上顏色
tail -n 100 file.log | grep "關鍵字" -b10 -a10 --color=auto
linux tail 檢視日誌檔案方法
tail 命令從指定點開始將檔案寫到標準輸出.使用tail命令的 f選項可以方便的查閱正在改變的日誌檔案,tail f filename會把filename裡最尾部的內容顯示在螢幕上,並且不但重新整理,使你看到最新的檔案內容.1 命令格式 tail 必要引數 選擇引數 檔案 2 命令功能 用於顯示指...
linux tail 顯示末尾內容 檢視日誌
tail 必要引數 選擇引數 檔案 用於顯示指定檔案末尾內容,不指定檔案時,作為輸入資訊進行處理。常用檢視日誌檔案。tail 命令從指定點開始將檔案寫到標準輸出.使用tail命令的 f選項可以方便的查閱正在改變的日誌檔案,tail f filename會把filename裡最尾部的內容顯示在螢幕上,...
Linux tail 命令詳解
用途 從指定點開始將檔案寫到標準輸出。使用tail命令的 f選項可以方便的查閱正在改變的日誌檔案,tail f filename會把filename裡最尾部的內容顯示在螢幕上,並且不但重新整理,使你看到最新的檔案內容。語法標準語法 tail f c number n number m number ...