The tag has no wiki summary.

learn more… | top users | synonyms

4
votes
2answers
444 views

What does tail -f <directory name> do?

I mistakenly executed the following command in the terminal: tail -f /logs/applications/logs* I got the following output: tail: file shrunk! Error 0 I am not sure what exactly happened. I have ...
1
vote
2answers
43 views

What does tail -0a do?

In the documentation for logstash, they mention the command tail -0a I have never heard of the -a flag and I can't find any information on google, tail --help or the man pages. What is the ...
1
vote
1answer
49 views

Convert newlines to null-delimited when using tail

How can I change the output from tail to use null-terminated lines instead of newlines? My question is similar to this one: How to do `head` and `tail` on null-delimited input in bash?, but differs ...
21
votes
1answer
622 views

Do I need to worry about “tail: unrecognized file system type 0xbeefdead”?

I'm trying to follow a regular text file with tail -f -n 50 filename. I get the information from the file just fine, except I always get this error message: tail: unrecognized file system type ...
14
votes
8answers
6k views

Command to display first few and last few lines of a file

I have a file with many rows, and each row has a timestamp at the starting, like [Thread-3] (21/09/12 06:17:38:672) logged message from code..... So, I frequently check 2 things from this log file. ...
0
votes
3answers
59 views

Is it possible to change the default COUNT value of tail and head?

The less command accepts its defaults with an environment variable LESS, so you can export LESS='-F -g -i -M -R -S -w -X -z-4' at the beginning of your session. Is it possible to change the ...
1
vote
2answers
68 views

will tail with piping read whole file?

I want to read a big log file with 10000 lines everytime. and I use this command: tail -c +offset somefile | head -n 10000 my question is, with the piping of head, will tail read the whole file? ...
1
vote
1answer
89 views

how do i redirect output from tailf & grep to a file [duplicate]

All I wanted is to grep for specific lines in an ongoing log and re-direct it to some file.. tailf log | grep "some words" Now, I want the above command output to get re-directed to some file in ...
0
votes
1answer
36 views

Need to grep for specific lines from ongoing log and save it in some file

So, let me start with the overall outcome that i want to achieve. There is just one log, which will have info on certain devices, that i am upgrading. I use "tailf log" to monitor the log. Now, ...
76
votes
12answers
23k views

How to have tail -f show colored output

I'd like to be able to tail the output of a server log file that has messages like: INFO SEVERE etc, and if it's SEVERE, show the line in red; if it's INFO, in green. What kind of alias can I ...
15
votes
4answers
14k views

cat line X to line Y on a huge file

Say I have a huge text file (>2GB) and I just want to cat the lines X to Y (e.g. 57890000 to 57890010). From what I understand I can do this by piping head into tail or viceversa, i.e. head -A ...
7
votes
4answers
263 views

Grep from the end of a file to the beginning

I have a file with about 30.000.000 lines (Radius Accounting) and I need to find the last match of a given pattern. The command: tac accounting.log | grep $pattern gives what I need, but it's too ...
9
votes
2answers
193 views

How to start tailing a file that has not been yet created

I use tail to monitor the progress of jobs that I know will write their progress to disk. Almost always, I know which file they will create before they start running (the jobs are dispatched by a ...
4
votes
2answers
36 views

Can less load lines which were appended to a file after opening?

When I am viewing a log file in less is it possible to make less reload the file to get lines which were appended to that file since it was opened?
0
votes
1answer
52 views

Stop tailing log

I have a problem, I accidentally did tail -f on a log, but now I cant quit! - Its the anaconda log during a redhat install. Control-C doesn't seem to work, I guess due to it saying sh: no job control ...
2
votes
1answer
50 views

Piping periodic data between Python scripts

How to receive data from the environment e.g. bash I am trying to launch two Python scripts in bash and pipe stdout from one of them to stdin of the other. The first script outputs a single ...
0
votes
2answers
122 views

Tail multiple files and output as additional column with 'find' results

Would like to pull the last line of text from a specific (multiple) files in a directory. Additionally, I'd like the results to be in a more traditional column format (like ls) with path, rather than ...
2
votes
3answers
141 views

How to tail a file over the network?

How can I tail -f a file that over the network, say at \\192.168.2.130\public\print.log? I have tried the variations of the following: tail -f //192.168.2.130/Southpaw/Tactic/print.log which erred ...
12
votes
4answers
5k views

How to monitor only the last n lines of a log file?

I have a growing log file for which I want to display only the last 15 lines. Here is what I know I can do: tail -n 15 -F mylogfile.txt As the log file is filled, tail appends the last lines to the ...
3
votes
3answers
381 views

How to make dot matrix printer print every line of 'tail -f'

I have a dot matrix printer, an Epson LQ-500. It works well with CUPS, and I use it to print listings sometimes, text files, etc. now, I'd like to use it as a logging printer. for that, I need it to ...
3
votes
2answers
97 views

How can I monitor a file that fully recreates during its run?

This is a follow-up question of Why are some file changes not shown in tail -f? With the use of capital F: tail -F I can monitor the output of tail -F ~/.mysql_history from the manual: ...
3
votes
1answer
77 views

Why are some file changes not shown in tail -f?

I tried to follow the mysql history file with: tail -f ~/.mysql_history in another window I entered as the same user: mysql -u someotheruser -p and none of the following commands are shown in my ...
68
votes
3answers
2k views

Does tail read the whole file?

If I want to tail a 25 GB textfile, does the tail command read the whole file? Since a file might be scattered on a disk I imagine it has to, but I do not understand such internals well.
5
votes
2answers
100 views

Show tail of files in a directory?

I have a directory that is too huge to browse by any means. Grepping returns argument lists too long, WINSCP crashes when trying to open the directory. Is there a way I can view just the last 200 ...
4
votes
1answer
126 views

How can I colorize head, tail and less, same as I've done with cat?

I've got 'color cat' working nicely, thanks to others (see How can i colorize cat output including unknown filetypes in b&w?). In my .bashrc: cdc() { for fn in "$@"; do source-highlight ...
6
votes
2answers
2k views

Reading from a continuously changing logfile

There is /location/of/thefile, which is a continuously changing logfile. The average density of refreshes is 4 per minute, the possible maximal refresh rate could be 30-40 per minute. Every refresh ...
1
vote
1answer
33 views

Get last changed content since last read

How can I get the last changed content of a file, since its last read? Something more precise that this: tail - <nr >file_1.txt >file_2.txt where file_2.txt gets the last modified ...
2
votes
1answer
312 views

Search and Filter Text on large log files

I use the tail, head and grep commands to search log files. Most of the time the combination of these 3 commands, in addition to using pipe, gets the job done. However, I have this one log that many ...
9
votes
2answers
825 views

“tail -f | iconv -fsjis” does not output anything

I want to tail -f a file, but its content is in sjis encoding, so I need to have it converted to the native (utf-8) encoding of my terminal. When I do tail -f x | iconv -fsjis there will be no ...
1
vote
4answers
150 views

How to change color of a character while tailing and tr

I regularly use this command line but I would like to change the color of the "|" to green in the output. Does anyone know how I can accomplish this? tail -f file.log | tr '\001' '|' | grep TEST
2
votes
1answer
128 views

Does multitail follow the inode or the file name by default?

For logrotated files one usually uses tail -F instead of tail -f to follow the log file contents. Does multitail(1) automatically follow the name instead of the inode (which likely changes with the ...
4
votes
5answers
208 views

Only output most recent 10 (or n) lines of a lengthy command output

I have currently worked alot with shell and bash on linux. I have made tons of backups scripts and much more. In many cases I have a command that outputs thousands of lines. I actually need these ...
12
votes
3answers
1k views

monitor files (ala tail -f) in an entire directory (even new ones)

I normally watch many logs in a directory doing tail -f directory/*. The problem is that a new log is created after that, it will not show in the screen (because * was expanded already). Is there a ...
1
vote
2answers
77 views

How to hide the . and .. from ls

When I run ls -l on a directory, I see an entry titled '.' How can I remove the row containing '.' from the output? ls -latr /foo | tail -n5 -rw-rw-r-- 1 guest bar 59169 Aug 20 12:22 ...
2
votes
1answer
243 views

Periodically get new lines from file, possibly logrotated

I'm looking for a fairly simple way (no development involved -- I could write this in Python but I'm hoping there's something already out there). I have a log file (in my case written by rsyslogd). ...
2
votes
3answers
154 views

Exception handling when using tail -f to monitor a log

I have a main script calling the script to do the monitoring. I am trying to catch the exception that the log is missing or not accessible anymore. tail -f is used instead of -F since the logs are ...
2
votes
2answers
74 views

whats a good tool to search tail -f output

I am dumping some debug info into a text file that I am using tail -f to monitor. Is there a tool that I can then pipe that tail -f data into to be able to search the text on screen using regular ...
22
votes
5answers
5k views

How to obtain inverse behavior for `tail` and `head`?

Is there a way to head/tail a document and get the reverse output; because you don't know how many lines there are in a document? I.e. I just want to get everything but the first 2 lines of foo.txt ...
1
vote
4answers
200 views

Tail -f the most recent log file

In a few spots I got this to work ls -rt /path/to/log/file/ | tail -1 | xargs tail -f But I can't figure out why it won't always work (This is quick fix until I get the log rolling fixed here)
11
votes
6answers
3k views

Best way to follow a log and execute a command when some text appears in the log

I have a server log that outputs a specific line of text into its log file when the server is up. I want to execute a command once the server is up, and hence do something like the following: tail -f ...
2
votes
1answer
479 views

Using tail to follow daily log file in Bash

I have a task to use a bash script to monitor a couple of log files named with the current day, eg. YYYY-MM-DD.log. (1) I used tail -f to follow the file but unable to deal file rotation. Even if ...
3
votes
3answers
771 views

How do I make Vim behave like “tail -f”?

I would like to know if there is a way to make Vim behave like tail -f. Even the best Vim plugin I've found so far doesn't do what I expect. I really want to see the file update in real-time. Even ...
3
votes
4answers
457 views

is there an alternative to tail -f that has convenient scrolling? [duplicate]

I'm usually inside GNU Screen or tmux, which doesn't give me excellent scrolling functionality. Is there an alternative to tail -f that allows me to quickly scroll up? A tool that is like most is to ...
2
votes
1answer
426 views

Issue with real-time log inspecting piping tail, grep and cut

I have to inspect a growing log in real time, and I found an issue that makes me miss some lines (I can't understand exactly what lines) using tail -f or tailf, grep and cut. I use grep because I ...
3
votes
1answer
89 views

How to follow and seek in a file being piped through a filter, in less

I basically wish to seek, search and follow a growing log file after passing it through a sed filter. I figured I need to follow a file with tail -f pipe it to sed and then pipe that to less. For ...
1
vote
2answers
121 views

tail -f but suck in content of the file first (aka `cat -f`)

I need to display whole file before tracking it for a new changes, not only the last 10 lines (yep, I know it's not tail conceptually). In other words, something like cat -f would do, if it would ever ...
2
votes
2answers
325 views

Tail -f piped through grep not outputing to file, but outputs to console

I'm using the following command tail -f /mydir/myfile | grep "searchterm" >> outfile Without the -f it works fine, but with the -f, which I need, nothing is written to the file. The ...
1
vote
1answer
125 views

POSIX head and tail not feature equivalent

The documentation for POSIX tail's -n option says that The origin for counting shall be 1; that is, -n +1 represents the first line of the file, -n -1 the last. So tail -n 10 (used later on the ...
2
votes
1answer
71 views

Making less's follow option show line movement

I often find myself using less to display log files that contain hundreds of contiguous, identical lines that are appended to the files at set intervals. For example, something happened something ...
9
votes
1answer
240 views

How to do `head` and `tail` on null-delimited input in bash?

find command can output names of files as a null-delimited strings (if -print0 is provided), and xargs can consume them with -0 option turned on. But in between, it's hard to manipulate that ...