Questions tagged [tail]

Unix command to view the end of a file

Filter by
Sorted by
Tagged with
2 votes
1 answer
47 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 ...
Edward Ruchevits's user avatar
2 votes
1 answer
63 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 ...
Heinz's user avatar
  • 121
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 ...
Black's user avatar
  • 7,941
0 votes
1 answer
132 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 ...
bohrax's user avatar
  • 111
1 vote
1 answer
129 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 ...
Fixenet's user avatar
  • 13
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 ...
Doug Fir's user avatar
  • 155
0 votes
1 answer
731 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 ...
End Anti-Semitic Hate's user avatar
1 vote
2 answers
721 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 ...
shiponcs's user avatar
  • 113
0 votes
1 answer
179 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/...
MagePsycho's user avatar
0 votes
0 answers
677 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 ...
Nancy's user avatar
  • 1
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("...
Branka's user avatar
  • 101
1 vote
1 answer
582 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 ...
loopbackbee's user avatar
  • 1,431
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 ...
flyingcheetah's user avatar
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 ...
oneindelijk's user avatar
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. ...
Shep Bryan's user avatar
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 ...
Dre's user avatar
  • 3
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 ...
PhantomR's user avatar
  • 139
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 ...
Arjun's user avatar
  • 101
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 "...
Виктор К.'s user avatar
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 ...
user652437's user avatar
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 ...
Chris Barrett's user avatar
1 vote
1 answer
455 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 | ...
Sam Salisbury's user avatar
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 ...
machineghost's user avatar
  • 1,112
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 ...
Diego Victor de Jesus's user avatar
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 ...
Qohelet's user avatar
  • 155
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 ...
igor's user avatar
  • 433
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 ...
abbood's user avatar
  • 1,274
1 vote
2 answers
872 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 ...
kramer65's user avatar
  • 1,434
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 ...
clearcom0's user avatar
-1 votes
1 answer
69 views

Tail and strip unwanted content from each line

I've got a log that contains data I don't need and want to tail it and strip the data so that this: [Tue Nov 07 2017 14:44:51 GMT+0100 (CET)] INFO :CREATE [Tue Nov 07 2017 14:44:51 GMT+0100 (CET)] ...
hakunin's user avatar
  • 103
3 votes
1 answer
1k views

How to "tail" multiple pipe files or streams?

I need to monitor a lot of web servers for runtime errors and I have an idea of running a script like #!/bin/bash -e # Example set of hosts HOSTS=( host1 host2 ) for host in ${HOSTS[@]} do [...
Andrey Utkin's user avatar
2 votes
1 answer
58 views

Separating files in watch command

I have 3 files and I want watch the changes of these files with 'watch' command. But these 3 files have a lot of row and I just want see the last 3 rows with 'tail'. There is no problem at here. I can ...
Jo Shepherd's user avatar
0 votes
0 answers
187 views

Use Cygwin to tail multiple files

I would like to tail multiple files into the same window so that they are intermingled. When I try the following: tail -f logA.log logB.log I get the following: usage: TAIL [switches] [filename]...
Tyler Murry's user avatar
0 votes
1 answer
1k views

Grep with multiple patterns used on the command

A few days ago I installed Centos 7 on my server and run ssh. Now I want to track logs. Is there anyway to combine cat or tail with grep to have clear failed and accepted login attempts list from a ...
sober's user avatar
  • 75
0 votes
2 answers
1k views

Monitor log live for error. If error = rerun command and restart log monitoring, if not found = keep monitoring forever

A process in a bash script I'm developing often fails quietly (it keeps running with no error code, but it writes the error in its log file). As soon as the error appears in the log file I want the ...
NewsGuy's user avatar
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 ...
network's user avatar
  • 351
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.
sorin's user avatar
  • 11.8k
0 votes
2 answers
34 views

display number of files in current moment like what tail -f do

I have a folder which files are copied to it like /home/my/. I want to run a command which shows number of files inside it in real time like what tail -f do with file contents. I know I should run ls *...
VSB's user avatar
  • 285
3 votes
0 answers
2k views

How do I tail Windows 10 Update Log

I have a following batch file that runs on startup wuauclt.exe /detectnow /updatenow start /min C:\Windows\WindowsUpdate.log But now in Windows 10 log file simply has the following Windows Update ...
SeanClt's user avatar
  • 2,227
-1 votes
1 answer
2k views

Tail logs and use grep to exclude specific lines

I have this line that appears every minute in my log file: 2016-03-29 21:52:46,226 INFO 200 GET /api/ping (0.0.0.0) 0.34ms I want to tail this log file without showing these lines. I tried: ...
Bruno's user avatar
  • 175
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 ...
Hugh's user avatar
  • 1,201
1 vote
2 answers
299 views

Watching logs with less +F freezes after a while

less +F is a great command for watching logs, but it has very annoying issue. After a while it stops updating log file and requires restart. Is there any way to make it follow file forever?
Marcin Szymczak's user avatar
0 votes
2 answers
494 views

How to join files using 'tail' command while displaying limited lines

I have multiple log files and I want to display its joint output. One way of doing this is by executing this command: tail file-1 file-2 But I also want to display only a specific number of lines ...
Punit Naik's user avatar
1 vote
1 answer
469 views

How to grep in tail in several files

I need to tail several files, and most info from them i removing (using grep). Now mine output dirty with file names. How i can remove them? Short to problem: $ tail -F /log/rest_server*.log | egrep -...
bm13kk's user avatar
  • 11
2 votes
2 answers
11k views

Tail, cat and grep a file at the same time

So I need to monitor a log file in linux and I'd like to cat the contents (to see all previous entries) as well as tail the log file while simultaneously using the grep to filter out the stuff I want ...
Toni Kostelac's user avatar
2 votes
1 answer
621 views

Preserve colors with watch -n

I am running watch tail -n 15 20151217.log and my output looks like 12-17 04:42:52 DEBUG [31mXYZT 10 91.5[0m Instead, I want to see it as colored text. What can I do? I don't want to use ...
The Baron's user avatar
  • 121
0 votes
0 answers
151 views

MS-DOS show a list of excecuted commands

I'm trying to see a list of commands which are executed in windows once I run a specific function within an application. So for example, if I was to use Ms Word to save a file, I would like to see a ...
Vilius's user avatar
  • 101
1 vote
1 answer
183 views

How do I run Logstalgia if root login is disabled and ssh user doesn't have access to logs?

I'm trying to run Logstalgia, I think it's pretty awesome, and want to try it out. For security reasons I've disabled root login from my servers. My current user doesn't have access to the log files ...
trueCamelType's user avatar
0 votes
1 answer
1k views

command nohup tail with redirection in shell script not invoked properly under a particular situation

I have an issue where a tail command in bash script does not work correctly when called from remote by providing only 1 param out of 2 params. But it works correctly if: executed directly on local ...
Neha Sharma's user avatar
1 vote
1 answer
69 views

Find and replace in output of command based on file contents

I have a tail -f command reading a log containing IPs however I wish to replace these IPs with hostnames, I have the dhcpd.leases file available to the machine on which this is running. I have been ...
o.comp's user avatar
  • 159