Questions tagged [tail]

Tail is a command-line program that by default outputs the last ten lines to standard output; with other command switches, particular numbers of lines can be specified and files can be monitored in real time.

67 questions
93
votes
2 answers

tail: Reading an entire file, and then following

I would like a tail -f type of behavior that reads the entire file and then continues to follow it as it's written to. SOLUTION Based on the answer I accepted, this works: tail -f -n +1 {filename} Why it works: The -f option continues to "follow"…
Sonny
  • 1,295
  • 1
  • 9
  • 15
67
votes
3 answers

User limit of inotify watches reached on Ubuntu 16.04

I just installed Ubuntu 16.04 and I get this warning when I start SmartGit: IOException: User limit of inotify watches reached Moreover I get this warning launching tail -f: tail: inotify resources exhausted tail: inotify cannot be used,…
Andrea
  • 1,077
45
votes
7 answers

GUI for watching logs (tail and grep)

Could you recommend a GUI application with powerful log watching capabilities? Generally it would work as tail -f in GUI, but on top of that following features would be very useful: filtering out some lines based on (regular) expressions coloring…
30
votes
7 answers

tail: inotify cannot be used, reverting to polling: Too many open files

When I try to tail -f catalina.out, I get the error: tail: inotify cannot be used, reverting to polling: Too many open files I tried the answer in this post: Too many open files - how to find the culprit lsof | awk '{ print $2; }' | sort -rn |…
gbag
  • 301
27
votes
2 answers

Tail - how to quit tail and restore terminal window?

Let's say we do: tail -f /var/log/apache2/error.log Then we see what we want to see, and then, we want to quit, so that we can navigate to other directories and so on... So, the question is: How can we quit tail ? I've tried to type: 'q', and…
MEM
  • 11,255
21
votes
5 answers

How to view multiple files in single terminal?

Sometimes I may need to access multiple log files for troubleshooting , but I don't want to open them in different terminals. What I want is to open them in same terminal. Is there any way I can view tail part of the multiple log files in a same…
Raja G
  • 105,327
  • 107
  • 262
  • 331
17
votes
4 answers

What does the 'tail' command do?

I'm new to Ubuntu. I previously ran a tail -f /var/logs/syslog and get the following displayed results: kernel: [ 2609.699995] [drm:gen6_sanitize_pm] *ERROR* Power management discrepancy: GEN6_RP_INTERRUPT_LIMITS expected 000d0000, was…
15
votes
6 answers

Which is faster to delete first line in file... sed or tail?

In this answer (How can I remove the first line of a file with sed?) there are two ways to delete the first record in a file: sed '1d' $file >> headerless.txt ** ---------------- OR ----------------** tail -n +2 $file >> headerless.txt Personally…
14
votes
4 answers

Tailing two log files

I have a web application that outputs to a number of log files with performance information. One log file outputs code execution times and another outputs SQL timings. I have no control over the logger or the code that produces the log files, but I…
Codemwnci
  • 1,259
11
votes
2 answers

Ending tail -f after print n lines

I have the following. A Java process writing logs on file A shell script starting the Java process. I need to read the log file after start Java process to check correct starting. I have try with tail -f but it remain append forever. I need tail…
9
votes
3 answers

Paginate with tail -f command

I am trying to tail file with pagination: tail -f foo.txt | more This works fine until file gets, lets say, 200 lines injected, when this happens nature of tail command is to go to end of file, at that point I lose track of trailing the log. Is…
Dolphin
  • 143
7
votes
1 answer

How to unzip only the first few lines of a zip archive?

I have a zipped text file a.zip I want to read the first 10 lines of it. Is it possible to do that without unzipping the whole file?
7
votes
4 answers

Move only the last 8 files in a directory to another directory

I'm trying to move the last 8 files from the Documents directory to another directory, but I don't want to move them one-by-one to that specific directory. Is it possible to move them with a substitute of the tail command, but for directories…
6
votes
1 answer

Highlighting with grep doesn't work in Xterm

I've got a problem with Xterm. When I use the command tail -F example.log | grep -a -i -e 'examplestring' in Xterm the "grepped" strings aren't highlighted in red like they would be in the normal terminal. How can I fix this? Google didn't help me…
Bannix
  • 61
5
votes
2 answers

tail output of program

How do you use tail to get the last line outputted by a program. I've tried the following so far: echo `cmd` >> stdin && tail -1 stdin For instance: henry@henry-pc:~$ echo "abc\n123" >> stdin && tail -1 stdin abc\n123
HennyH
  • 218
1
2 3 4 5