Questions tagged [tail]

Unix command to view the end of a file

Filter by
Sorted by
Tagged with
0 votes
0 answers
26 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 ...
user avatar
1 vote
2 answers
129 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 ...
user avatar
  • 113
0 votes
1 answer
56 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/...
user avatar
0 votes
0 answers
98 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 ...
user avatar
  • 1
0 votes
1 answer
26 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("...
user avatar
  • 101
1 vote
1 answer
129 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 ...
user avatar
  • 1,381
2 votes
0 answers
25 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 ...
user avatar
0 votes
1 answer
941 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 ...
user avatar
4 votes
1 answer
18k 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. ...
user avatar
0 votes
1 answer
39 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 ...
user avatar
  • 3
0 votes
1 answer
177 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 ...
user avatar
  • 139
0 votes
1 answer
44 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 ...
user avatar
  • 101
0 votes
1 answer
26 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 "...
user avatar
1 vote
2 answers
1k 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 ...
user avatar
1 vote
1 answer
301 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 | ...
user avatar
6 votes
2 answers
2k 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 ...
user avatar
0 votes
1 answer
396 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 ...
user avatar
0 votes
1 answer
59 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 ...
user avatar
  • 125
0 votes
1 answer
136 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 ...
user avatar
  • 423
1 vote
1 answer
760 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 ...
user avatar
  • 1,052
1 vote
2 answers
568 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 ...
user avatar
  • 1,224
4 votes
1 answer
1k 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 ...
user avatar
-1 votes
1 answer
65 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)] ...
user avatar
  • 103
3 votes
1 answer
938 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 [...
user avatar
2 votes
1 answer
46 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 ...
user avatar
0 votes
0 answers
129 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]...
user avatar
0 votes
1 answer
770 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 ...
user avatar
  • 67
0 votes
2 answers
830 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 ...
user avatar
16 votes
2 answers
22k 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 ...
user avatar
  • 271
1 vote
1 answer
328 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.
user avatar
  • 11.1k
0 votes
2 answers
33 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 *...
user avatar
  • 285
2 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 ...
user avatar
  • 2,158
-1 votes
1 answer
1k 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: ...
user avatar
  • 165
61 votes
6 answers
8k 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 ...
user avatar
  • 1,181
1 vote
2 answers
183 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?
user avatar
0 votes
2 answers
376 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 ...
user avatar
1 vote
1 answer
339 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 -...
user avatar
  • 11
2 votes
2 answers
8k 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 ...
user avatar
1 vote
1 answer
393 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 ...
user avatar
  • 111
0 votes
0 answers
131 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 ...
user avatar
  • 101
1 vote
1 answer
158 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 ...
user avatar
-1 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 ...
user avatar
1 vote
1 answer
61 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 ...
user avatar
  • 159
3 votes
0 answers
335 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 ...
user avatar
  • 385
1 vote
1 answer
798 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 ...
user avatar
19 votes
4 answers
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 ...
user avatar
  • 2,639
0 votes
1 answer
1k 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 ...
user avatar
  • 7,586
1 vote
0 answers
253 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:...
user avatar
  • 2,699
2 votes
1 answer
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 ...
user avatar
  • 133
0 votes
0 answers
35 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:...
user avatar