Sunday 27, Apr 2025
We are moved to new domain
Click -> www.ehowtonow.com
Wednesday, 19 July 2017

tail Linux Command

tail

tail [options] [files]

Print the last 10 lines of each named file (or standard input if - is specified) on standard output. If more than one file is specified, the output includes a header at the beginning of each file:

= =>filename<= =

For options that take the number of bytes or lines as an argument, you prepend a plus sign (+) to num to begin printing with the numth item. These options can also specify a block size:

b
512 bytes

k
1 kilobyte

m
1 megabyte

Options

-c num, --bytes num
Print the last num bytes.

-f, --follow[=name|descriptor]
Don't quit at the end of file; "follow" file as it grows and end when the user presses Ctrl-C. Following by file descriptor is the default, so -f, --follow, and --follow=descriptor are equivalent. Use --follow=name to track the actual name of a file even if the file is renamed, as with a rotated logfile.

-F
Identical to --follow=name --retry.

--help
Print a help message and exit.

-n num, --lines=num
Print the last num lines.

--max-unchanged-stats=num
Used with --follow=name to reopen a file whose size hasn't changed after num iterations (default 5), to see if it has been unlinked or renamed (as with rotated logfiles).

--pid=pid
Used with -f to end when process ID pid dies.

-q, --quiet, --silent
Suppress filename headers.

--retry
With -f, keep trying to open a file even if it isn't accessible when tail starts or if it becomes inaccessible later.

-s sec, --sleep-interval=sec
With -f, sleep approximately sec seconds between iterations. Default is 1 second.

-v, --verbose
With multiple files, always output the filename headers.

--version
Print version information and then exit.

Examples

Show the last 20 lines containing instances of .Ah:

grep '\.Ah' file | tail -20

Show the last 10 characters of variable name:

echo "$name" | tail -c

Print the last two blocks of bigfile:

tail -2b bigfile

Shop and help us

Flipkart Offer Snapdeal offer Amazon.in offer Amazon.com offer

Related Posts:

  • egrep Linux Command egrep egrep [options] [regexp] [files] Search one or more files for lines that match an extended regular expression regexp. egrep doesn't support the regular expressions \(, \), \n, \<, \>, \{, or \}, but it does sup… Read More
  • wget Linux Command wget wget [options] [urls] Perform non-interactive file downloads from the Web. wget works in the background and can be used to set up and run a download without the user having to remain logged on. wget supports HTTP, HTT… Read More
  • which Linux Command which which [options] [--] [commands] List the full pathnames of the files that would be executed if the named commands had been run. which searches the user's $PATH environment variable. Options -a, --all Print all match… Read More
  • rsh Linux Command rsh rsh [options] host [command] Execute command on remote host, or, if no command is specified, begin an interactive shell on the remote host using rlogin. The options can be specified before or after host. Use of rsh has… Read More
  • routed Linux Command routed routed [options] [logfile] TCP/IP command. Network routing daemon. routed is invoked by a privileged user at boot time to manage the Internet routing tables. The routing daemon uses a variant of the Xerox NS Routing… Read More
  • Blogger Comments
  • Facebook Comments
  • Disqus Comments

0 comments:

Post a Comment

Item Reviewed: tail Linux Command Rating: 5 Reviewed By: eHowToNow