Unix command to view the end of a file

learn more… | top users | synonyms

0
votes
2answers
24 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
6 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
votes
0answers
22 views

Tail a log file with today`s date

So i am trying to come up with a command to tail a log file with todays date. The log file gets updated everyday with the current date. As the number of lines for the log for any particular day can ...
0
votes
2answers
13 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 ...
3
votes
3answers
61 views

Discard content of logfile, keeping tail

I'm looking for a way how to discard content of the logfile, leaving only defined tail. In two steps it's quite easy: tail -n1000 alert_migtst.log > alert_migtst.tail mv -f alert_migtst.tail ...
0
votes
0answers
46 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 ...
53
votes
5answers
3k 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 ...
94
votes
12answers
67k views

Is it possible to `tail -f` the output of `dmesg`?

Want to do something like dmesg | tail -f but it doesn't work: I use Mac OSX 10.6.7, by doing that the tail will exit, instead of monitoring the output. I wonder if there is any way to do it, or ...
-1
votes
1answer
25 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: ...
1
vote
0answers
110 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 ...
21
votes
16answers
37k 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. ...
0
votes
2answers
30 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
1answer
22 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 ...
0
votes
2answers
22 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 ...
20
votes
1answer
18k views

Combine tail -f with grep?

Hi I wanna keep looking at a log file, but I also don't wanna see irrelevant stuff, I'm only interested in anything with "foobar" in it. So if I was tailing the file I would do tail file | grep ...
0
votes
0answers
25 views

Read binary file of expected size blocking until the size is equals expected

I want to read a dowloaded file while it is being written for instance with tail -f -c +1 $filename and to redirect it to another tool (which decodes it) with a pipe |. This works fine but I am doing ...
-1
votes
2answers
99 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 ...
0
votes
1answer
18 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 ...
0
votes
0answers
26 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 ...
0
votes
2answers
825 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 ...
1
vote
2answers
111 views

display whole stream while highlighting with grep

I often use tail -f | grep someregex on log files. I have grep liased to grep ---color=auto so my matches are highlighted. If I want to see my matches in the context of the whole stream, how would I ...
11
votes
3answers
4k 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
0answers
16 views

remove last n lines of command line output? [duplicate]

When I run cat duplicates.txt I get the entire contents of the file duplicates.txt. The end of the file appears right above my command prompt. I can conveniently copy and paste content from it to my ...
1
vote
1answer
41 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 ...
0
votes
2answers
1k views

Can't scroll tail up or down on server

Possibly related to Tail keeps snapping to the bottom after i scroll up with mousewheel I can view my regular log files (on my local machine I mean) with tail -f and can scroll up or down. However, ...
-1
votes
1answer
210 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
30 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 ...
0
votes
0answers
40 views

Ctrl+c closes Remmina SSH connection instead of only log tail

I am using Remmina to connect to the linux machine over SSH to monitor logs of the application. I am using tail command to watch .log file. When I am trying to stop watching log by using ctrl + c ...
4
votes
2answers
373 views

Tail -f on files that don't exist yet

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
2answers
240 views

Is there any tail like tool supporting WebDav

My problem is that that a proprietary SaaS platform im developing on/for only provides log files via WebDav. During development this log files can get quite large by the end of the day (think 200 Mb+) ...
12
votes
3answers
11k 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
1answer
114 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
1k 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
122 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
69 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 ...
1
vote
1answer
452 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
19 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 => ...
1
vote
2answers
2k views

How to find the last match of a string in a bunch of files

I have a bunch of files, I'd like to find the last match of a string in each of them. grep text *.file gives me all the matches not the last ones. ls *.file | xargs grep text | tail -n 1 gives me ...
0
votes
0answers
146 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 ...
0
votes
1answer
104 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 ...
3
votes
3answers
4k views

multitail for Windows cmd/powershell?

Is there a program like multitail but for Windows cmd.exe or powershell (not GUI)?
0
votes
0answers
214 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
144 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?
3
votes
1answer
355 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 ...
7
votes
2answers
3k views

Equivalent of 'clear' command when using tail -f

I am using the tail -f command to follow an error log, and I often want to "clear" the terminal, much in the same way that the clear unix command moves everything above the top of the window. Is there ...
1
vote
1answer
71 views

What's the best way to view lines X through Y of a large file?

I have a very large text file and I want to view, say, lines 2000 through 2010 (with the line numbers included) I know one sort of roundabout way of getting there: sc -l [file] cat -n [file] | tail ...
4
votes
1answer
4k views

How to easily break up a text file into pieces smaller than a threshold?

I have some text files that are 100 to 300 MB in length that I want to view in Emacs, but my Emacs gets into some performance issues opening and traversing such large files. Therefore, I'm looking ...
5
votes
3answers
2k 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. ...
2
votes
1answer
486 views

Tail the filename, not the file

In UNIX (OS X BSD to be precise), I have a "tail -f" command on a log file. From time to time I want to delete this log file so I can more easily review it in my text editor. I delete the file, and ...
6
votes
2answers
1k views

Is there a tail -f equivalent for ls?

Basically the question is in the title. I want to monitor a directory for new files that are written or deleted, the way I can monitor a log file with tail -f. Is this possible?