Questions tagged [tail]
Unix command to view the end of a file
137
questions
225
votes
4
answers
56k
views
Using watch with pipes
I'd like to run this command:
watch -n 1 tail -n 200 log/site_dev.log | grep Doctrine
But it does not run, because "I think" that the grep tries to run on the watch instead of the tail...
Is there ...
197
votes
14
answers
210k
views
Is it possible to `tail -f` the output of `dmesg`?
I want to do something like
dmesg | tail -f
but it doesn't work:
I use Mac OS X v10.6.7 (Snow Leopard). By doing that, tail will exit, instead of monitoring the output.
I wonder if there is a ...
86
votes
22
answers
150k
views
Monitoring a file until a string is found
I am using tail -f to monitor a log file that is being actively written to. When a certain string is written to the log file, I want to quit the monitoring, and continue with the rest of my script.
...
86
votes
6
answers
84k
views
Opposite of tail: all lines except the last n lines
How can I discard the last n lines of a file with a unix command line filter?
That would be sort of the opposite of tail: tail discards the first n lines but pipes the rest through, but I want the ...
62
votes
6
answers
10k
views
Alternative for "tail -f" that follows filename
I have some logs being generated using a timed rotating file logger. This logs to a file called tool.log, and at midnight, moves this to tool.log.<date> and starts a new tool.log.
I have a tail ...
36
votes
3
answers
19k
views
make tail wait for a file to exist
tail -f bar/somefile.log would fail immediately when somefile.log does not exist. How do I make tail indefinitely wait for that file to be created (which will happen in a few moments)?
Update: using -...
32
votes
1
answer
58k
views
Combine tail -f with grep?
Hi I wanna keep looking at a log file, but I also don't wanna see irrelevant stuff, I'm only interested in anything with "foobar" in it.
So if I was tailing the file I would do
tail file | grep "...
26
votes
3
answers
12k
views
tail -f not tracking file changes
I was recently looking into using tail -f to monitor some text files like so: tail -f /var/sometext.
However, when I did some testing, it doesn't seem to work. What I did was I created a new file ...
24
votes
4
answers
19k
views
Using 'head' or 'tail' on HUGE text file - 19 GB
I have a problem with viewing chunks of a very large text file. This file, approximately 19 GB, is obviously too big to view by any traditional means.
I have tried head 1 and tail 1 (head -n 1 ...
23
votes
2
answers
29k
views
tail/head all line except X last/first Lines
for example i have this file :
cat myfile
1
2
3
4
5
i want to print all lines except first 2 line . output should be like this :
tail -n $(( $(wc -l myfile | awk '{print $1}') - 2 )) myfile
3
4
5
...
22
votes
9
answers
22k
views
Windows XP equivalent of "tail -f"?
Is there way have windows XP show me updates to a log file as they happen? I'm thinking of something similar to tail -f <file path> in the linux realm.
19
votes
4
answers
3k
views
Linux command line log viewer which allows auto tail AND searching?
I use tail -f in my Linux shell, to view log files, as I like how it auto-updates with the incoming text: I like to see the new stuff come scrolling in.
However, I also like the search functionality ...
19
votes
4
answers
13k
views
appending timestamp to tail -f results
I would like to have a timestamp printed in front of every line that comes out of a "tail -f outputfile", so that I know when is each line printed in. Something like:
[...]
20110617_070222:results ...
14
votes
2
answers
12k
views
Equivalent of 'clear' command when using tail -f
I am using the tail -f command to follow an error log, and I often want to "clear" the terminal, much in the same way that the clear unix command moves everything above the top of the window. Is there ...
12
votes
3
answers
2k
views
Stop scrolling to the bottom automatically in PuTTY
I am using tail -f to monitor a file via PuTTY. But each time new content arrives then it automatically scrolls to the bottom and so I can't read the text.
Is there a way to make it stop that ...
7
votes
2
answers
3k
views
Is there a tail -f equivalent for ls?
Basically the question is in the title. I want to monitor a directory for new files that are written or deleted, the way I can monitor a log file with tail -f. Is this possible?
7
votes
2
answers
3k
views
Why isn't `tail -f … | grep -q …` quitting when it finds a match?
I'm doing a pretty standard tail + grep:
tail -f some_log_file.txt | grep -q known-string
If I run the command without the -q:
tail -f some_log_file.txt | grep known-string
I see output:
[Tue Feb ...
7
votes
3
answers
8k
views
multitail for Windows cmd/powershell? [closed]
Is there a program like multitail but for Windows cmd.exe or powershell (not GUI)?
6
votes
4
answers
3k
views
Is there anyway to `cat` two remote `tail -f` streams via SSH?
I wanted to combine two continuous text streams generated by tail -f into one and watch them in the same screen. Is it possible? Both text streams are line-oriented (e.g. logs), if that helps.
...
6
votes
5
answers
26k
views
tail -v a file while excluding a list of words
I'd like to tail a log file that's continuously being written to but would like to exclude various entries that are 'common' so I only see errors, etc. as they are thrown. I can pipe to grep -v "...
6
votes
2
answers
3k
views
Tail -f on newly-created files with unknown names
I have a program that for each run generates a new log file. To watch what's going on, I'd like to tail -f the log - only problem is that I don't actually know the file name in advance.
So, is there ...
6
votes
1
answer
4k
views
tail a file without wrapping the lines on a mac
I want to tail -f a file that may contain very long lines. I would also like to see one line per screen line and scroll to the side if necessary, much like Vim's zL and zH, so no line wrapping,
Is ...
6
votes
1
answer
1k
views
tail -f file stops tailing on rename
I want to tail -f file but going tailing it after a mv.
The tail manpage tells me: -f means --follow=descriptor so a mv should not change the inode?
Why does tail -f stop working after the rename?
6
votes
2
answers
3k
views
Filter tail command through multiple grep commands to separate files
What I am trying to do is filter the output of one log file into separated log files based on a grep filter.
tail -f test.log | tee >(grep "Error" > error.log) >(grep "Warning"" >
warning.log)
...
6
votes
1
answer
2k
views
Monitoring log files over smb
I am monitoring a couple of windows 2k3 servers from a mac running Os x Lion. I use smb to connect to the server's file system, navigate to the folder where the log files are and open them with ...
5
votes
2
answers
6k
views
How can I have ls follow the content of a directory like tail -f does on a file
I want to basically continuously update the file list of a directory similar to how tail does with the -f flag on a file.
is there any reasonable way to do this?
5
votes
1
answer
6k
views
How to easily break up a text file into pieces smaller than a threshold?
I have some text files that are 100 to 300 MB in length that I want to view in Emacs, but my Emacs gets into some performance issues opening and traversing such large files. Therefore, I'm looking ...
5
votes
1
answer
2k
views
How do I tail a block device in Linux?
I am trying to get just the last 1024 bytes of /dev/sda2. When I do sudo tail -c 1024 /dev/sda2 | hd, the prompt just hangs until I hit Ctrl-C. However, when I tail -c 1024 ddfilecopyofsda2 | hd, I ...
5
votes
3
answers
3k
views
Tail multiple files while piping one of the files through grep
I want to use tail follow two log files, but one of the log files has too much data, so I want it filtered with grep.
tail -f file1 file2|grep mySearch
The issue with this is that both files are run ...
5
votes
1
answer
3k
views
Unix /Linux show the last part of a file with line numbers
Is there a way to make tail show a line number in front of the last lines it show so that it show the growth of the file when using it in a script.
e.g: when using it in a script like this one:
...
4
votes
3
answers
5k
views
Coloured output when tailing php error log
I'm trying to find a way (through escape characters or software) to display coloured lines in my php error log.
Right now I'm reading from them (live) with
tail -n 50 -f /var/log/apache2/error.log
...
4
votes
2
answers
3k
views
tail stops working
I am tailing a file in unix. It stops working sometimes and I have to re-run the command. Anyone know why this happens?
4
votes
2
answers
1k
views
How can I tail a file and capture the output for one minute?
I am tailing a log file. How can I capture the output for one minute?
4
votes
1
answer
23k
views
Combining find grep and tail
I am trying to find all files that start with a certain name, then go through each file to find lines that contains a string, then only print out the last line of each file that contain the string. ...
4
votes
5
answers
3k
views
Linux application to tail multiple log files (like OS X Console.app)
I'm constantly tailing log files. At any given time I've got half a dozen terminal windows open that are simply running tail -f .
In OS X, the Console app is brilliant. All the usual log files are ...
4
votes
1
answer
4k
views
Other ways to increase max open files?
I have an application which keeps giving me the following error.
tail: inotify cannot be used, reverting to polling: Too many open files
I have already followed all the advice I've been able to find ...
3
votes
3
answers
2k
views
How to grab a random section in the middle of a huge file?
I have a huge log file of around 3.5 GB and would like to sample random sections in the middle of say 10 MB for the purpose of debugging what my application is doing.
I could use head or tail ...
3
votes
1
answer
22k
views
Extract the contents of ELF and write to binary file
I have been trying to extract the contents of a firmware and putting it to a binary file, but with no success.
I see the right hex contents, but am not sure how to laid them in bits into a file.
...
3
votes
1
answer
8k
views
How to pipe output of tail -F on OS X?
I've recently moved from Ubuntu to OS X and I'm finding that the 'tail' command behaves differently.
On Ubuntu I could run
tail -f xyzzy.log | espeak
(To have the computer read me what's happening ...
3
votes
1
answer
642
views
Why tail -f is not working for a proc file?
I have a proc file which is updated by a driver. In user space I am reading using tail. It is working fine, But when i give -f option for tail, It is not working. This means it is reading file ...
3
votes
3
answers
1k
views
tail from a specific starting word
I'm trying to get the last lines of a text file starting with the word 'cold'. I don't know which line the first occurrence of the word will be but I want it and every line after it to print. I've ...
3
votes
1
answer
2k
views
quick tail on a huge file on linux
I need to get the last 10 million lines of a 100 million lines file.
tail -n 10000000 $in_file>$out_file
however the above command took more than 1 day and is still going.
I guess I can use the nice ...
3
votes
1
answer
1k
views
How to "tail" multiple pipe files or streams?
I need to monitor a lot of web servers for runtime errors and I have an idea of running a script like
#!/bin/bash -e
# Example set of hosts
HOSTS=(
host1
host2
)
for host in ${HOSTS[@]}
do
[...
3
votes
3
answers
99
views
Discard content of logfile, keeping tail
I'm looking for a way how to discard content of the logfile, leaving only defined tail. In two steps it's quite easy:
tail -n1000 alert_migtst.log > alert_migtst.tail
mv -f alert_migtst.tail ...
3
votes
1
answer
3k
views
How to display/monitor the tail of a growing CSV file in tabular format?
I am looking for a way to display an open, "live" CSV file under Windows 7. For example, I have a proprietary program running that is generating log data in CSV format. I'd like to keep an eye on what ...
3
votes
1
answer
2k
views
How to monitor files matching a wildcard with multitail
I have a 'logs' directory full of log files whose names follow this format:
XXX-YYYY-DATE-N.txt
where N is a number that grows bigger as time goes on.
So for example right now I have:
xxx-yyy-...
3
votes
1
answer
1k
views
Tailing multiple files with less
I want to have the best of both worlds with tail and less.
Following multiple files, like tail can, but also having the scrollable buffer of less.
So, I tried:
tail -f mylog1 mylog2 | less +F
But ...
3
votes
0
answers
2k
views
How do I tail Windows 10 Update Log
I have a following batch file that runs on startup
wuauclt.exe /detectnow /updatenow
start /min C:\Windows\WindowsUpdate.log
But now in Windows 10 log file simply has the following
Windows Update ...
3
votes
0
answers
383
views
Log tailing over SMB much slower under Samba 4 vs Samba 3
I just upgraded my internal development VM running Ubuntu 11.10 with Samba 3.6 to Ubuntu 15.04 with Samba 4.1 (fresh install, new VM). Everything is working great, with the exception that my log ...
3
votes
2
answers
2k
views
GUI for tail for Linux
Could someone recommend a graphical tail kind of document viewer? So that I could open a document, scroll up and down, etc. and that the document would refresh itself automatically (without prompting, ...