Questions tagged [tail]

Unix command to view the end of a file

Filter by
Sorted by
Tagged with
1
vote
1answer
34 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 ...
2
votes
0answers
20 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 ...
0
votes
1answer
94 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 ...
3
votes
1answer
2k 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
1answer
33 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
1answer
23 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
1answer
34 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
1answer
23 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
2answers
394 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
1answer
194 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 | ...
2
votes
2answers
775 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
1answer
190 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 ...
0
votes
1answer
53 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 ...
0
votes
1answer
110 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 ...
0
votes
1answer
537 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 ...
1
vote
2answers
351 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 ...
4
votes
1answer
710 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 ...
-1
votes
2answers
54 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)] ...
2
votes
1answer
617 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 [...
2
votes
1answer
44 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 ...
0
votes
0answers
105 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]...
0
votes
1answer
443 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 ...
0
votes
2answers
518 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 ...
9
votes
1answer
14k 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 ...
1
vote
1answer
292 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.
0
votes
2answers
31 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 *...
2
votes
0answers
1k 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 ...
-1
votes
1answer
580 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: ...
60
votes
6answers
7k 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 ...
1
vote
2answers
129 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?
0
votes
2answers
308 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 ...
1
vote
1answer
191 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 -...
1
vote
2answers
5k 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 ...
1
vote
1answer
179 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 ...
0
votes
0answers
106 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 ...
1
vote
1answer
136 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 ...
-1
votes
1answer
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 ...
1
vote
1answer
59 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 ...
3
votes
0answers
297 views

Log tailing over SMB much slower under Samba 4 vs Samba 3

I just upgraded my internal development VM running Ubuntu 11.10 with Samba 3.6 to Ubuntu 15.04 with Samba 4.1 (fresh install, new VM). Everything is working great, with the exception that my log ...
1
vote
1answer
702 views

combining tail -f with less +F does not work

I am using ubuntu bash. I am trying to combine tail -f and less +F like below and nothing is coming out. tail -f long_running_log | less +F long_running_log is a log file constantly being written ...
18
votes
4answers
3k views

Linux command line log viewer which allows auto tail AND searching?

I use tail -f in my Linux shell, to view log files, as I like how it auto-updates with the incoming text: I like to see the new stuff come scrolling in. However, I also like the search functionality ...
0
votes
1answer
999 views

How to grep for line numbers in a binary file?

I'm on Centos 5 Linux and using GNU grep v2.5.1 and looking at a 36GB log file. It is huge and I need to find around a million lines starting from the occurrence of a string 6307459 in the log file ...
1
vote
0answers
234 views

Can vim be used to view a growing file?

I often use vim's view for viewing files. Is there a way to use it for a growing file so that I can see the progress as it's happening? Something similar to tail -f or less +F I have two use cases:...
2
votes
1answer
2k views

piping tail -f into sed or awk

There is another question which is nearly the same, but none of the suggestions from its answer works for me: Piping tail -f into awk I'm trying to tail -f a logfile but want to replace \r with \n ...
0
votes
0answers
34 views

Is there a way to make tail output newlines?

When I do tail -f $file I see newlines as \n. For example: permissions array(\n 0 => \n stdClass::__set_state Is there a way to make it turn into permissions array( 0 => stdClass:...
0
votes
0answers
426 views

Copy huge file skipping first line using dd in Linux

I was trying to copy the content of a huge file (10GB) to another skipping the first line (as in head -n1). I tried multiple ways of head, tail, awk and sed. Settled on using tail -n+2 > ./xab.1 ...
1
vote
2answers
3k views

Scrolling in terminal (OS X) when running tail -f and ssh-ed into a machine yields some strange characters

I'm ssh-ed into a remote machine and running tail -f. Every time I scroll up/down using the trackpad, it yields some strange characters, like OB^[OB^[OB^[OB^[OB^[OOB^[OB^[OB^[OB^[OB^[O This didn't ...
0
votes
1answer
224 views

Why chain of commands that runs fine on local doesn't run on SSH?

There's something funny with tail -f and grep -o combination when running over ssh. So on local server, if you do tail -f /path/myfile.log |grep -o keyword It grep just fine. But if you run it on ...
2
votes
1answer
679 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 ...
6
votes
1answer
603 views

tail -f file stops tailing on rename

I want to tail -f file but going tailing it after a mv. The tail manpage tells me: -f means --follow=descriptor so a mv should not change the inode? Why does tail -f stop working after the rename?