我想关注一个文件,但tail -f始终以最后10行开头。有没有办法输出整个文件然后跟随?
我的目标是查找日志中所有出现的字符串,例如tail -f streaming_log | grep "string"。而且还包括所有以前的行。
我知道我可以做,tail -f -n 10000 file但是我不想先数行。
-n +<line>允许您指定起始行(1基于-):
tail -f -n +1 file # output entire file, then wait for new content
Run Code Online (Sandbox Code Playgroud)