Watching updates at the end of a file, with or without the tail utility

learn more… | top users | synonyms

9
votes
1answer
290 views

How to do `head` and `tail` on null-delimited input in bash?

find command can output names of files as a null-delimited strings (if -print0 is provided), and xargs can consume them with -0 option turned on. But in between, it's hard to manipulate that ...
0
votes
1answer
110 views

Tailing a New File with an Old Name [duplicate]

This is along the lines of How to start tailing a file that has not been yet created with a twist: a file with the name already exists. I have a program that is run multiple times; when the output ...
4
votes
0answers
76 views

Combing head and tail in a single call via pipe [duplicate]

On a regular basis, I am piping the output of some program to either head or tail. Now, suppose that I want to see the first AND last 10 lines of piped output, such that I could do something like ...
0
votes
3answers
401 views

Using tail command to create a file

This is what I did using tail command. When I try to output the file to screen the file is empty. ~]$ tail > AFS2F1 PASSES ALL DATA FROM INPUT TO OUTPUT PASSES ONLY SPECIFIED COLUMNS PASSES NUMBER ...
2
votes
2answers
556 views

Tail -f piped through grep not outputing to file, but outputs to console

I'm using the following command tail -f /mydir/myfile | grep "searchterm" >> outfile Without the -f it works fine, but with the -f, which I need, nothing is written to the file. The ...
11
votes
4answers
858 views

How to do a continous 'wc -l' with gnu texttools?

I know of course that cat logfile.txt | wc -l 120 will tell me the number of lines in a file. Whereas tail -f logfile.txt will show me the new lines that another program writes to logfile.txt. ...
3
votes
2answers
2k views

How to use tail -f with grep to show surrounding lines

I would like to see the output in a logfile greped by only one domain but also the following two lines. Example: tail -f /var/log/apache2/modsec_audit.log |grep mydomain.de this shows all lines, ...
2
votes
1answer
154 views

Does multitail follow the inode or the file name by default?

For logrotated files one usually uses tail -F instead of tail -f to follow the log file contents. Does multitail(1) automatically follow the name instead of the inode (which likely changes with the ...
1
vote
3answers
235 views

How to view output for ALL processes simultaneously?

I know that you can connect to various background processes to watch their console output, but is there a way to view the output of all processes at once? Likely it would scroll quickly and be hard to ...
4
votes
1answer
901 views

Observe multiple log files in one output

Is there an easy way to do something like tail -f mylogfile but to have the changes of more than one file displayed (maybe with the file name added as prefix to each line)? Or maybe a GUI tool? I am ...
2
votes
3answers
1k views

How do I tail a log file and keep tailing it when the latest one changes date?

I'm using RHEL 4. The normal tail -F file_name*.log doesn't update when the time flips over to 0000. Here's what I've tried so far from searching the web, both of which try to use nested tail: ...
0
votes
3answers
313 views

Graphical logviewer that auto reload when file changes?

I'm wondering if there's a graphical viewer, also it needs to support auto-reloading when log file has changed. ksystemlog doesn't reload automatically.
1
vote
1answer
703 views

How to tail/grep/awk the last N bytes of a file, rather than lines

I have an application that is logging to a plain text log file (myapp.log) but it doesn't seem to be writing new line characters at the end of each log entry. If I execute a command like tail -n 50 ...
0
votes
2answers
763 views

$(tail) into variable removing \n

I am doing the following: x="Hello to the world of tomorrow\n <pre>"; x="${x}$(tail -n 50 log/logfile.log)" x="${x}</pre>"; echo -e $x | ./perlscript The Perl script: #!perl # ...
17
votes
8answers
11k views

Command to display first few and last few lines of a file

I have a file with many rows, and each row has a timestamp at the starting, like [Thread-3] (21/09/12 06:17:38:672) logged message from code..... So, I frequently check 2 things from this log file. ...
3
votes
1answer
335 views

limit stdout to terminal output speed [duplicate]

Possible Duplicate: How can I limit the output speed of stdout? What's the easiest way to limit the speed at which stdout is output in a terminal, so that, for instance, tail -f outputs ...
4
votes
3answers
973 views

How can I do the equivalent of tail -f with ls? [duplicate]

Possible Duplicate: Is it possible to follow a command (run repeatedly)? as one would follow a file using tail -f? I would like to monitor files that are being downloaded to a directory in ...
20
votes
4answers
24k views

cat line X to line Y on a huge file

Say I have a huge text file (>2GB) and I just want to cat the lines X to Y (e.g. 57890000 to 57890010). From what I understand I can do this by piping head into tail or viceversa, i.e. head -A ...
1
vote
1answer
2k views

Flush 'tail -f' buffer?

I'm using the following statement (simplified version): tail -f -c+1 <filename> in order to pipe a file to a process. What I've found, though, is that there is a number of lines at the end ...
16
votes
3answers
4k views

Piping from grep to awk not working

I am trying to grep the ongoing tail of file log and get the nth word from a line. Example file: $ cat > test.txt <<EOL Beam goes blah John goes hey Beam goes what? John goes forget it Beam ...
5
votes
4answers
2k views

`tail -f` until text is seen

I've got a CI server with a command-line interface that allows me to remotely kick-off a job (jenkins CI server and the jenkins-cli.jar tool). After I kick the job off I tail -f the log (sorry for ...
4
votes
4answers
2k views

Output file contents while they change

I want to output a file's contents while they change, for example if I have the file foobar and I do: magic_command foobar The current terminal should display the file's contents and wait until, I ...
9
votes
1answer
931 views

How to have tail -f show colored output with vim?

In this question, Gilles answered Yet another possibility is to run tail -f in an Emacs shell buffer and use Emacs's syntax coloring abilities. Because I'm a vim user, I'd like to do this with ...
1
vote
2answers
626 views

Is there any other way to use tail -f for grep -q && operation?

I found this solution: http://stackoverflow.com/questions/7178888/grep-q-not-exiting-with-tail-f but is there any other possible? UPD: I want to do tail -f | grep -q something && echo ...
12
votes
3answers
2k views

monitor files (ala tail -f) in an entire directory (even new ones)

I normally watch many logs in a directory doing tail -f directory/*. The problem is that a new log is created after that, it will not show in the screen (because * was expanded already). Is there a ...
7
votes
4answers
737 views

What is the easiest way to execute text from tail at the command line?

Sometimes I'm working on a new (ubuntu) box and I type git and am alerted: The program 'git' is currently not installed. You can install it by typing: apt-get install git-core If that happens I ...
10
votes
2answers
938 views

“tail -f | iconv -fsjis” does not output anything

I want to tail -f a file, but its content is in sjis encoding, so I need to have it converted to the native (utf-8) encoding of my terminal. When I do tail -f x | iconv -fsjis there will be no ...
3
votes
1answer
145 views

Why does tailing an output log sometimes give partial lines?

Sometimes, tailing an output log which is constantly being updated doesn't give the whole lines. Why is that? grep pattern input_file > output.log & tail output.log Why doesn't it print the ...
9
votes
2answers
205 views

How to start tailing a file that has not been yet created

I use tail to monitor the progress of jobs that I know will write their progress to disk. Almost always, I know which file they will create before they start running (the jobs are dispatched by a ...
15
votes
4answers
9k views

How to monitor only the last n lines of a log file?

I have a growing log file for which I want to display only the last 15 lines. Here is what I know I can do: tail -n 15 -F mylogfile.txt As the log file is filled, tail appends the last lines to the ...
4
votes
2answers
747 views

Moving average on a log file with awk or other unix utilities?

Scenario: I have a log file that has a few number of entry "classes", like this: R0 dx=0.00500 rb=0.00000 sn=1 3145.88 2.59 0.08 se=21315 id=16190 R0 dx=0.00300 rb=-1.00000 sn=1 3150.40 2.38 0.05 ...
3
votes
3answers
419 views

How to make dot matrix printer print every line of 'tail -f'

I have a dot matrix printer, an Epson LQ-500. It works well with CUPS, and I use it to print listings sometimes, text files, etc. now, I'd like to use it as a logging printer. for that, I need it to ...
6
votes
3answers
2k views

Follow a pipe using less?

Can less follow (by pressing F) a piped input (similarly to a file)? For a file that is being written to, the command less <file> will follow the file when pressing F. But if I have a ...
3
votes
2answers
88 views

Output the changes to a log file

If I use tail -f *filename* I get a real nice display of whatever is changing in a given file. However, sometimes I want to be able to search this text or otherwise look it over slowly. Is ...
1
vote
3answers
354 views

Is there a way to beep when tail -F stops to fetch new results?

A few days ago I asked Is there a way to make tail -F beep? Now I want to know if there is any way to use *nix utilities, to beep when a tail -F stops returning new lines for a while! I know, I ...
2
votes
2answers
2k views

How to execute this particular shell command from Python?

OK, so, I have this non-functional shell script, which I am rewriting piece by piece in python, except I am getting an "unexpected "|" error" from the shell (see below): #/bin/sh LINES=`cat $@ | wc ...
4
votes
1answer
2k views

How to follow (a la “tail -f”) a binary file from the beginning?

Is it possible to follow a binary file from the beginning, a la tail -f? This is useful in some cases, for example if I'm scping a file to a remote server, and at the same time I want to feed it to ...
17
votes
6answers
2k views

Is there a way to make tail -F beep?

Is there a way to make tail -F or less beep (ring the bell in a terminal) when new data comes in (a new line is added to the file). Or is there any other unix utility to do this on a linux or mac.
1
vote
1answer
62 views

Can I use tail with a file both as input and destination?

I have a log file that gets big fast. I tried using tail with this syntax but it didn't work. tail logfile.log -n 100000 > logfile.log The output file is 0 bytes and blank. What am I doing ...
2
votes
4answers
2k views

How to limit the number of lines a command's output has available in bash?

I started downloading a big file in the background using $ nohup wget http://example.tld/big.iso & which also gives me a nohup.out file that includes the output of wget. Now, if I later want ...
28
votes
1answer
4k views

How to do a `tail -f` of log rotated files?

On a long running system I usually have a terminal with $ tail -f /var/log/kern.log or something like this open. But from time to time I have to restart such command because no new messages are ...
1
vote
0answers
110 views

Pretty tail -f for log files [duplicate]

Possible Duplicate: How to have tail -f show colored output Is there a bash/awk script or utility that pretty formats and colors tail -f from log files? At the moment I am specifically ...
2
votes
3answers
1k views

Is it fine to use tail -f on large log files

I would like monitor a large log file (close to 1 GB) for errors. I want this to be close to real time (few seconds delay is fine). My plan is to use tail -f | grep. Is there any performance issues ...
22
votes
5answers
6k views

How to obtain inverse behavior for `tail` and `head`?

Is there a way to head/tail a document and get the reverse output; because you don't know how many lines there are in a document? I.e. I just want to get everything but the first 2 lines of foo.txt ...
19
votes
3answers
9k views

How does the “tail” command's “-f” parameter work?

$ tail -f testfile the command is supposed to show the latest entries in the specified file, in real-time right? But that's not happening. Please correct me, if what I intend it to do is wrong... I ...
2
votes
2answers
3k views

Add carriage return to output of `tail` while using `grep`

I'm looking to refactor the following command: tail -f production.log | grep -e "Processing " -e "compatible;" -e "Completed in " -e This is the output of the command: Processing ...
5
votes
2answers
451 views

Is it possible to follow a command (run repeatedly)? as one would follow a file using tail -f?

I have a script which produces a file 'Detail.out'. I know that the script is completed whenever the file contains a certain number of lines (roughly 21025). So I find myself sitting at the command ...
4
votes
1answer
172 views

What's a convenient way of checking what's being added to a log file in realtime?

Right now I'm essentially executing tail /var/log/syslog manually every once in a while. Is there something that lets me see what's being added continuously, or do I need to write something myself?
12
votes
6answers
4k views

Best way to follow a log and execute a command when some text appears in the log

I have a server log that outputs a specific line of text into its log file when the server is up. I want to execute a command once the server is up, and hence do something like the following: tail -f ...
7
votes
2answers
3k views

Reading from a continuously changing logfile [duplicate]

There is /location/of/thefile, which is a continuously changing logfile. The average density of refreshes is 4 per minute, the possible maximal refresh rate could be 30-40 per minute. Every refresh ...