Questions tagged [tail]

The tail is the part of a list that comes after the head. It's also a unix command that shows the last lines of a file.

Depending on the context tail may refer to:

  • the part of a list that comes after the head i.e. the list you obtain when you remove the first element.

  • the tail unix command which displays the last lines of a file. It's counterpart which displays the first lines is head (). Example: tail -n 10 file will output last 10 lines of file.


See also:

1032 questions
8
votes
2 answers

How does "tail -f" and logrotate work?

When I run tail -f for a log file, logrotate rotate it but tail -f did not stop. It continue show logs in new file. After that I try manually; mv my.log my.log.2 touch my.log echo "test text" >> my.log echo "test text" >> my.log It does not works.…
umut
  • 1,016
  • 1
  • 12
  • 25
8
votes
3 answers

bash tail on a live log file, counting uniq lines with same date/time

I'm looking for a good way to tail on a live log file, and display number of lines with the same date/time. Currently this is working: tail -F /var/logs/request.log | [cut the date-time] | uniq -c BUT the performance is not good enough. There is a…
zapp
  • 1,533
  • 1
  • 14
  • 18
8
votes
1 answer

ssh tail output lines only with keyword

I'm trying to tail a large file in an ssh command prompt, but I need to filter it so it only displays lines that contain a particular keyword in them. I'm using this command currently to tail. # tail /usr/local/apache/logs/access_log If possible…
sven30
  • 403
  • 2
  • 8
  • 15
8
votes
5 answers

following a log file over http

For security reasons (I'm a developer) I do not have command line access to our Production servers where log files are written. I can, however access those log files over HTTP. Is there a utility in the manner of "tail -f" that can "follow" a…
kurosch
  • 2,292
  • 16
  • 17
7
votes
7 answers

Succinct way to print all lines up until the last line that matches a given pattern

I'm trying to find a succinct shell one-liner that'll give me all the lines in a file up until some pattern. The use case is dumping all the lines in a log file until I spot some marker indicating that the server has been restarted. Here's a stupid…
7
votes
4 answers

Tail a text file on a web server via HTTP

Looking for input on how to solve the following problem. My ColdFusion 9 app has a simple logger that writes text to a file. On my dev machine, the file is local so I can use either 'tail -f' or CFB's TailView to watch it. I'd like a tool to watch…
DaveBurns
  • 2,036
  • 2
  • 27
  • 37
7
votes
1 answer

“P6opaque, Str” vs simple “Str” types in Perl 6

This is a follow-up to my previous question. I am finally able to reproduce the error here: my @recentList = prompt("Get recentList: e.g. 1 2 3: ").words || (2,4,6); say "the list is: ", @recentList; for @recentList -> $x { say "one…
lisprogtor
  • 5,677
  • 11
  • 17
7
votes
2 answers

Syslog - How to Show Colorized Messages?

I need to clarify that I am not looking to colorize the log output, and I am only interested in the program outputs that are written to syslog. So here is the scenario, I have a systemd unit service that runs a script, which indicates the 256 colors…
user3707763
  • 121
  • 1
  • 8
7
votes
4 answers

Get the last 10000 lines of a csv file

In pandas, I can just use pandas.io.parser.read_csv("file.csv", nrows=10000) to get the first 10000 lines of a csv file. But because my csv file is huge, and the last lines are more relevant than the first ones, I would like to read the last 10000…
Anaphory
  • 6,045
  • 4
  • 37
  • 68
7
votes
1 answer

"cat /dev/random" versus "tail -f /dev/random"

Statement cat /dev/random keeps producing output, as expected, but tail -f /dev/random hangs (at least on OSX and SUSE). Why the latter statement hangs?
Pedja
  • 125
  • 7
7
votes
3 answers

Shell Script to get exception from logs for last one hour

I am developing script which will grep logs of last one hour and check any exception and send email for solaris platform. I did following steps grep -n -h date +'%Y-%m-%d %H:%M' test.logs above command gives me line number and then i do…
ImranRazaKhan
  • 1,955
  • 5
  • 33
  • 74
7
votes
6 answers

Efficient way to get n middle lines from a very big file

I have a big file around 60GB. I need to get n middle lines of the file. I am using a command with head and tail like tail -m file |head -n >output.txt where m,n are numbers The general structure of the file is like below with set of records…
Mahesh
  • 99
  • 1
  • 5
7
votes
4 answers

Is it possible to use tail and grep in combination?

I am trying to tail a user in production log. Is it possible to use tail -f grep "username"
Pawan
  • 31,545
  • 102
  • 256
  • 434
7
votes
6 answers

how to continue run script after tail -f command

I have the following script: tail -f nohup.out echo 5 When I press Ctrl+C on tail -f, the script stops running: the 5 is not printed. How can I run the command echo 5 after I stop the tail command?
Richard
  • 14,642
  • 18
  • 56
  • 77
6
votes
3 answers

How to track a log file in TCL

Say there is a file log.txt and some kind of log is being appended to it permanently. I want to track that file in the TCL environment. I have tried this but it didn't worked. set log [open log.txt a] for { } { true } { update; after 1000 } { …
Vahagn
  • 4,670
  • 9
  • 43
  • 72