Questions tagged [tail]

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

2
votes
1answer
94 views

Command modification

I'm using the following command to get the highest number of requests per second in a log file and it works well. grep "2017-02-22" "LogFile.log" | cut -c1-20 | uniq -c | sort -n | tail -n1 Now I ...
1
vote
1answer
248 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 this?...
1
vote
1answer
676 views

Get last changed content since last read

How can I get the last changed content of a file, since its last read? Something more precise that this: tail - <nr >file_1.txt >file_2.txt where file_2.txt gets the last modified content.
0
votes
1answer
254 views

tail: error writing 'standard output': Broken pipe

I tried to use some scripts which use tail commands on Debian stretch but I got tail: error writing 'standard output': Broken pipe. Does Debian handle tail and pipe syntax differently? Thank you in ...
0
votes
1answer
706 views

tail not working on mac terminal

Due to my lack of experience with script language, (shame for a Mac user) I have referred to several sources: link seemed resolved with ls *.extension | xargs -n 1 tail -n +2 This didn't for me, ...
0
votes
1answer
43 views

Too many emails sent when sending emails when specific URL has been visited in Apache Logs

In this question, a solution was found to automatically send an email each time a specific URL is visited (such as ?src=foo), as seen in the Apache logs: tail -F -n0 /var/log/apache2/...
0
votes
1answer
44 views

Create a listing of every user which owns a file in a given directory as well as how many files and directories they own

I am having trouble understanding the code : ls -l /projects/ghosttrail | tail -n +2 | sed 's/\s\s*/ /g' | cut -d ' ' -f 3 | sort | uniq -c. Can anybody give me a detailed explanation of what is ...
0
votes
1answer
408 views

Showing color in log output using tail command when using Cygwin?

I have a debian install that runs an application server. I ssh into this debian install from a Windows computer using cygwin and with the application server running I use tail -f to monitor the log ...
0
votes
1answer
625 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
1answer
195 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 ...
0
votes
1answer
213 views

Need to grep for specific lines from ongoing log and save it in some file

There is just one log, which will have info on certain devices, that i am upgrading. I use "tailf log" to monitor the log. Now, say, I am upgrading 10 devices, the log will go on populating lines ...
-7
votes
1answer
6k 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 ...
4
votes
0answers
45 views

Tailing file using less +F/shift-F, turn off line buffering?

When using tail -f, it prints each character as it is written to the file, but less +F won't print until it sees a linefeed. And if the data being written to the file does not contain linefeeds, must ...
1
vote
0answers
40 views

tail reopen file when directory changes

I've got a symlink pointing to the "latest" directory, and I want to tail a file in the latest directory, even if the symlink changes to a newly created directory. I often use tail -F for files and ...
1
vote
0answers
289 views

How to tail and grep log file, combine into a single line and pass as argument to another command

Using the following command, I managed to fetch error messages below (it's 3 lines). $ tail -f -n 0 error.log | grep -A2 --line-buffered "Internal server error" ! @79884flo2 - Internal server ...
1
vote
0answers
67 views

Following a Virtual File?

I'm writing a kernel module to collect some data and printing it out to a file in /sys. I know these files are virtual files, and my understanding is that they are essentially generated every time you ...
0
votes
0answers
21 views

Monitor Apache Selectively

I am working to parse apache logs in Common Format in realtime so that I monitor them while I work. "tail -F /var/log/apache2/access.log" works but provides more than I need. "awk '{print $1 " " $2 " "...
0
votes
0answers
229 views

How to write Docker logs to a file in real time (à la `tail -f`)

I docker that output logs stdout stderr, which can be viewed using: docker logs -f $LOGS_CONTAINER_ID I also added 'sed', which puts the container id on each line: docker logs -f $LOGS_CONTAINER_ID ...
0
votes
0answers
135 views

What is the fastest command to trim the header of a csv file?

I need to trim the header in a csv file. I have used tail -n +2 ... which works fine but it is really slow (I have lots of 100M files), and I don't understand why since no memory is needed from tail ...