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
0
votes
5 answers

Bash free command stops working

I am trying to do following: Get output of free -mo , take the 2nd line and log it to a file every 30 seconds. When I run $free -mo -s 30 It runs and displays output every 30 seconds. But when I run $ free -mo -s 30 | head -2 | tail -1 It runs…
Learn More
  • 1,535
  • 4
  • 29
  • 51
0
votes
1 answer

tail and head command in Linux

While executing, $ls -1rt /directory | head -n 3 file1.txt file2.txt file3.txt $ls -1rt /directory | tail -n 3 file2.txt file3.txt Could anyone tell me how the tail and head works internally during file listing and why this difference in no.of…
John
  • 2,035
  • 13
  • 35
  • 44
0
votes
2 answers

how to get X lines back with a streamreader

Trying to implement a custom tail-like function, after checking several examples i've come to the bellow code, which works quite well (doesn't load whole file to read the X ending lines, works for network paths ...) the problem I have is I don't…
Loïc MICHEL
  • 24,935
  • 9
  • 74
  • 103
0
votes
1 answer

GLOBIGNORE does not work with sudo command

I'm using a mini shell script in order to 'tail' (in real time) a bunch of log files. #!/bin/sh oldGLOBIGNORE=$GLOBIGNORE export GLOBIGNORE='foo-bar.log' sudo -E tail -f -n0 /var/log/*.log GLOBIGNORE=$oldGLOBIGNORE As you can see, I want to log…
magnetik
  • 4,351
  • 41
  • 58
0
votes
1 answer

How to delete tail grep matches?

I have checked out previous posts but could not find anything that worked for me. I have a log file that has been made huge by some recurring error that was a result of changes I made to a script. I want to delete all lines containing this error…
user1444664
0
votes
2 answers

Linux shell scripting - assigning tail value to a variable?

I'm setting up a shell script that reads the last line of a log file using: tail -1 "/path/to/gdscript.log" .. which is echo'ing the last line of the script just fine. The last line of the log dictates whether the process succeeded or failed, so…
PaulG
  • 53
  • 1
  • 11
0
votes
2 answers

Converting head program to tail C

I just got a semi function head program running and I need help making it into a tail program where it will display x number of lines at the end of the file. Here is my head code. I'm having trouble thinking of how to get the counter to read the…
V Or
  • 141
  • 5
  • 16
0
votes
1 answer

SystemOut.log file string search, Count and Alert via email when count reaches 10

I want to monitor SystemOut.log file using tail -f so I tried and held up with tail -f which is not allowing me to do other operations simultaneously. I might have missed few things, which you guys can help me out. I searched but couldn't get an…
Mr. K
  • 1
  • 3
0
votes
2 answers

Tail recursion cons operator Scala

If the last statement in a function is func(x,tailList): def func(x:Int):List[Int]... case head :: tailList => head :: func(x,tailList) converting this function to tail recursion requires accumulator to be added as a third parameter (and to…
Vikas Pandya
  • 1,998
  • 1
  • 15
  • 32
0
votes
2 answers

how to redict monitoring results from stdin to vim?

There is a stdin screen, being fed by tail -f log_file. And I want to view the monitoring result in a edit like vim, so that the monitored data can be searched at the same time. Is it possible to do this? PS: I have tried tail -f log_file | vim -,…
Richard
  • 14,642
  • 18
  • 56
  • 77
0
votes
2 answers

Cannot use 'tail -f" despite has enough memory

I got a problem with "tail -f", I cannot start it on my ubuntu machine. The message is "no memory left" (tail: kann * nicht beobachten: Auf dem Gerät ist kein Speicherplatz mehr verfügbar). No device has more than 4% usage and I also tried delete…
Daniel
  • 539
  • 4
  • 25
0
votes
2 answers

Command line: monitor log file and add data to database

I'm monitoring a log file. Each line has the following format: 2012 5 29 14 20 438.815 872.737 -1.89976 -0.55156 8.68749 -0.497848 -0.54559 0 0 6 00 0 0 …
Eamorr
  • 9,872
  • 34
  • 125
  • 209
0
votes
2 answers

how to tail the penult occurence of a pattern in a file

I know that using tail -1 I can take the last of occurence of a specific pattern in a file. But how to tail the penult? I tried tail-2 which gave me the penult and the last. I am using bash thanks
ziulfer
  • 1,339
  • 5
  • 18
  • 30
0
votes
2 answers

long running application (tail like)

I want to write an tail like app. Now this app, scans a file for changes in the background and fires events in case something changed. I want to run my application until the user requests to exit it by pressing ctrl + c (working by default). I do…
Matthias B
  • 5,523
  • 3
  • 45
  • 47
0
votes
2 answers

Perl - using sed or tail to remove first line of a file inline and return 1st line to a var

This is very new to me but, I am slowly picking it up. I need to open a file, return first line to a var to do stuff then delete first line from file after stuff is successful. In mt script, here is what prints all but the first line to…
Jim_Bo
  • 317
  • 5
  • 17