Hey,

I've seen other people use this feature before but can anyone tell me how (from ssh terminal) I can open a .txt or .log file and watch it get updated live, for example if another application edits it then i won't have to do anything and it will just update on my terminal window?

Thanks,

Kev

Dani AI

Generated

There is indeed a one-word tool for this. As guessed and pointed out, the standard approach is to use the file-follow feature of the system tail utility to stream appended lines in real time. A few practical pointers that often matter in real scenarios:

Log rotation and truncation: a simple follow watches the open file descriptor and can keep pointing at the old (rotated) file. Use the reopen-by-name option (the "follow by name" mode) if you want the watcher to follow the filename across rotates and replacements — this is the behavior you usually want for logs. See the tail manual for details: tail(1) — Linux manual page.

Alternatives and useful workflows: less has a follow mode that lets you pause, scroll back, and then resume follow (handy for inspection). For high-frequency logs, inotify-based tools avoid polling and are more efficient; inotifywait from inotify-tools is a common choice. For viewing multiple logs with color and layout, try multitail. If the SSH session might drop, run the watcher inside tmux or screen so it keeps running on the server. References: less(1), inotify-tools on GitHub, tmux(1).

A couple of quick tips: ’s loop (cat/sleep/clear) works but is just polling and less efficient; prefer built-in follow modes or inotify where available. Check file permissions and whether your distro’s busybox utilities lack advanced flags — installing coreutils can add the full tail feature set.

Common examples (replace with your path):

tail -F /var/log/my-log
less +F /var/log/my-log
inotifywait -m -e modify /var/log/my-log

Recommended Answers

All 5 Replies

#!/bin/sh
while [ 1 ]
do
    cat $1; sleep 1; clear
done

i swear there is a one word command for this...

not snip, not concat but something similar...

tail has a flag that keeps the file open and updates stdout whenever the file is changed. Do something like

$ tail -f [I]/var/log/my-log[/I]

Legend!

Cool. I thought tail just displayed the end of a file...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.