3

Living in the Shell #20; tail (Display/Follow File Content)

 2 years ago
source link: https://dev.to/babakks/living-in-the-shell-20-tail-displayfollow-file-content-3nm1
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

tail

Display or follow file content.

ℹ️ Here, following means streaming a file while it's being updated (appended).

ℹ️ You can use -c in place of -n in the following examples, to switch to binary offset selection.

Print bottom N lines of a file -n

tail -n 5 ~/.bashrc

Enter fullscreen mode

Exit fullscreen mode

Prints last 5 lines of ~/.bashrc

Print from N-th line afterwards -n +N

tail -n +3 ~/.bashrc

Enter fullscreen mode

Exit fullscreen mode

Prints ~/.bashrc from the 3rd line until the end.

Following syslog events -f

tail -f /var/log/syslog

Enter fullscreen mode

Exit fullscreen mode

Follows system logs (on Debian/Ubuntu).


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK