The tail command has several options that allow you to customize its behavior. Here are some commonly used options:
-
-n <number>: Displays the last<number>lines of the file. For example,tail -n 10 filenameshows the last 10 lines. -
-f: Follows the file as it grows, displaying new lines as they are added. This is useful for monitoring log files in real-time. For example,tail -f filename. -
-c <number>: Displays the last<number>bytes of the file. For example,tail -c 100 filenameshows the last 100 bytes. -
-q: Suppresses the output of headers when multiple files are being monitored. -
-s <seconds>: When used with-f, it specifies the number of seconds to wait between checks for new data. -
--help: Displays help information about the command and its options. -
--version: Displays the version information of thetailcommand.
You can combine these options as needed. For example, tail -n 5 -f filename will show the last 5 lines and continue to follow the file for new entries.
