I am currently connected to the Twitter Stream, and I would like to count the number of lines of data as they come in.  I know I can do wc-l to just count the lines, but I want it to be auto-updating.  Kind of like how tail -F works, but instead, I want a running tally of how many records I've received.  Is there a simple command to do this in UNIX?
123810
I know of course that  cat logfile.txt | wc -l 120   will tell me the number of lines in a file.  Whereas  tail -f logfile.txt   will show me the new lines that another program writes to logfile.txt.  Is it possible to combine both so that I get a continuous updating line count of logfile.txt with standard text utilities?  I do know about  watch wc -l logfile.txt   but I do not want to re-count the whole file each time, that seems to be a waste. One would need an appended-only count every second or so and probably an \r instead of an \n at the end of line.
4232
Could you recommend a GUI application with powerful log watching capabilities?  Generally it would work as tail -f in GUI, but on top of that following features would be very useful:   filtering out some lines based on (regular) expressions  coloring some lines based on (regular) expressions interactive search saveable configuration easily applicable to different files notifications based on (regular) expressions   A similar tool on Windows is  and its paid version -
35540
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.   First few rows, that has the global conditions and start time is also given. Last few rows, that has the exit status with some other info.   Is there any quick handy single command that could let me display just the first and last few lines of a file?
49671
I'd like something like a generic, re-usable getPosition() method that will tell me the number of bytes read from the starting point of the stream.  Ideally, I would prefer this to work with all InputStreams, so that I don't have to wrap each and every one of them as I get them from disparate sources.  Does such a beast exist?  If not, can anyone recommend an existing implementation of a counting InputStream?
15305
Example: I have the file "mybinaryfile", and the contents in hex are:  A0 01 00 FF 77 01 77 01 A0   I need to know how many A0 bytes there are in this file, how many 01, and so on. The result could be:  A0: 2 01: 3 00: 1 FF: 1 77: 2   Is there some way to make this count directly in shell or do I need to write a program in whatever language to do this specific task?
75317
tail -f x.log   I use this command to see a growing log file in the command prompt.  I am interested only in seeing the log lines that are written to the file after running tail -f and not interested in the logs that were written to the file before doing tail -f. But tail -f command on start, takes the last 10 lines and displays it.  This confuses me, at times if these logs are freshly generated (or) they are old logs?  So, how can i customize tail -f to output only the new entries?
88324
Usually I use tail -f /var/log/messages to get updates if there are new lines.  How to have the similar functionality for journalctl?
54085
I have explored almost    , to no avail.  Let me describe the problem in detail:  I run some unattended scripts and these can produce standard output and standard error lines, I want to capture them in their precise order as displayed by a terminal emulator and then add a prefix like "STDERR: " and "STDOUT: " to them.  I have tried using pipes and even epoll-based approach on them, to no avail. I think solution is in pty usage, although I am no master at that. I have also peeked into the source code of , but that has not been much productive.   Ideally I would use  instead of Bash to accomplish this, but I have not been able to. Seems like pipes automatically forbid keeping a correct lines order because of buffering.  Has somebody been able to do something similar? Or it is just impossible? I think that if a terminal emulator can do it, then it's not - maybe by creating a small C program handling the PTY(s) differently?  Ideally I would use asynchronous input to read these 2 streams (STDOUT and STDERR) and then re-print them second my needs, but order of input is crucial!  NOTE: I am aware of  but it does not work for me with Bash scripts and cannot be easily edited to add a prefix (since it basically wraps plenty of syscalls).  Update: added below two gists       (sub-second random delays can be added in the sample script I provided for a proof of consistent results)  Update: solution to this question would also solve , as @Gilles pointed out. However I have come to the conclusion that it's not possible to do what asked here and there. When using 2&gt;&amp;1 both streams are correctly merged at the pty/pipe level, but to use the streams separately and in correct order one should indeed use the approach of  that involves syscall hooking and can be seen as dirty in many ways.  I will be eager to update this question if somebody can disprove the above.
67627
I want the terminal to output the current upload and download speeds of my network connection. I do not want to monitor the speeds in real time. I just want a "static" value to be able to write it in a file.  How do I achieve it?
27825
I usually use watch Linux utility to watch the output of a command repeatedly every n seconds, like in watch df -h /some_volume/. But I seem not to be able to use watch with a piped series of command like: $ watch ls -ltr|tail -n 1  If I do that, watch is really watching ls -ltr and the output is being passed to tail -n 1 which doesn't output anything. If I try this: $ watch (ls -ltr|tail -n 1)  I get $ watch: syntax error near unexpected token `ls'  And any of the following fails some reason or another: $ watch &lt;(ls -ltr|tail -n 1)  $ watch &lt; &lt;(ls -ltr|tail -n 1)  $ watch $(ls -ltr|tail -n 1)  $ watch `ls -ltr|tail -n 1)`  And finally if do this: $ watch echo $(ls -ltr|tail -n 1)  I see no change in the output at the given interval because the command inside $() is run just once and the resulting output string is always printed (&quot;watched&quot;) as a literal. So, how do I make the watch command work with a piped chain of commands [other that putting them inside a script]?
37002
I'm trying to watch for any new output of a log file. Another script (not under my control) is deleting the file then creating a new one with the same name. Using tail -f doesn't work because the file is being deleted.
44279
I am trying to print every Nth line out of a file with more than 300,000 records into a  new file. This has to happen every Nth record until it reaches the end of the file.
31857
How can I list the number of lines in the files in /group/book/four/word, sorted by the number of lines they contain?   ls -l command lists them down but does not sort them
31561
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 /path/to/file | tail -B   or alternatively  tail -C /path/to/file | head -D   where A,B,C and D can be computed from the number of lines in the file, X and Y.  But there are two problems with this approach:   You have to compute A,B,C and D. The commands could pipe to each other many more lines than I am interested in reading (e.g. if I am reading just a few lines in the middle of a huge file)   Is there a way to have the shell just work with and output the lines I want? (while providing only X and Y)?
34396
I have a poem with an unknown number of rows and I want to display only the penultimate one. What command should I use?
50258
So, when wget gets a web page, it shows you a status bar that indicated how much the file(s) is/are downloaded.  It looks like this:  25%[=============&gt;______________________________________] 25,000 100.0K/s (underscores are spaces; I just couldn't figure out how to get more than one consecutive space in there)  However, instead of writing another line to stdout and adding another progress bar, it updates it, like this:  50%[===========================&gt;________________________] 50,000 100.0K/s  And wget isn't the only example of this, either.  For example, when you pipe something into less and then exit, your original prompt is still there, along with the result of whatever commands that you ran previously.  It's like you never left.  So, my questions are, what is this called, how do I implement it, does it only work for a single line at a time, and can I use this in C?
77993
I have a shell script which uses find -print0 to save a list of files to be processed into a temporary file.  As part of the logging I'd like to output the number of files found, and so I need a way to get that count.  If the -print0 option weren't being used for safety I could use wc -l to get the count.