Skip to content

Magenaut

  • Home
  • Topics
    • Notes
    • Tutorial
    • Bug fixing
    • Extension
    • Server
  • Q&A
  • Privacy Policy
  • About

tail

Get last n lines of a file, similar to tail

August 21, 2022 by Magenaut

I’m writing a log file viewer for a web application and for that I want to paginate through the lines of the log file. The items in the file are line based with the newest item at the bottom.

Categories Python, Q&A Tags file, file-io, logfile, python, tail Leave a comment

How can I tail a log file in Python?

August 21, 2022 by Magenaut

I’d like to make the output of tail -F or something similar available to me in Python without blocking or locking. I’ve found some really old code to do that here, but I’m thinking there must be a better way or a library to do the same thing by now. Anyone know of one?

Categories Python, Q&A Tags python, tail Leave a comment

How to implement a pythonic equivalent of tail -F?

August 17, 2022 by Magenaut

What is the pythonic way of watching the tail end of a growing file for the occurrence of certain keywords?

Categories Python, Q&A Tags file, python, tail Leave a comment

Head and tail in one line

August 13, 2022 by Magenaut

Is there a pythonic way to unpack a list in the first element and the “tail” in a single command?

Categories Python, Q&A Tags head, list, python, tail Leave a comment

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

August 11, 2022 by Magenaut

I have a file with many rows, and each row has a timestamp at the starting, like

Categories Q&A, Unix & Linux Tags cat, head, logs, tail, text-processing Leave a comment

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

August 11, 2022 by Magenaut

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).

Categories Q&A, Unix & Linux Tags logs, tail Leave a comment

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

August 11, 2022 by Magenaut

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:

Categories Q&A, Unix & Linux Tags logs, shell-script, tail, text-processing Leave a comment

continuous reading from named pipe (cat or tail -f)

August 10, 2022 by Magenaut

I have configured rsyslog to log certain log events to /dev/xconsole:

Categories Q&A, Unix & Linux Tags cat, fifo, pipe, tail Leave a comment

Output file contents while they change

August 9, 2022 by Magenaut

I want to output a file’s contents while they change, for example if I have the file foobar and I do:

Categories Q&A, Unix & Linux Tags stdout, tail, terminal Leave a comment

Does tail read the whole file?

August 9, 2022 by Magenaut

If I want to tail a 25 GB textfile, does the tail command read the whole file?

Categories Q&A, Unix & Linux Tags tail Leave a comment
Older posts
Page1 Page2 Next →
  1. michealSmith07 on Is there a way to dynamically refresh the less command?August 21, 2022

    That is a very nice post. I like this post.

  2. anonymous on Fix libwacom9 dependency issue when upgrade DebianJune 27, 2022

    saved my day!! Thanks for the help…

  3. sreedhar on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    Thanks its working

  4. saintnick on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    remove libwacom2 worked for me as well

  5. ranafoul on Fix libwacom9 dependency issue when upgrade DebianApril 22, 2022

    apt remove libwacom2 helped on kali 2022.01. gr8

.net ajax asp.net asp.net-core asp.net-mvc asp.net-mvc-3 asp.net-mvc-4 asp.net-web-api bash c# command-line css custom-post-types custom-taxonomy dataframe dictionary django entity-framework functions gridview html iis javascript jquery json linux list matplotlib numpy pandas php plugin-development plugins posts python python-2.7 python-3.x security shell shell-script sql string vb.net webforms wp-query

© 2026 Magenaut • Built with GeneratePress