What are the options for tail?

0118

The tail command has several options that allow you to customize its behavior. Here are some commonly used options:

  1. -n <number>: Displays the last <number> lines of the file. For example, tail -n 10 filename shows the last 10 lines.

  2. -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.

  3. -c <number>: Displays the last <number> bytes of the file. For example, tail -c 100 filename shows the last 100 bytes.

  4. -q: Suppresses the output of headers when multiple files are being monitored.

  5. -s <seconds>: When used with -f, it specifies the number of seconds to wait between checks for new data.

  6. --help: Displays help information about the command and its options.

  7. --version: Displays the version information of the tail command.

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.

0 Comments

no data
Be the first to share your comment!