Questions tagged [tail]

Unix command to view the end of a file

Filter by
Sorted by
Tagged with
2 votes
1 answer
46 views

Execute self-extracting bash script (with binary data appended) w/o saving it first

I have a self-extracting bash script (binary data appended to the end) like this: #!/bin/bash export TMPDIR=$(mktemp -d) ARCHIVE_START_LINE=$(...) # <omitted> # extracting data archive into a ...
2 votes
1 answer
62 views

tail -f does not follow files on WSL

I have : F:\xampp-htdocs>wsl --list Windows Subsystem für Linux-Distributionen: Ubuntu-22.04 (Standard) I cd into my logfiles on Window 11: /mnt/d/xampp-2024-15-01/apache/logs$ there i do tail -f ...
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 ...
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 ...
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.
197 votes
14 answers
211k 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 ...
0 votes
1 answer
129 views

How to output contents of rotating log files dynamically to stdout?

I want to output the contents of a number of rotating log files, let's say file.log.1 and file.log to stdout for continued processing. For a single log file I could have used tail -F file.log, but ...
1 vote
2 answers
3k views

tail -f updates slowly

I'm not sure why, but on my Macbook Pro running lion I get slow updates when I issue "tail -f" on a log file that is being written to. I used to use this command all the time at my last company but ...
2 votes
2 answers
476 views

Is it possible to tail both file and journalctl using the same console?

I am looking for a solution for tailing not only multiple files in parallel but also the journalctl. Multitail seems to do a pretty good job but I don't know a way to make it work with journalctl.
1 vote
1 answer
127 views

stopping ssh process that is sent to background without corrupting stdout

My script aims to extract a text log file using tail -f and a wireshark trace using tshark. But I don't know if these are the best options for my goal. My script has to ssh into a machine (which I ...
24 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 ...
26 votes
3 answers
13k 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 ...
0 votes
1 answer
727 views

What are the command line parameters (options) for Microsoft's CMTRACE tool?

The CMTRACE tool is included in Microsoft's System Center 2012 R2 Configuration Manager Toolkit. It's a reasonably good tail tool. One of its downsides, however, is that it can take a very long time ...
2 votes
1 answer
5k views

Modify 2>&1 so that output goes to a specific file and any errors or other output goes to a log file I can monitor?

I'm reading this post and I don't fully follow the answer. I wondered if I could modify this, what's it called, command redirect? What I would like: Don't hang, use ampersand & to move on to the ...
87 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. ...
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) ...
1 vote
1 answer
581 views

Unblock "less" after follow mode / scrolling past end of buffer

I'm using less to capture the output of a live program. Using F activates follow mode, showing me real-time output. However, after entering follow mode (or, more generally, scrolling past the buffered ...
1 vote
5 answers
4k views

How to use tail.exe : Windows 2003 Resource kit tool

Tail.exe from Windows 2003 Resource kit link to download page I tried "option -f filename.xyz" - this doesnot seem to update. In my .net app, log file is updated using this code : FileStream ...
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 ...
86 votes
6 answers
85k 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 ...
1 vote
2 answers
720 views

Tail -f is not showing the update of the file when edited form editor

I have opened a file using tail -f <filename, and tried to append some texts in the same file from another tab using vim, the updated content is not showing. But if I append some texts using echo ...
0 votes
1 answer
178 views

Find files from different directories with inclusion and exclusion of some

I want to find files from three different folders with certain files included & excluded. Folder 1: Path: /var/www/app/var/log/ Exclude only: file1.log & file2.log Folder 2: Path: /var/log/...
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 ...
0 votes
0 answers
673 views

Mac terminal : terminate tail output

How can I terminate the tail log output on the mac terminal and come back to the prompt? I have tried using command+z|x|c|q and control+z|x|c|q but it doesn't work. With control, I get the below ...
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 ...
0 votes
1 answer
97 views

Tail log and output top processes upon encountering string fails

I am running the following command to tail a log file and output top processes to a file upon encountering a given string: tail -f mylogfile.log | awk ' /server on fire/ { system("...
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 "...
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 ...
2 votes
0 answers
52 views

Realtime filtering of a capture in a different process

Posted this on network engineering earlier: https://networkengineering.stackexchange.com/questions/67433/realtime-filtering-of-a-recording-in-a-different-process I have a network recording setup ...
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 ...
0 votes
1 answer
2k views

tail -n1 on latest non-empty line

I wanted to achieve something similar to this grep -v '^$' <myfile-with-blank-lines-at-the-end> | tail -n 1 Basically, I have a file with a unique number, followed by a comma and I want to ...
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. ...
0 votes
1 answer
70 views

Command Line Number Line Not In Sync

I'm playing around with the command line. For some reason when I try to grab lines 439 - 445 the output I am getting is lines 375 - 381 instead. I use the tail command to jump to line 439 then use the ...
0 votes
1 answer
321 views

Linux head/tail commands' man page does not show the '-LINES' argument

I have just read in a book that the command head -LINES displays the first LINES lines of a file. However, head's man page does not seem to reveal this is a legit argument. I'd like to know what I am ...
0 votes
1 answer
76 views

How to write each new mail to a separate file using tail -f?

I am monitoring the mail file for new emails. The goal is to create a new file for each new email that reaches localhost. This is what I have so far. current="$(date +"%Y_%m_%d_%I_%M_%p").txt" tail ...
0 votes
1 answer
42 views

Perform a command when a specific text occurs in a log file

Is there any way to achieve something like this? Whenever some specific word (or combination of them) occurs in log file, I want to perform specific action. For example: whenever there occurs a word "...
1 vote
2 answers
2k views

Tail -f last modified file in folder

I'm trying to use tail -f to follow a log in file in a specified folder. I can do this with the simple command tail -f [path to file] but is there a way i can have a command that runs and tracks the ...
1 vote
1 answer
454 views

Why does `tail -f /var/audit/current | praudit` just print 5 lines and exit immediately?

I want to follow my audit log live so I can watch for events, and pipe it through praudit to make it human readable. All commands below are run as root. When I run tail -f /var/audit/current | ...
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 ...
0 votes
1 answer
640 views

tail -f over network with Putty

I want to see log files on a remote Linux machine on my network without having to manually ssh, cd to directory and tail -f the log file. I am using Windows and need to do this with Putty. Is there a ...
2 votes
1 answer
756 views

Insert blank lines when using 'tail -f' in cmder

I recently switched from Cygwin to cmder mostly due to it's awesome interface and all that cool pre-configured stuff. ( http://bliker.github.io/cmder/ ) I am using tail -f very often and when I am ...
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 ...
0 votes
1 answer
88 views

Strip off previous lines in tail or less

I'm using tail -f or less +F to observe a changing log-file. I know from a certain point the lines I'm looking for are going to appear. So all that garbage before that point I don't require and would ...
1 vote
1 answer
1k views

how to tail into the last file on a remote server via ssh

background I always tail logs (both error and info).. which requires the following manual steps 1. ssh into a server 2. cd into the logs directory 3. identify the last file that is either error or ...
0 votes
1 answer
181 views

How to remain in session after exiting tailf command from remote script

Have PowerShell script from which I am executing the following command: putty.exe -ssh user@srv -pw password -m Execute_Command_File -t During the script, tailf /dir/log/ command is written into ...
1 vote
2 answers
1k views

pipe from ssh to windows "ssh server 'tail err.log' | tool.exe"

I want to live monitor a logfile generated on a remote linux host with a windows tool. I'm looking for something like: $> ssh remoteserver 'tail -F /var/log/err.log' | tool.exe But on Windows. ...
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
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 ...
1 vote
2 answers
871 views

How to tail file from url without downloading the entire file?

I've got a system which needs to get the latest 200 lines from a very large public file every day. The file is exposed over an url. Currently I run a simple script which does a wget and then tails the ...
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 ...