Questions tagged [tail]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
130 views

Tail-ing /sys/devices/platform/applesmc.768/light not working

Once upon a time, I cast this shellspell, # tail -f /sys/devices/platform/applesmc.768/light and it does produce, (0,0) Those file I read is light sensor abstraction file of Macbook Pro. ...
2
votes
1answer
159 views

Tail changing files

I'm trying to append file by watching data that constantly adding every second and pipe data to new files that will process it later. using tail -f 'data file' >> 'destination file' But some ...
2
votes
3answers
5k views

Is it possible to change tail's default line count?

When I use tail file, tail by default prints the last 10 lines. Is it possible to change that default in the system level?
1
vote
1answer
2k views

Can a 8GB USB drive run Linux? If yes, which type? [closed]

I have two USB drive and both are 8GB. But one is USB 3.0 with writing speed: 7.93mb/s and reading speed: 87.642mb/s, another is unknown (maybe 2.0) with writing speed: 6.764mb/s and reading speed: 16....
7
votes
2answers
3k views

Reading a named pipe: tail or cat?

I made a file descriptor using mkfifo fifo As soon as something is written to this pipe, I want to reuse it immediately. Should I use tail -f fifo or while true; do cat fifo; done ? They seem ...
0
votes
1answer
49 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
66 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 ...
25
votes
6answers
34k views

How to quit `tail -f` mode without using `Ctrl+c`?

When I do tail -f filename, how to quit the mode without use Ctrl+c to kill the process? What I want is a normal way to quit, like q in top. I am just curious about the question, because I feel ...
2
votes
1answer
4k views

Why does head; tail on a large file sometimes take a long time and sometimes not?

I am writing a bash script that reads the first 10 lines and the last 10 lines of a .txt file. It looks for started (head) and completed (tail) and compares the number of occurrences using grep. The ...
0
votes
3answers
94 views

How can I copy n lines after the last 2 occurences of a string in a file?

Is there a way to copy the first n (say 3) lines after the last 2 occurrences of a string are found in a file? When I was only interested in those after the last occurence, I used: grep -A4 '...
0
votes
3answers
1k views

grep dynamically multiple files with customized output

I want to monitor 2 different log files (at the time events appear in logs). tail -f /var/log/file1 -f /var/log/file2 For each file, I want to grep some patterns: tail -f /var/log/file1 | grep '\(...
17
votes
2answers
1k views

Editing text file with Vim does not update tail -f

I'm using tail -f a.txt to watch updates on a file called a.txt. If I update the file using something like ls -a >> a.txt in a second virtual console, the changes will display in real-time in ...
0
votes
1answer
2k views

Pipe data from TCP socket connection to terminal

I have this simple line writing JSON to a TCP server echo "{\"some\":\"json-data\"}" > /dev/tcp/localhost/9091 > cat I would have thought that some connection would be created, and the data ...
2
votes
2answers
730 views

Hot to write an EOF to a file, to stop any tailing processes

I have multiple processes tailing a file, how can I write an EOF to the file, to stop the tailing processes? for example, tail -F $HOME/somefile.log that is being run in some terminal somewhere, ...
5
votes
2answers
5k views

Send EOF to named pipe - cleaning up / drying up fifo

If I have some random processes reading from a named pipe: tail -f MYNAMEDPIPED cat MYNAMEDPIPE | someOtherProc Elsewhere, I have a handle on MYNAMEDPIPED by name. is there a safe and clean way to ...
1
vote
1answer
585 views

Why a combination of tail+grep+cut doesn't work? [duplicate]

I wanted to grep some logs, while tailing them, and print only a part of each line, since the lines are too long. I can't figure out why the combination I use doesn't work; the procedure follows: ...
0
votes
2answers
1k views

Monitor/follow CSV file changes/updates in a tabular view/format

I want to monitor/follow changes of a CSV file (some logging output of a robot). It is a huge file with <TAB> as delimiter and the first row with header information. So far, I am using the ...
1
vote
2answers
496 views

How to extract the number of physical processors and threads per core? (No text, only the number to use as input elsewhere)

I want to use the number of cores in a script and I am not sure what is the best approach to extract the number itself. For example, the below extracts the number of physical cores, however how ...
1
vote
0answers
91 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
171 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 ...
1
vote
2answers
730 views

Tail Grep - Print surrounding lines until pattern is matched

So here is my requirement. I am tailing a log file and grepping on it. I want to get some context on every grep result.. But the context should be "till a pattern is matched" and not the number of ...
0
votes
2answers
817 views

send email from multi-lined grep output

doesn't grab $ERROR and no email or killing the tail. what am i doing wrong? tail -F --max-unchanged-stats=5 somelogfile.log | grep -B4 "FATAL" | while read ERROR do echo $ERROR | mail -s 'FATAL ...
0
votes
2answers
287 views

Extract range of elements from ith element to jth element, up until nth element from a list

In a directory I have a certain number of files. This could be 53 txt-files, but I could also have 123 files. The files have various random names, but all have the file-handle .txt I can get a list ...
1
vote
2answers
7k views

Is there a way to 'tail -f' a folder? [duplicate]

I need a command that acts like tail -f (displays file changes in realtime), but it should display the new output for all files (even if the new file is created/added). I don't know what files will be ...
2
votes
4answers
3k views

Tail -f breaks when file truncated

I am using tail -f (in Terminal on Mac OS X el capitan) to view the live changes to my file (the results of pulling data from a database using a PERL script). However, sometimes, the Perl script will ...
2
votes
0answers
159 views

How to pipe tail -f to less +F? [duplicate]

I'm using a processing tool that reads a file and outputs a modified version of it. I have been working with it successfully like this: tail -15f log_file.log | log_colorizer But I would also like ...
2
votes
1answer
98 views

Search a bunch of gps files in a folder for final distance, output list of distances

I have a bunch of .tcx files (essentially a GPS device outputted XML file) in a folder. They follow the naming convention DATE_LOCATION_SPORT.tcx. Each file has a bunch of track-point nodes noting ...
1
vote
2answers
306 views

Redirecting GREP output to different text files depending on capture content

I have a logfile with 2 distinct events (among others) that I need to capture. Each event generates a separate, dedicated line in the logfile with this format: timestamp - PID - process - ...
0
votes
1answer
5k views

How to tail dmesg on CentOS 7

In a CentOS 7 server, I typed dmesg and noted the time stamp of the last entry. Next, I typed tail -f /var/log/dmesg in a DIFFERENT TERMINAL ON THE SAME MACHINE, so that I could watch the log tail. ...
0
votes
3answers
2k views

How can I append a command

I can't remember how to append a command to a shell script. I searched for append, add, concat, and more without success. Basically I have belly = tail -n +"$HEAD" "$1" | head -n $((TAIL-HEAD+1)) ...
0
votes
1answer
516 views

`tail -f` consumes last line partially, doesn't care about newlines or nul

I've got a temporary file (not a fifo/pipe) that needs to be watched by multiple reader scripts. Each script uses a background process to watch the temporary file, using this code: function ...
2
votes
1answer
106 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 ...
9
votes
2answers
552 views

Doing a tail -f on a text file over sshfs not working. Why?

I successfully mounted a local folder against a remote ssh host. I now wanted to do a tail -500f my_text_file but it's not working very well. Although it does open tail and shows me the file contents,...
2
votes
3answers
483 views

Using pipes to list the first two and last two users on the system?

I have to use the who command to display who's online, then use pipes to display the first and last 2 users online. the only thing I know how to do is something like: who | head -5 | tail -2 . ...
0
votes
2answers
515 views

No man for tail command

I am using centos 7, but it's weird that I can not get the man page for command tail. Do I miss anything ? Thanks [zeppelin@sandbox zeppelin-zjffdu]$ man tail No manual entry for tail
6
votes
2answers
11k views

Piping the result of ls to tail [duplicate]

I have a directory with a bunch of log files. Something like this: data170213.log data170214.log data170215.log data170216.log I'm interested in looking at the last entries of the most recent file ...
0
votes
2answers
536 views

How to get the last words of the line in log?

I have the following code: #! /bin/sh tail -f /var/log/omxlog | stdbuf -o0 grep player_new | while read i do omxd S done which outputs the playlist of videos in the following format (in real ...
1
vote
1answer
39 views

How to mark the previous end of a file while following it (tail -f/less)?

I'm using some log files for debug, with less and G (to go to the last line/ new input). Whenever there is an error I press G and see the new lines, however I would like to set a mark or some other ...
0
votes
2answers
3k views

Problem using tail and awk to monitor log and execute a command

I want to monitor a log file in real time, and execute some commands when some sentences appear in the log. I searched this site (and many other sites) and these are what I tried: tail -f /var/log/...
0
votes
1answer
1k views

Using PLINK.EXE how to startup tail -f logfile.log | grep myself

I'm using a Windows command file: @Echo Off MODE con:cols=5000 lines=80 cmd /k "title & x:\dir\Putty\PLINK.EXE -ssh name@connection tail -f /opt/dir1/dir2/Blabla_Debug.log" This works like a ...
1
vote
2answers
352 views

Inverted tail command? [duplicate]

Basically, piping a command or block of text to something like: tail -n 3 (for example), will print only the last three lines to stdout. Is there an equivalent, or similar method for doing the exact ...
2
votes
1answer
81 views

Use head command or similar to determine when bytes change in a file

If we use the tail command we can listen for events representing changes to the files length (in bytes). I am looking for a way to listen for events when the content of the file changes but the ...
0
votes
2answers
115 views

Is there a way while using tail to get it to tell number of lines without using cat?

I'll share an example so it makes sense - [$] cat /boot/config-4.9.0-1-amd64 | tail 7856 CONFIG_FONT_SUPPORT=y 7857 # CONFIG_FONTS is not set 7858 CONFIG_FONT_8x8=y 7859 CONFIG_FONT_8x16=...
1
vote
2answers
92 views

How to watch a large file for changes that can occur anywhere?

I'd like to watch a file for changes that might occur. Normally, using tail -f file or watch -d cat file would be fine for this. However, the file I am monitoring is too large to fit on one screen, ...
0
votes
1answer
1k views

Running multiple commands for multiple files on one line [duplicate]

I'm attempting to run multiple commands on the same line for multiple files. I have little experience with Linux and I've run into an issue with this command: tail -n +3 "/usr/local/tmp/csce215/...
0
votes
1answer
144 views

Problem Trimming tailing characters

I've got the following script: #!/bin/bash SINGLE=`cut -c 7-21 Data.txt` cd ../FASTA_SEC/ for i in ${SINGLE}; do if [ -r ../FASTA_SEC/${i}.fa ]; then HEAD=`sed -n 2p ../FASTA_SEC/${i}....
8
votes
2answers
4k views

tail files in a directory without file name and header [duplicate]

The following script works to cat all files in a directory without header but prints the file name. How can I cat without file name. tail -n +2 * >> Compile
1
vote
1answer
580 views

tail -f, without using polling

I am looking for the most performant way to to tail a file using Node.js. There are some libaries that do this, but they seem to use polling as they ask for an interval to check for file changes. I ...
-1
votes
2answers
118 views

Tail a file on Mainframe that needs conversion [closed]

I want to tail a log file in Unix system services on a Mainframe LPAR that needs a ASCII to EBCDIC conversion?
2
votes
2answers
124 views

tailf output as script parameter

Why is it when I leave the following tailf running: tailf /var/log/z-way-server.log | grep --line-buffered device-info | gawk 'BEGIN { FS = "\"" } ; {print $4,"is",$8}' I get my desired output: Den ...

1 2
3
4 5
7