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
10
votes
2 answers

dplyr and tail to change last value in a group_by in r

while using dplyr i'm having trouble changing the last value my data frame. i want to group by user and tag and change the Time to 0 for the last value / row in the group. user_id tag Time 1 268096674 1 3 2 268096674 …
itjcms18
  • 3,993
  • 7
  • 26
  • 45
10
votes
2 answers

Paramiko / ssh / tail + grep hangs

Situation: I want to tail remote logs over ssh with paramiko. channel.exec_command('tail -f log.log') works fine channel.exec_command('tail -f log.log | grep "filter" ') hangs Cannot understand reason why tail with grep hangs. Code example: import…
Anton Shishkov
  • 188
  • 2
  • 8
10
votes
3 answers

clear screen when the file is truncated while using `tail -f`

I'm using tail -f to print the content of a continuously changing file. When the file is truncated it shows up like this: blah (old).. blah more (old).. tail: file.out: file truncated blah.. blah more.. This can get messy when I change the file too…
none
  • 11,793
  • 9
  • 51
  • 87
9
votes
2 answers

Windows Log File Viewer (Tail) that displays lines in reverse order

I am looking for a free Windows GUI log file viewer that can display lines in reverse order with the newest lines at the top of the screen. Bonus points if it has an indication that there has been an update to the file. Open source also a plus but…
Automate
  • 183
  • 1
  • 9
9
votes
2 answers

Is "tail +2" supported by Linux?

I noticed that tail +2 is supported in Solaris ksh, but in Red Hat Linux, an error will occur: c008>> ps -p 4009,6282,31401,31409 | tail +2 tail: cannot open `+2' for reading: No such file or directory While in Solaris, bjbldd>> ps -p…
boyang
  • 667
  • 1
  • 8
  • 22
9
votes
4 answers

tailing aws lambda/cloudwatch logs

Found out how to access lambda logs from another answer Is it possible to tail them? (manually pressing refresh is cumbersome)
american-ninja-warrior
  • 7,397
  • 11
  • 46
  • 80
9
votes
2 answers

Tail only first few character of a line

I have a text log of computation which contains a line for each iteration. We track the computation with tail -f log.txt But the lines of log file are very long and the tail output is unreadable. I've tried this tail -f log.txt | head -c 50 but it…
sivic
  • 533
  • 6
  • 12
9
votes
4 answers

Why does Linq not have Head and Tail?

I often find myself wanting to use Head and Tail methods on IEnumerables, which don't exist as part of Linq. While I could easily write my own I wonder whether they have been purposefully left out. For example, var finalCondition = new Sql("WHERE @0…
Jim Jeffries
  • 9,841
  • 15
  • 62
  • 103
9
votes
2 answers

Haskell tail function for empty lists

I have a problem with a function that should only return the tail of a list. The functions is myTail and should give a useable result, even if the input is an empty list. I want to understand all 3 ways: pattern matching, guarded equation and…
Tarion
  • 16,283
  • 13
  • 71
  • 107
9
votes
3 answers

Tailing Log File and Write results to new file

I'm not sure how to word this so I'll type it out and then edit and answer any questions that come up.. Currently on my local network device (PHP4 based) I'm using this to tail a live system log file:…
MacMan
  • 925
  • 1
  • 14
  • 32
9
votes
3 answers

pipe tail output into another script

I am trying to pipe the output of a tail command into another bash script to process: tail -n +1 -f your_log_file | myscript.sh However, when I run it, the $1 parameter (inside the myscript.sh) never gets reached. What am I missing? How do I pipe…
slthomason
  • 373
  • 2
  • 4
  • 12
8
votes
1 answer

Can you supress asset messages when tailing the development.log?

During development of Ruby on Rails applications I have the development log constantly tailing via tail -f log/development.log. I have only started developing in Rails a few weeks ago, so I don't know if the log has always shown this many entries,…
tomthorgal
  • 525
  • 1
  • 4
  • 14
8
votes
3 answers

Apply formatting to unix shell

I've been looking at some server logs using tail -f recently, and have thought that it'd be much easier to see some things if I could format the output. Really all I'm looking for is a way to perhaps colour certain words (determined by a regex), and…
nickf
  • 537,072
  • 198
  • 649
  • 721
8
votes
10 answers

How can I read first n and last n lines from a file?

How can I read the first n lines and the last n lines of a file? For n=2, I read online that (head -n2 && tail -n2) would work, but it doesn't. $ cat x 1 2 3 4 5 $ cat x | (head -n2 && tail -n2) 1 2 The expected output for n=2 would be: 1 2 4 5
Amir
  • 5,996
  • 13
  • 48
  • 61
8
votes
3 answers

Grep after and before lines of last Match

I am searching through few logs and I want to grep the last match along with it's above and below few lines. grep -A10 -B10 "searchString" my.log will print all the matches with after and before 10 lines grep "searchString" my.log | tail -n 1 will…
RaceBase
  • 18,428
  • 47
  • 141
  • 202