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

learn more… | top users | synonyms

0
votes
0answers
18 views

Script acting as textfile, possible? [duplicate]

A program I'm running has a -logFile option. The file I set as a logfile is filling up quite rapidly, and I only need about half of what's actually in it. Is it at all possible to: have a script ...
3
votes
2answers
68 views

Trace a binary stream from a device file

I'm debugging a binary stream that is coming from a device file. I would like to have the output printed out in real time as hex values. So far I've used tail -f /dev/ttyAPP2 | hexdump -C but after ...
0
votes
1answer
17 views

Possible to prevent multitail from closing “finished” command windows?

Assume a multitail call like the following: multitail -s 2 -l "long-running-command" -l "short-running-command" Now, I would like to have both windows remain open, even after they are finished. ...
0
votes
1answer
28 views

live tail (tail -f) of file being grepped

i can do tail -f -n20 <file> to see the last 20 lines of the file, live. If i want to grep something, tail -f <file> | grep <pattern>, it will still be live, but will only grep ...
0
votes
4answers
60 views

How to use tail for multiple files [closed]

I have multiple files. I need to use tail to remove some lines. How can I get the files after using the tail command? I am having problems redirecting the files.
5
votes
2answers
181 views

Command to remove the first N number of lines in input

Background I am running an SSH server and have this user that I want to delete. I cannot delete this user because he is currently running a few processes that I need to kill first. This is the ...
2
votes
2answers
58 views

“cut” hangs when using “tail -f” in combination with “tr”

I'm try to pipe chat log files to some speech output, and want to remove timestamps with cut and remove special characters with tr. Unfortunately, cut seems to halt when using it with tail -f in ...
0
votes
1answer
25 views

Head and Tail of a directory, set by the user

I have this script that will show the user the head or tail of the files that are inside a set directory (currently that is set as '~/bin/new/*'). This script works but i would like to allow the user ...
-5
votes
1answer
521 views

Head and tail command

How can i do this exercise in unix? Create the following command: lshead.bash – list the first few lines of every file in a directory specified by the argument. This command should also allow options ...
1
vote
1answer
21 views

Replicating growing log files in a near real-time manner over the network

I have a server with a bunch of processes writing log files as they run. I need to enable a client host to get a replica of the server-side log files in a near real-time manner. Is there a better way ...
1
vote
1answer
56 views

tail: illegal option — -53\r error while using head and tail on same file in single script

I am using a=`head -1 Rt.in` to get first value from my file and I am saving it as a variable then I am using same variable to tail -$a to tail last lines from my input. But it is giving an ...
1
vote
5answers
59 views

exit tail when other process is done

I have parallel --j 2 -- "sh script1" "sh script2" where script1 and script2 log in files log1 and log2 I would like to change this to: parallel --j 3 -- "sh script1" "sh script2" "tail -f log1 ...
4
votes
1answer
66 views

Is this tail behavior in Grouping Commands specified by POSIX?

Using tail combined with other standard tools in Grouping Commands can make some powerful constructions. For example, to get the first and last line of a file: $ seq 10 > file $ { head -n1; tail ...
0
votes
1answer
49 views

How to tail -f against a file which is rolled every 500MB / daily?

I would like to do the following to monitor for a pattern in a log file: tail -f ./app.log | grep "My Pattern: .*" >> ./MyPattern.txt & This is working fine until the app.log reaches ...
1
vote
2answers
241 views

How can I print the second to last line of many files into one file? [duplicate]

I have many CSV files in one directory which have various lengths. I'd like to put the second to last line of each file into one file. I tried something like tail -2 * | head -1 > file.txt, then ...
4
votes
2answers
29 views

Interactive, tabbed live tail of multiple files?

I'm often tailing multiple files, and even with a terminal multiplexer (ie tmux or screen) it's still annoying to have multiple windows/shell sessions dedicated to watching multiple files. Is there ...
0
votes
2answers
58 views

Monitor a logfile and execute different commands depending on different conditions

I have a logfile which I want to monitor and depending on which condition is met, different commands should be executed. I found a solution that comes close to this here. Unfortunately it doesn't ...
4
votes
2answers
639 views

How to tail a log file by time?

Say my log file(log.txt) is something like 2014-01-01 22:30:30 something happened.... 2014-01-01 22:30:31 something happened.... 2014-01-01 22:30:41 something happened.... I want to tail this file ...
1
vote
1answer
57 views

What is the reverse of tail -c +K?

I was reading this thread. The command tail -c +K /tmp/1 outputs bytes starting with the Kth of each file. From man tail -c, --bytes=K output the last K bytes; alternatively, use -c ...
2
votes
3answers
352 views

View only the new entries in a growing log file

tail -f x.log I use this command to see a growing log file in the command prompt. I am interested only in seeing the log lines that are written to the file after running tail -f and not interested ...
1
vote
1answer
61 views

Can someone explain this tail + line to me?

I'm looking through some of the scripts that are on the servers and came across an 80MB shell script. Naturally curious I decided to look in there and came across this line: tail +4802 $0 | zcat - | ...
0
votes
1answer
88 views

Clear terminal window before tail -f output

I have the following script running every 3 minutes with cron: #!/bin/bash cd ~/Documents/Fetch/ wget remotehost/data.txt --output-document=tmp cp tmp data.txt rm tmp To fetch a self-generated php ...
3
votes
2answers
138 views

Check if conditional with awk for matches in logfile

I want to check the auth.log file for accepted sshd connections and execute an action if any are found. Here is my code: tail -f /var/log/auth.log | awk '{ if($0 ~ /sshd/ && $0 ~ /Accepted/) ...
1
vote
1answer
59 views

tail -f error_log | cowsay

I'm watching the error logs on my local setup. I'd like to have the errors print out in cowsay, you know, for fun. tail -f error_log | cowsay doesn't work. Any ideas?
4
votes
3answers
443 views

Redirect the tail output to a file then stop when match found

there is this log file that data coming in is continuous. what i wanted to happen is to tail -f this log file then redirect it to a file with the ff conditions example of the log files content ...
6
votes
1answer
682 views

Does less have a feature like tail --follow=name (-F)

The command less can be used to replace tail in tail -f file to provide features like handling binary output and navigating the scrollback: less +F file The + prefix means "pretend I type that ...
4
votes
4answers
441 views

Prevent tail from modifying the charset of the terminal

In a Linux terminal (CentOS) I am using the command tail --follow=name my-rolling-file.log in order to see the logs of my application. Sometimes in the log there is some binary data dumped (I dump ...
4
votes
4answers
1k views

Show filename at begining of each line when tailing multiple files at once?

when tailing multiple files at once as shown below, is any there any way to show the file name at the start of each line? tail -f one.log two.log current output ==> one.log <== contents of ...
1
vote
1answer
81 views

“tail -f” in GNOME Terminal - scrolling to previous lines breaks if there's been lots of subsequent output

I'm viewing a log file with "tail -f" using GNOME Terminal. The log has a lot of input constantly coming into it, and what I find happens is that I scroll up to a previous section, and I'm reading ...
7
votes
1answer
538 views

Is `tail -f` more efficient than `less +F`?

This article pointed out some reasons to use less +F over tail -f. Most of the reasons are about the features, not technical reasons: less +F can highlight, search, navigate through file. How about ...
2
votes
2answers
114 views

Print file contents and delete the printed content* from the file

In Linux, from a bash shell, how can I print the contents of a file and remove the content I just printed content from the file? I have a program writing texts to a file repeatedly. On a Linux shell ...
2
votes
1answer
79 views

Is it possible to tail -f output to a single line?

less has an option -S or --chop-lines which prevents lines from wrapping and shows output as one line (often extended beyond screen). Is it possible to do this with tail -f? The tail man page ...
2
votes
3answers
271 views

Keep a tally from a log file

I have a file called output.log which has this content: Thread started Thread finished Thread started Thread finished Thread started Thread started I monitor its output using: tail -f output.log ...
0
votes
2answers
132 views

Will “tail -100 | sed -n 1p” only read one line?

I'm searching backwards from the end of a file, it's probably easiest to explain by showing my code: enough=0 numberOfLines=100 fileName="/path/to.file" # Tail the last $numberOfLines lines; if the ...
0
votes
0answers
26 views

how can I redirect the grepped output of tail -f to a file? [duplicate]

I want to do this: tail -f /var/log/apache2/access.log | grep 'POST \/review' But I want the output to go to a file and I want this to run constantly for a day or two. I tried a simple script ...
0
votes
1answer
97 views

tail-ing a filename that is a date [duplicate]

I am creating a logfile from kermit named the current date (which is in the format of DD MMM YYYY - which can not be changed AFAIK), and using the file name as today's date. I then have a Bash script ...
4
votes
5answers
2k views

Using head and tail to grab different sets of lines and saving into same file

So this is for homework, but I will not be asking the specific homework question. I need to use head and tail to grab different sets of line from one file. So like lines 6-11 and lines 19-24 and ...
0
votes
1answer
61 views

Use tail and grep to send an IRC message?

How do I use a command like: tail -f /home/user/log.txt | grep '!calladmin\|admin' To send an IRC message to me when !calladmin or admin are posted in the log? Or is there an easier way to do ...
-1
votes
1answer
90 views

Hash different, is it safe?

The first time I downloaded Tails image which is with different sha256sum than the webpage giving, so I downloaded it once again and this time it is correct. Then I unpakeged all the files inside the ...
0
votes
1answer
136 views

Pipe stdout to command on stdout

If I had a running process like tail -F watch.txt and I wanted to capture the stdout from this running process and pipe it to another command on stdout how could this be done? Here's an example of a ...
3
votes
2answers
342 views

Repeatedly execute bash command while there's no output from another process

I'm running fs_usage to detect access to an object on my filesystem. sudo fs_usage -w | grep -E 'object' I now want to run a touch command on that object every 5 seconds as long as there's no new ...
3
votes
2answers
345 views

Coloring tail output with perl

tail -f logfile.log | perl -pe 's/.*foo*/\e[1;41m$&\e[0m/g' will color all the lines containing the pattern "foo" in the logfile.log file. How can I make use of this in order to highlight ...
2
votes
2answers
40 views

Getting transient PID from log into a PS search before it dies

I have a transient prelink process populating our audit log, but we're not sure what the process is. The error log gives us the PID, but it disappears pretty much instantly, as the process finishes ...
5
votes
2answers
4k views

Negative arguments to head / tail

Variants of this question have certainly been asked several times in different places, but I am trying to remove the last M lines from a file without luck. The second most voted answer in this ...
6
votes
3answers
3k views

Suppress 'file truncated' messages when using tail

I'm tailing a log file using tail -f messages.log and this is part of the output: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eget tellus sit amet odio porttitor rhoncus. Donec ...
0
votes
0answers
58 views

Why does GNU head/tail read the whole file? [duplicate]

I have a huge file and want to see its beginning and end. However, when I use head and tail, it apparently tries to read the whole file. Since the file is larger than a terabyte, this takes a very ...
3
votes
1answer
1k views

splitting a CSV and keeping the header without intermediate files [closed]

I am trying to split a dozen 100MB+ csv files into managable smaller files for a curl post. I have managed to do it but with a lot of temporary files and IO. It's taking an eternity. I am hoping ...
3
votes
1answer
1k views

grep not working in a for loop over a list

I have some log files. And I have a list of user ids. My log files are in a particular format log-yyyy-mm-dd e.g. log-2014-09-30 I am trying to search each userId in the log file. This is what I am ...
4
votes
3answers
420 views

Time required to do pipe output to head/tail [duplicate]

There are lots of txt files in a directory. If I do time wc -l *.txt | head it takes real 0m0.032s user 0m0.020s sys 0m0.008s If I do time wc -l *.txt | tail it takes real 0m0.156s ...
9
votes
1answer
5k views

Tail log file on multiple machines over ssh

I'm trying to tail a log file on multiple remote machines and forward the output to my local workstation. I want connections to close when pressing Ctrl-C. At the moment I have the following function ...