Questions tagged [tail]

Unix command to view the end of a file

Filter by
Sorted by
Tagged with
1 vote
1 answer
64 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
0 votes
0 answers
27 views

tail following multiple files capturing empty data despite showing file header

I have the following script to capture log data from multiple files: tail -n +0 --follow=name --retry /var/log/celery/celery.log /var/log/app/worker.log Typically worker.log exists prior to tail ...
DanH's user avatar
  • 333
2 votes
1 answer
2k 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
342 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 ...
RockPaperLz- Mask it or Casket's user avatar
1 vote
2 answers
409 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 ...
Mateen's user avatar
  • 113
0 votes
1 answer
108 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
398 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
77 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
347 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,401
2 votes
0 answers
33 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
22k 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
57 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
250 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
69 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
33 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
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
368 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
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 ...
machineghost's user avatar
  • 1,030
0 votes
1 answer
509 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
74 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
  • 135
0 votes
1 answer
170 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
  • 423
1 vote
1 answer
868 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,174
1 vote
2 answers
721 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,354
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
68 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
50 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
165 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
940 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
16 votes
2 answers
25k 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
  • 271
1 vote
1 answer
396 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.6k
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
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 ...
SeanClt's user avatar
  • 2,236
-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
  • 165
61 votes
6 answers
9k 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,191
1 vote
2 answers
232 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
430 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
435 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
9k 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
521 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
143 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
177 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
62 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
3 votes
0 answers
366 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 ...
jimp's user avatar
  • 415
1 vote
1 answer
898 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 ...
Tom Bennett's 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 ...
Max Williams's user avatar
  • 2,877
0 votes
1 answer
2k 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 ...
WilliamKF's user avatar
  • 7,768