The tail command is used to display the last part of a file. By default, it shows the last 10 lines of the specified file. Here are some common usages:
-
Basic usage:
tail filename.txt -
Display a specific number of lines:
To show the last 20 lines:tail -n 20 filename.txt -
Follow a file in real-time:
To continuously monitor a file for new lines (useful for log files):tail -f filename.txt -
Combine options:
You can combine options, for example, to show the last 5 lines and follow the file:tail -n 5 -f filename.txt
Feel free to ask if you need more specific examples or explanations!
