Is there a way to dynamically refresh the less command? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election Results Why I closed the “Why is Kali so hard” questionHow can I scroll within the output of my watch command?Repeating a text-output terminal command, in a scrollable ncurses-like interface?Is there any way to exit “less” without clearing the screen?watch command to delete files in a directory every N secscan I get the shell to decide ls or less depending on filetype?A terminal that is always scrollable or forever like less?“command | less” vs “less <(command)”less command stuck in forward scrollingHow to open a new terminal window running watch processIs there a way to disable the delay of less +F?Is there a way to get `less` with terminal colors?`less` open editor without immediately triggering a redraw in the terminal
Is it fair for a professor to grade us on the possession of past papers?
Is it cost-effective to upgrade an old-ish Giant Escape R3 commuter bike with entry-level branded parts (wheels, drivetrain)?
Circuit to "zoom in" on mV fluctuations of a DC signal?
Why are the trig functions versine, haversine, exsecant, etc, rarely used in modern mathematics?
Can anything be seen from the center of the Boötes void? How dark would it be?
Where are Serre’s lectures at Collège de France to be found?
What's the meaning of "fortified infraction restraint"?
What is the meaning of the new sigil in Game of Thrones Season 8 intro?
8 Prisoners wearing hats
Delete nth line from bottom
What font is "z" in "z-score"?
Does classifying an integer as a discrete log require it be part of a multiplicative group?
Why do we bend a book to keep it straight?
Generate an RGB colour grid
Around usage results
How do I make this wiring inside cabinet safer? (Pic)
Has negative voting ever been officially implemented in elections, or seriously proposed, or even studied?
What is the meaning of the simile “quick as silk”?
Is CEO the profession with the most psychopaths?
Denied boarding although I have proper visa and documentation. To whom should I make a complaint?
Chinese Seal on silk painting - what does it mean?
How to tell that you are a giant?
What do you call the main part of a joke?
Why are both D and D# fitting into my E minor key?
Is there a way to dynamically refresh the less command?
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
2019 Community Moderator Election Results
Why I closed the “Why is Kali so hard” questionHow can I scroll within the output of my watch command?Repeating a text-output terminal command, in a scrollable ncurses-like interface?Is there any way to exit “less” without clearing the screen?watch command to delete files in a directory every N secscan I get the shell to decide ls or less depending on filetype?A terminal that is always scrollable or forever like less?“command | less” vs “less <(command)”less command stuck in forward scrollingHow to open a new terminal window running watch processIs there a way to disable the delay of less +F?Is there a way to get `less` with terminal colors?`less` open editor without immediately triggering a redraw in the terminal
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I like the watch
command, but it has its limitations.
I'm curious to know whether I could mimic the functionality of watch
with less
. I'm mainly looking for the ability to scroll through my directory as it dynamically gets modified via a running script.
less watch
add a comment |
I like the watch
command, but it has its limitations.
I'm curious to know whether I could mimic the functionality of watch
with less
. I'm mainly looking for the ability to scroll through my directory as it dynamically gets modified via a running script.
less watch
I am looking fortail -f foo.log | grep bar
, and to be able to dynamically change the grep command with restarting the tail/grep pipeline.
– Alexander Mills
Sep 13 '18 at 23:56
add a comment |
I like the watch
command, but it has its limitations.
I'm curious to know whether I could mimic the functionality of watch
with less
. I'm mainly looking for the ability to scroll through my directory as it dynamically gets modified via a running script.
less watch
I like the watch
command, but it has its limitations.
I'm curious to know whether I could mimic the functionality of watch
with less
. I'm mainly looking for the ability to scroll through my directory as it dynamically gets modified via a running script.
less watch
less watch
edited Apr 13 '17 at 12:36
Community♦
1
1
asked Nov 26 '10 at 17:06
ZaidZaid
3,844113033
3,844113033
I am looking fortail -f foo.log | grep bar
, and to be able to dynamically change the grep command with restarting the tail/grep pipeline.
– Alexander Mills
Sep 13 '18 at 23:56
add a comment |
I am looking fortail -f foo.log | grep bar
, and to be able to dynamically change the grep command with restarting the tail/grep pipeline.
– Alexander Mills
Sep 13 '18 at 23:56
I am looking for
tail -f foo.log | grep bar
, and to be able to dynamically change the grep command with restarting the tail/grep pipeline.– Alexander Mills
Sep 13 '18 at 23:56
I am looking for
tail -f foo.log | grep bar
, and to be able to dynamically change the grep command with restarting the tail/grep pipeline.– Alexander Mills
Sep 13 '18 at 23:56
add a comment |
11 Answers
11
active
oldest
votes
In less
, you can type F
to keep reading at the end of a file (like tail -f
); you can type :e
and a file name to view a different file, but unfortunately, if you enter the name of the current file, less
doesn't reload the file. However there's a trick to make it re-read the current file, suggested by sabgenton: type :e
and enter the name of a non-existent file; that causes less to display an error message and then reload the current file.
If you're looking for an alternative to watch ls
, here are a few:
- Modern file managers (e.g. Nautilus, Thunar, Konqueror, Dolphin, Finder) refresh views in real time.
- Emacs doesn't have real-time refresh, but with
auto-revert-mode
, it will reload the file or directory every 5 seconds (the delay is configurable). - Although w3m is primarily a web browser, it makes a passable directory and text file viewer. Press
R
to reload the (local) URL.
6
For me :e randomnamejkdlfjldf fails to load the non-existent filename then reloads back to the current file :D
– sabgenton
Mar 18 '16 at 10:36
1
@sabgenton Thanks, I didn't know that. That's a great trick. I added it to my answer, but you could post it as an answer of your own (which I hope Zaid would accept).
– Gilles
Mar 18 '16 at 16:14
1
@CMCDragonkai No,less +F
only watches for appended content. Use:e nonexistentfile
to re-read completely changed input.
– Gilles
Apr 19 '16 at 11:08
1
Is there a command line flag for that?
– CMCDragonkai
Apr 19 '16 at 11:18
3
@PaulWagland No,R
doesn't reliably refresh the file. It refreshes the screen, and wipes some input buffers, but it doesn't actually reload data from the file in all circumstances (only if the file is large? I didn't dig deeply into the code).
– Gilles
Apr 20 '17 at 9:53
|
show 7 more comments
Shift+F will make less
similar to tailf
. That is, it gets refreshed if more data is appended to the file.
7
Note that this only works for appends. If lines are removed or edited in-place,less
won't show those changes.
– Nathaniel M. Beaver
Nov 30 '16 at 1:26
How do I stop following mode and re-enter scrollable mode?
– Tom Hale
Feb 9 '17 at 12:18
1
<kbd>Ctrl+C</kbd>
– balki
Feb 9 '17 at 20:41
1
balki My experience is that this kills the command piping the data if you are using$COMMAND | less
. I wonder if there is a nice way around this? You can do stuff like$COMMAND > /tmp/file & less /tmp/file
but that's not very nice.
– Att Righ
Jul 27 '18 at 11:13
@AttRigh I never killed my command (however i read logs of running commands this way, i don't pipe into less, technically)
– jena
Jan 11 at 13:48
add a comment |
Simply type:
less +F filename
This emulates pressing "F" within the editor.
1
Thanks; added the aliasalias check="less +F"
to my.bashrc
.
– Luke Davis
Jul 27 '17 at 21:31
add a comment |
man
pages can be very informative. Don't be intimidated by them. Among everything else, man less
says you can use the R
command to:
R Repaint the screen, discarding any buffered input. Useful if the file is changing while it is being viewed.
(I realize this question is over 6 years old, but it comes up on google searches, so I'm not the only one that clicked the link to get here.)
6
This repaints the screen in case it was disrupted by output from another program. It doesn't consistently reload the file. I haven't dug deeply into the code to see what it does, experimentally short files don't get reloaded. I am definitely not intimidated by man pages and I say this description is poorly worded: “repaint” does not convey that input is re-read, and the actual behavior does not quite fit “useful if the file is changing” (maybe it's a bug? I don't know since I don't know what the command is supposed to do)..
– Gilles
Apr 20 '17 at 9:51
I'm no expert, and haven't read less's source code either, but what it does is forget what it already knows about the file & reloads it, refreshing its output based on the input it reloads. The question reads "Is there a way to dynamically refresh the less command?" If I had read the question's explanation more thoroughly before answering, I might not have answered, since they go on to say they want "to scroll through my directory as it dynamically gets modified via a running script." less wouldn't be the right command for that.
– destenson
Apr 21 '17 at 3:58
Works fine for me, even when using files 3 bytes long. I can't imagine why it wouldn't work for larger files too.
– Addison
Mar 22 '18 at 3:51
1
Great! For me it works for both short and long files. I just noticed two possible problems: 1.less
did not reopen the file using its filename - i.e. when the inode of the file changed (like in overwriting the file usingmv
) then the old file content stayed (probably the old inode was reread) --- 2. The first displayed line probably starts at the same byte offset as in the original file content. So when the line lengths change the first displayed line could be incomplete and the displayed lines could move up / down.
– pabouk
Sep 13 '18 at 11:27
R
doesn't always work. See unix.stackexchange.com/questions/4351/…
– wisbucky
10 hours ago
add a comment |
The "F" key when running less
will do a "follow" similar to tail -f
, but I'm not sure if that will achieve what you're looking for here.
add a comment |
I normally just type G to tail the output on a one-time basis. I find it especially helpful over a a network file system like CIFS.
This is more of an on-demand refresh of the file opened with less. In addition to jumping to the end of the file, it also reloads the file if it has changed.
– jorb
Jun 6 '17 at 13:23
1
Thanks. First time it didn't refresh for me, but now it seems to work properly. In the man it's not written that it refreshes the file.man less
: 'G or > or ESC-> Go to line N in the file, default the end of the file.' I delete my old wrong comments here, sorry for them.
– Yaroslav Nikitenko
Jun 8 '17 at 13:56
1
BTW, what do you call a 'one-time basis'? The maintainer ofless
, Mark Nudelman, replied the following: "The G command does not normally force a re-read of the file like the R command does. It may seem do that if the end of the file has not yet been read when G is invoked, so that jumping to the end of the file must read the data there for the first time. For example, if you jump to the end with G, then jump back to the beginning with 1G, then another program modifies the data at the end of the file (without changing the length), " (cont)
– Yaroslav Nikitenko
Jun 12 '17 at 20:14
(cont) "then you jump to the end again with G, you will not see the modified data. But if you don't jump to the end and back to the beginning, then the first time you execute the G command it must read the data there for the first time, and of course it will see any modifications that have happened since less was first invoked. "
– Yaroslav Nikitenko
Jun 12 '17 at 20:14
In this case I mentioned it being a one-time refresh as opposed to a dynamic refresh, which is part of what the original question is asking.
– jorb
Jun 12 '17 at 20:31
add a comment |
You can use vim to read the file then add the following mapping to your .vimrc
file and you can easily reload a file with ,r:
let mapleader = ","
nnoremap <leader>r :edit <CR>
Note if you edited the file already, vim will complain. Just change to
let mapleader = ","
nnoremap <leader>r :edit! <CR>
To ignore changes.
They'll have to pryvim
from your cold, dead hands. The context of the question is aboutless
, but as someone with monomaniacal tendencies myself, I sympathise!
– Benjamin R
Oct 26 '18 at 16:05
add a comment |
R
for repaint does not always reload the file.[1]
A workaround that always reloads the file is to press hq
, which will open the Help page, then quit. It has a side effect of forcing the file to reload.
[1] Here are some examples of situations that R
do and do not reload:
>
and>>
changes: DO get reloadedsed -i
, gEdit, TextEdit: DO NOT get reloaded- On Linux,
vi
changes: DO get reloaded - On Mac,
vi
changes: DO NOT get reloaded
I believe the difference comes down to whether the inode changes (you can check with ls -i foo.txt
). If the inode changes, then R
will not work.
add a comment |
You could pipe it to tail -f
instead, it would result in you following the output. You'd be losing the ability to move (scroll) through your output though.
add a comment |
If you're not averse to using a browser you could launch the Algernon web server with this command:
algernon -a -t /directory/name
A list of files will then be displayed, and auto-refreshed, at http://localhost:3000/
Wrong thread?..
– Tomasz
Jun 5 '17 at 23:45
It seems to be a way to watch a directory, although it's a long way fromless
– Jeff Schaller♦
Jun 6 '17 at 0:17
add a comment |
I just found this thread like anyone else.
I would like to add the solution of when you are already at the end of the file, using 'g' followed by 'G' will force a refresh of the file.
I ended up making a macro button for this in my terminal program (SecureCRT).
The macro is simply 'gG'.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f4351%2fis-there-a-way-to-dynamically-refresh-the-less-command%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
11 Answers
11
active
oldest
votes
11 Answers
11
active
oldest
votes
active
oldest
votes
active
oldest
votes
In less
, you can type F
to keep reading at the end of a file (like tail -f
); you can type :e
and a file name to view a different file, but unfortunately, if you enter the name of the current file, less
doesn't reload the file. However there's a trick to make it re-read the current file, suggested by sabgenton: type :e
and enter the name of a non-existent file; that causes less to display an error message and then reload the current file.
If you're looking for an alternative to watch ls
, here are a few:
- Modern file managers (e.g. Nautilus, Thunar, Konqueror, Dolphin, Finder) refresh views in real time.
- Emacs doesn't have real-time refresh, but with
auto-revert-mode
, it will reload the file or directory every 5 seconds (the delay is configurable). - Although w3m is primarily a web browser, it makes a passable directory and text file viewer. Press
R
to reload the (local) URL.
6
For me :e randomnamejkdlfjldf fails to load the non-existent filename then reloads back to the current file :D
– sabgenton
Mar 18 '16 at 10:36
1
@sabgenton Thanks, I didn't know that. That's a great trick. I added it to my answer, but you could post it as an answer of your own (which I hope Zaid would accept).
– Gilles
Mar 18 '16 at 16:14
1
@CMCDragonkai No,less +F
only watches for appended content. Use:e nonexistentfile
to re-read completely changed input.
– Gilles
Apr 19 '16 at 11:08
1
Is there a command line flag for that?
– CMCDragonkai
Apr 19 '16 at 11:18
3
@PaulWagland No,R
doesn't reliably refresh the file. It refreshes the screen, and wipes some input buffers, but it doesn't actually reload data from the file in all circumstances (only if the file is large? I didn't dig deeply into the code).
– Gilles
Apr 20 '17 at 9:53
|
show 7 more comments
In less
, you can type F
to keep reading at the end of a file (like tail -f
); you can type :e
and a file name to view a different file, but unfortunately, if you enter the name of the current file, less
doesn't reload the file. However there's a trick to make it re-read the current file, suggested by sabgenton: type :e
and enter the name of a non-existent file; that causes less to display an error message and then reload the current file.
If you're looking for an alternative to watch ls
, here are a few:
- Modern file managers (e.g. Nautilus, Thunar, Konqueror, Dolphin, Finder) refresh views in real time.
- Emacs doesn't have real-time refresh, but with
auto-revert-mode
, it will reload the file or directory every 5 seconds (the delay is configurable). - Although w3m is primarily a web browser, it makes a passable directory and text file viewer. Press
R
to reload the (local) URL.
6
For me :e randomnamejkdlfjldf fails to load the non-existent filename then reloads back to the current file :D
– sabgenton
Mar 18 '16 at 10:36
1
@sabgenton Thanks, I didn't know that. That's a great trick. I added it to my answer, but you could post it as an answer of your own (which I hope Zaid would accept).
– Gilles
Mar 18 '16 at 16:14
1
@CMCDragonkai No,less +F
only watches for appended content. Use:e nonexistentfile
to re-read completely changed input.
– Gilles
Apr 19 '16 at 11:08
1
Is there a command line flag for that?
– CMCDragonkai
Apr 19 '16 at 11:18
3
@PaulWagland No,R
doesn't reliably refresh the file. It refreshes the screen, and wipes some input buffers, but it doesn't actually reload data from the file in all circumstances (only if the file is large? I didn't dig deeply into the code).
– Gilles
Apr 20 '17 at 9:53
|
show 7 more comments
In less
, you can type F
to keep reading at the end of a file (like tail -f
); you can type :e
and a file name to view a different file, but unfortunately, if you enter the name of the current file, less
doesn't reload the file. However there's a trick to make it re-read the current file, suggested by sabgenton: type :e
and enter the name of a non-existent file; that causes less to display an error message and then reload the current file.
If you're looking for an alternative to watch ls
, here are a few:
- Modern file managers (e.g. Nautilus, Thunar, Konqueror, Dolphin, Finder) refresh views in real time.
- Emacs doesn't have real-time refresh, but with
auto-revert-mode
, it will reload the file or directory every 5 seconds (the delay is configurable). - Although w3m is primarily a web browser, it makes a passable directory and text file viewer. Press
R
to reload the (local) URL.
In less
, you can type F
to keep reading at the end of a file (like tail -f
); you can type :e
and a file name to view a different file, but unfortunately, if you enter the name of the current file, less
doesn't reload the file. However there's a trick to make it re-read the current file, suggested by sabgenton: type :e
and enter the name of a non-existent file; that causes less to display an error message and then reload the current file.
If you're looking for an alternative to watch ls
, here are a few:
- Modern file managers (e.g. Nautilus, Thunar, Konqueror, Dolphin, Finder) refresh views in real time.
- Emacs doesn't have real-time refresh, but with
auto-revert-mode
, it will reload the file or directory every 5 seconds (the delay is configurable). - Although w3m is primarily a web browser, it makes a passable directory and text file viewer. Press
R
to reload the (local) URL.
edited Apr 13 '17 at 12:36
Community♦
1
1
answered Nov 26 '10 at 21:29
GillesGilles
548k13011151631
548k13011151631
6
For me :e randomnamejkdlfjldf fails to load the non-existent filename then reloads back to the current file :D
– sabgenton
Mar 18 '16 at 10:36
1
@sabgenton Thanks, I didn't know that. That's a great trick. I added it to my answer, but you could post it as an answer of your own (which I hope Zaid would accept).
– Gilles
Mar 18 '16 at 16:14
1
@CMCDragonkai No,less +F
only watches for appended content. Use:e nonexistentfile
to re-read completely changed input.
– Gilles
Apr 19 '16 at 11:08
1
Is there a command line flag for that?
– CMCDragonkai
Apr 19 '16 at 11:18
3
@PaulWagland No,R
doesn't reliably refresh the file. It refreshes the screen, and wipes some input buffers, but it doesn't actually reload data from the file in all circumstances (only if the file is large? I didn't dig deeply into the code).
– Gilles
Apr 20 '17 at 9:53
|
show 7 more comments
6
For me :e randomnamejkdlfjldf fails to load the non-existent filename then reloads back to the current file :D
– sabgenton
Mar 18 '16 at 10:36
1
@sabgenton Thanks, I didn't know that. That's a great trick. I added it to my answer, but you could post it as an answer of your own (which I hope Zaid would accept).
– Gilles
Mar 18 '16 at 16:14
1
@CMCDragonkai No,less +F
only watches for appended content. Use:e nonexistentfile
to re-read completely changed input.
– Gilles
Apr 19 '16 at 11:08
1
Is there a command line flag for that?
– CMCDragonkai
Apr 19 '16 at 11:18
3
@PaulWagland No,R
doesn't reliably refresh the file. It refreshes the screen, and wipes some input buffers, but it doesn't actually reload data from the file in all circumstances (only if the file is large? I didn't dig deeply into the code).
– Gilles
Apr 20 '17 at 9:53
6
6
For me :e randomnamejkdlfjldf fails to load the non-existent filename then reloads back to the current file :D
– sabgenton
Mar 18 '16 at 10:36
For me :e randomnamejkdlfjldf fails to load the non-existent filename then reloads back to the current file :D
– sabgenton
Mar 18 '16 at 10:36
1
1
@sabgenton Thanks, I didn't know that. That's a great trick. I added it to my answer, but you could post it as an answer of your own (which I hope Zaid would accept).
– Gilles
Mar 18 '16 at 16:14
@sabgenton Thanks, I didn't know that. That's a great trick. I added it to my answer, but you could post it as an answer of your own (which I hope Zaid would accept).
– Gilles
Mar 18 '16 at 16:14
1
1
@CMCDragonkai No,
less +F
only watches for appended content. Use :e nonexistentfile
to re-read completely changed input.– Gilles
Apr 19 '16 at 11:08
@CMCDragonkai No,
less +F
only watches for appended content. Use :e nonexistentfile
to re-read completely changed input.– Gilles
Apr 19 '16 at 11:08
1
1
Is there a command line flag for that?
– CMCDragonkai
Apr 19 '16 at 11:18
Is there a command line flag for that?
– CMCDragonkai
Apr 19 '16 at 11:18
3
3
@PaulWagland No,
R
doesn't reliably refresh the file. It refreshes the screen, and wipes some input buffers, but it doesn't actually reload data from the file in all circumstances (only if the file is large? I didn't dig deeply into the code).– Gilles
Apr 20 '17 at 9:53
@PaulWagland No,
R
doesn't reliably refresh the file. It refreshes the screen, and wipes some input buffers, but it doesn't actually reload data from the file in all circumstances (only if the file is large? I didn't dig deeply into the code).– Gilles
Apr 20 '17 at 9:53
|
show 7 more comments
Shift+F will make less
similar to tailf
. That is, it gets refreshed if more data is appended to the file.
7
Note that this only works for appends. If lines are removed or edited in-place,less
won't show those changes.
– Nathaniel M. Beaver
Nov 30 '16 at 1:26
How do I stop following mode and re-enter scrollable mode?
– Tom Hale
Feb 9 '17 at 12:18
1
<kbd>Ctrl+C</kbd>
– balki
Feb 9 '17 at 20:41
1
balki My experience is that this kills the command piping the data if you are using$COMMAND | less
. I wonder if there is a nice way around this? You can do stuff like$COMMAND > /tmp/file & less /tmp/file
but that's not very nice.
– Att Righ
Jul 27 '18 at 11:13
@AttRigh I never killed my command (however i read logs of running commands this way, i don't pipe into less, technically)
– jena
Jan 11 at 13:48
add a comment |
Shift+F will make less
similar to tailf
. That is, it gets refreshed if more data is appended to the file.
7
Note that this only works for appends. If lines are removed or edited in-place,less
won't show those changes.
– Nathaniel M. Beaver
Nov 30 '16 at 1:26
How do I stop following mode and re-enter scrollable mode?
– Tom Hale
Feb 9 '17 at 12:18
1
<kbd>Ctrl+C</kbd>
– balki
Feb 9 '17 at 20:41
1
balki My experience is that this kills the command piping the data if you are using$COMMAND | less
. I wonder if there is a nice way around this? You can do stuff like$COMMAND > /tmp/file & less /tmp/file
but that's not very nice.
– Att Righ
Jul 27 '18 at 11:13
@AttRigh I never killed my command (however i read logs of running commands this way, i don't pipe into less, technically)
– jena
Jan 11 at 13:48
add a comment |
Shift+F will make less
similar to tailf
. That is, it gets refreshed if more data is appended to the file.
Shift+F will make less
similar to tailf
. That is, it gets refreshed if more data is appended to the file.
edited Nov 29 '10 at 4:05
Michael Mrozek♦
62.5k29194214
62.5k29194214
answered Nov 26 '10 at 17:59
balkibalki
2,13842037
2,13842037
7
Note that this only works for appends. If lines are removed or edited in-place,less
won't show those changes.
– Nathaniel M. Beaver
Nov 30 '16 at 1:26
How do I stop following mode and re-enter scrollable mode?
– Tom Hale
Feb 9 '17 at 12:18
1
<kbd>Ctrl+C</kbd>
– balki
Feb 9 '17 at 20:41
1
balki My experience is that this kills the command piping the data if you are using$COMMAND | less
. I wonder if there is a nice way around this? You can do stuff like$COMMAND > /tmp/file & less /tmp/file
but that's not very nice.
– Att Righ
Jul 27 '18 at 11:13
@AttRigh I never killed my command (however i read logs of running commands this way, i don't pipe into less, technically)
– jena
Jan 11 at 13:48
add a comment |
7
Note that this only works for appends. If lines are removed or edited in-place,less
won't show those changes.
– Nathaniel M. Beaver
Nov 30 '16 at 1:26
How do I stop following mode and re-enter scrollable mode?
– Tom Hale
Feb 9 '17 at 12:18
1
<kbd>Ctrl+C</kbd>
– balki
Feb 9 '17 at 20:41
1
balki My experience is that this kills the command piping the data if you are using$COMMAND | less
. I wonder if there is a nice way around this? You can do stuff like$COMMAND > /tmp/file & less /tmp/file
but that's not very nice.
– Att Righ
Jul 27 '18 at 11:13
@AttRigh I never killed my command (however i read logs of running commands this way, i don't pipe into less, technically)
– jena
Jan 11 at 13:48
7
7
Note that this only works for appends. If lines are removed or edited in-place,
less
won't show those changes.– Nathaniel M. Beaver
Nov 30 '16 at 1:26
Note that this only works for appends. If lines are removed or edited in-place,
less
won't show those changes.– Nathaniel M. Beaver
Nov 30 '16 at 1:26
How do I stop following mode and re-enter scrollable mode?
– Tom Hale
Feb 9 '17 at 12:18
How do I stop following mode and re-enter scrollable mode?
– Tom Hale
Feb 9 '17 at 12:18
1
1
<kbd>Ctrl+C</kbd>
– balki
Feb 9 '17 at 20:41
<kbd>Ctrl+C</kbd>
– balki
Feb 9 '17 at 20:41
1
1
balki My experience is that this kills the command piping the data if you are using
$COMMAND | less
. I wonder if there is a nice way around this? You can do stuff like $COMMAND > /tmp/file & less /tmp/file
but that's not very nice.– Att Righ
Jul 27 '18 at 11:13
balki My experience is that this kills the command piping the data if you are using
$COMMAND | less
. I wonder if there is a nice way around this? You can do stuff like $COMMAND > /tmp/file & less /tmp/file
but that's not very nice.– Att Righ
Jul 27 '18 at 11:13
@AttRigh I never killed my command (however i read logs of running commands this way, i don't pipe into less, technically)
– jena
Jan 11 at 13:48
@AttRigh I never killed my command (however i read logs of running commands this way, i don't pipe into less, technically)
– jena
Jan 11 at 13:48
add a comment |
Simply type:
less +F filename
This emulates pressing "F" within the editor.
1
Thanks; added the aliasalias check="less +F"
to my.bashrc
.
– Luke Davis
Jul 27 '17 at 21:31
add a comment |
Simply type:
less +F filename
This emulates pressing "F" within the editor.
1
Thanks; added the aliasalias check="less +F"
to my.bashrc
.
– Luke Davis
Jul 27 '17 at 21:31
add a comment |
Simply type:
less +F filename
This emulates pressing "F" within the editor.
Simply type:
less +F filename
This emulates pressing "F" within the editor.
answered Jun 21 '12 at 13:58
jhclarkjhclark
49944
49944
1
Thanks; added the aliasalias check="less +F"
to my.bashrc
.
– Luke Davis
Jul 27 '17 at 21:31
add a comment |
1
Thanks; added the aliasalias check="less +F"
to my.bashrc
.
– Luke Davis
Jul 27 '17 at 21:31
1
1
Thanks; added the alias
alias check="less +F"
to my .bashrc
.– Luke Davis
Jul 27 '17 at 21:31
Thanks; added the alias
alias check="less +F"
to my .bashrc
.– Luke Davis
Jul 27 '17 at 21:31
add a comment |
man
pages can be very informative. Don't be intimidated by them. Among everything else, man less
says you can use the R
command to:
R Repaint the screen, discarding any buffered input. Useful if the file is changing while it is being viewed.
(I realize this question is over 6 years old, but it comes up on google searches, so I'm not the only one that clicked the link to get here.)
6
This repaints the screen in case it was disrupted by output from another program. It doesn't consistently reload the file. I haven't dug deeply into the code to see what it does, experimentally short files don't get reloaded. I am definitely not intimidated by man pages and I say this description is poorly worded: “repaint” does not convey that input is re-read, and the actual behavior does not quite fit “useful if the file is changing” (maybe it's a bug? I don't know since I don't know what the command is supposed to do)..
– Gilles
Apr 20 '17 at 9:51
I'm no expert, and haven't read less's source code either, but what it does is forget what it already knows about the file & reloads it, refreshing its output based on the input it reloads. The question reads "Is there a way to dynamically refresh the less command?" If I had read the question's explanation more thoroughly before answering, I might not have answered, since they go on to say they want "to scroll through my directory as it dynamically gets modified via a running script." less wouldn't be the right command for that.
– destenson
Apr 21 '17 at 3:58
Works fine for me, even when using files 3 bytes long. I can't imagine why it wouldn't work for larger files too.
– Addison
Mar 22 '18 at 3:51
1
Great! For me it works for both short and long files. I just noticed two possible problems: 1.less
did not reopen the file using its filename - i.e. when the inode of the file changed (like in overwriting the file usingmv
) then the old file content stayed (probably the old inode was reread) --- 2. The first displayed line probably starts at the same byte offset as in the original file content. So when the line lengths change the first displayed line could be incomplete and the displayed lines could move up / down.
– pabouk
Sep 13 '18 at 11:27
R
doesn't always work. See unix.stackexchange.com/questions/4351/…
– wisbucky
10 hours ago
add a comment |
man
pages can be very informative. Don't be intimidated by them. Among everything else, man less
says you can use the R
command to:
R Repaint the screen, discarding any buffered input. Useful if the file is changing while it is being viewed.
(I realize this question is over 6 years old, but it comes up on google searches, so I'm not the only one that clicked the link to get here.)
6
This repaints the screen in case it was disrupted by output from another program. It doesn't consistently reload the file. I haven't dug deeply into the code to see what it does, experimentally short files don't get reloaded. I am definitely not intimidated by man pages and I say this description is poorly worded: “repaint” does not convey that input is re-read, and the actual behavior does not quite fit “useful if the file is changing” (maybe it's a bug? I don't know since I don't know what the command is supposed to do)..
– Gilles
Apr 20 '17 at 9:51
I'm no expert, and haven't read less's source code either, but what it does is forget what it already knows about the file & reloads it, refreshing its output based on the input it reloads. The question reads "Is there a way to dynamically refresh the less command?" If I had read the question's explanation more thoroughly before answering, I might not have answered, since they go on to say they want "to scroll through my directory as it dynamically gets modified via a running script." less wouldn't be the right command for that.
– destenson
Apr 21 '17 at 3:58
Works fine for me, even when using files 3 bytes long. I can't imagine why it wouldn't work for larger files too.
– Addison
Mar 22 '18 at 3:51
1
Great! For me it works for both short and long files. I just noticed two possible problems: 1.less
did not reopen the file using its filename - i.e. when the inode of the file changed (like in overwriting the file usingmv
) then the old file content stayed (probably the old inode was reread) --- 2. The first displayed line probably starts at the same byte offset as in the original file content. So when the line lengths change the first displayed line could be incomplete and the displayed lines could move up / down.
– pabouk
Sep 13 '18 at 11:27
R
doesn't always work. See unix.stackexchange.com/questions/4351/…
– wisbucky
10 hours ago
add a comment |
man
pages can be very informative. Don't be intimidated by them. Among everything else, man less
says you can use the R
command to:
R Repaint the screen, discarding any buffered input. Useful if the file is changing while it is being viewed.
(I realize this question is over 6 years old, but it comes up on google searches, so I'm not the only one that clicked the link to get here.)
man
pages can be very informative. Don't be intimidated by them. Among everything else, man less
says you can use the R
command to:
R Repaint the screen, discarding any buffered input. Useful if the file is changing while it is being viewed.
(I realize this question is over 6 years old, but it comes up on google searches, so I'm not the only one that clicked the link to get here.)
answered Dec 13 '16 at 8:32
destensondestenson
30923
30923
6
This repaints the screen in case it was disrupted by output from another program. It doesn't consistently reload the file. I haven't dug deeply into the code to see what it does, experimentally short files don't get reloaded. I am definitely not intimidated by man pages and I say this description is poorly worded: “repaint” does not convey that input is re-read, and the actual behavior does not quite fit “useful if the file is changing” (maybe it's a bug? I don't know since I don't know what the command is supposed to do)..
– Gilles
Apr 20 '17 at 9:51
I'm no expert, and haven't read less's source code either, but what it does is forget what it already knows about the file & reloads it, refreshing its output based on the input it reloads. The question reads "Is there a way to dynamically refresh the less command?" If I had read the question's explanation more thoroughly before answering, I might not have answered, since they go on to say they want "to scroll through my directory as it dynamically gets modified via a running script." less wouldn't be the right command for that.
– destenson
Apr 21 '17 at 3:58
Works fine for me, even when using files 3 bytes long. I can't imagine why it wouldn't work for larger files too.
– Addison
Mar 22 '18 at 3:51
1
Great! For me it works for both short and long files. I just noticed two possible problems: 1.less
did not reopen the file using its filename - i.e. when the inode of the file changed (like in overwriting the file usingmv
) then the old file content stayed (probably the old inode was reread) --- 2. The first displayed line probably starts at the same byte offset as in the original file content. So when the line lengths change the first displayed line could be incomplete and the displayed lines could move up / down.
– pabouk
Sep 13 '18 at 11:27
R
doesn't always work. See unix.stackexchange.com/questions/4351/…
– wisbucky
10 hours ago
add a comment |
6
This repaints the screen in case it was disrupted by output from another program. It doesn't consistently reload the file. I haven't dug deeply into the code to see what it does, experimentally short files don't get reloaded. I am definitely not intimidated by man pages and I say this description is poorly worded: “repaint” does not convey that input is re-read, and the actual behavior does not quite fit “useful if the file is changing” (maybe it's a bug? I don't know since I don't know what the command is supposed to do)..
– Gilles
Apr 20 '17 at 9:51
I'm no expert, and haven't read less's source code either, but what it does is forget what it already knows about the file & reloads it, refreshing its output based on the input it reloads. The question reads "Is there a way to dynamically refresh the less command?" If I had read the question's explanation more thoroughly before answering, I might not have answered, since they go on to say they want "to scroll through my directory as it dynamically gets modified via a running script." less wouldn't be the right command for that.
– destenson
Apr 21 '17 at 3:58
Works fine for me, even when using files 3 bytes long. I can't imagine why it wouldn't work for larger files too.
– Addison
Mar 22 '18 at 3:51
1
Great! For me it works for both short and long files. I just noticed two possible problems: 1.less
did not reopen the file using its filename - i.e. when the inode of the file changed (like in overwriting the file usingmv
) then the old file content stayed (probably the old inode was reread) --- 2. The first displayed line probably starts at the same byte offset as in the original file content. So when the line lengths change the first displayed line could be incomplete and the displayed lines could move up / down.
– pabouk
Sep 13 '18 at 11:27
R
doesn't always work. See unix.stackexchange.com/questions/4351/…
– wisbucky
10 hours ago
6
6
This repaints the screen in case it was disrupted by output from another program. It doesn't consistently reload the file. I haven't dug deeply into the code to see what it does, experimentally short files don't get reloaded. I am definitely not intimidated by man pages and I say this description is poorly worded: “repaint” does not convey that input is re-read, and the actual behavior does not quite fit “useful if the file is changing” (maybe it's a bug? I don't know since I don't know what the command is supposed to do)..
– Gilles
Apr 20 '17 at 9:51
This repaints the screen in case it was disrupted by output from another program. It doesn't consistently reload the file. I haven't dug deeply into the code to see what it does, experimentally short files don't get reloaded. I am definitely not intimidated by man pages and I say this description is poorly worded: “repaint” does not convey that input is re-read, and the actual behavior does not quite fit “useful if the file is changing” (maybe it's a bug? I don't know since I don't know what the command is supposed to do)..
– Gilles
Apr 20 '17 at 9:51
I'm no expert, and haven't read less's source code either, but what it does is forget what it already knows about the file & reloads it, refreshing its output based on the input it reloads. The question reads "Is there a way to dynamically refresh the less command?" If I had read the question's explanation more thoroughly before answering, I might not have answered, since they go on to say they want "to scroll through my directory as it dynamically gets modified via a running script." less wouldn't be the right command for that.
– destenson
Apr 21 '17 at 3:58
I'm no expert, and haven't read less's source code either, but what it does is forget what it already knows about the file & reloads it, refreshing its output based on the input it reloads. The question reads "Is there a way to dynamically refresh the less command?" If I had read the question's explanation more thoroughly before answering, I might not have answered, since they go on to say they want "to scroll through my directory as it dynamically gets modified via a running script." less wouldn't be the right command for that.
– destenson
Apr 21 '17 at 3:58
Works fine for me, even when using files 3 bytes long. I can't imagine why it wouldn't work for larger files too.
– Addison
Mar 22 '18 at 3:51
Works fine for me, even when using files 3 bytes long. I can't imagine why it wouldn't work for larger files too.
– Addison
Mar 22 '18 at 3:51
1
1
Great! For me it works for both short and long files. I just noticed two possible problems: 1.
less
did not reopen the file using its filename - i.e. when the inode of the file changed (like in overwriting the file using mv
) then the old file content stayed (probably the old inode was reread) --- 2. The first displayed line probably starts at the same byte offset as in the original file content. So when the line lengths change the first displayed line could be incomplete and the displayed lines could move up / down.– pabouk
Sep 13 '18 at 11:27
Great! For me it works for both short and long files. I just noticed two possible problems: 1.
less
did not reopen the file using its filename - i.e. when the inode of the file changed (like in overwriting the file using mv
) then the old file content stayed (probably the old inode was reread) --- 2. The first displayed line probably starts at the same byte offset as in the original file content. So when the line lengths change the first displayed line could be incomplete and the displayed lines could move up / down.– pabouk
Sep 13 '18 at 11:27
R
doesn't always work. See unix.stackexchange.com/questions/4351/…– wisbucky
10 hours ago
R
doesn't always work. See unix.stackexchange.com/questions/4351/…– wisbucky
10 hours ago
add a comment |
The "F" key when running less
will do a "follow" similar to tail -f
, but I'm not sure if that will achieve what you're looking for here.
add a comment |
The "F" key when running less
will do a "follow" similar to tail -f
, but I'm not sure if that will achieve what you're looking for here.
add a comment |
The "F" key when running less
will do a "follow" similar to tail -f
, but I'm not sure if that will achieve what you're looking for here.
The "F" key when running less
will do a "follow" similar to tail -f
, but I'm not sure if that will achieve what you're looking for here.
answered Nov 26 '10 at 17:21
Dave JenningsDave Jennings
21914
21914
add a comment |
add a comment |
I normally just type G to tail the output on a one-time basis. I find it especially helpful over a a network file system like CIFS.
This is more of an on-demand refresh of the file opened with less. In addition to jumping to the end of the file, it also reloads the file if it has changed.
– jorb
Jun 6 '17 at 13:23
1
Thanks. First time it didn't refresh for me, but now it seems to work properly. In the man it's not written that it refreshes the file.man less
: 'G or > or ESC-> Go to line N in the file, default the end of the file.' I delete my old wrong comments here, sorry for them.
– Yaroslav Nikitenko
Jun 8 '17 at 13:56
1
BTW, what do you call a 'one-time basis'? The maintainer ofless
, Mark Nudelman, replied the following: "The G command does not normally force a re-read of the file like the R command does. It may seem do that if the end of the file has not yet been read when G is invoked, so that jumping to the end of the file must read the data there for the first time. For example, if you jump to the end with G, then jump back to the beginning with 1G, then another program modifies the data at the end of the file (without changing the length), " (cont)
– Yaroslav Nikitenko
Jun 12 '17 at 20:14
(cont) "then you jump to the end again with G, you will not see the modified data. But if you don't jump to the end and back to the beginning, then the first time you execute the G command it must read the data there for the first time, and of course it will see any modifications that have happened since less was first invoked. "
– Yaroslav Nikitenko
Jun 12 '17 at 20:14
In this case I mentioned it being a one-time refresh as opposed to a dynamic refresh, which is part of what the original question is asking.
– jorb
Jun 12 '17 at 20:31
add a comment |
I normally just type G to tail the output on a one-time basis. I find it especially helpful over a a network file system like CIFS.
This is more of an on-demand refresh of the file opened with less. In addition to jumping to the end of the file, it also reloads the file if it has changed.
– jorb
Jun 6 '17 at 13:23
1
Thanks. First time it didn't refresh for me, but now it seems to work properly. In the man it's not written that it refreshes the file.man less
: 'G or > or ESC-> Go to line N in the file, default the end of the file.' I delete my old wrong comments here, sorry for them.
– Yaroslav Nikitenko
Jun 8 '17 at 13:56
1
BTW, what do you call a 'one-time basis'? The maintainer ofless
, Mark Nudelman, replied the following: "The G command does not normally force a re-read of the file like the R command does. It may seem do that if the end of the file has not yet been read when G is invoked, so that jumping to the end of the file must read the data there for the first time. For example, if you jump to the end with G, then jump back to the beginning with 1G, then another program modifies the data at the end of the file (without changing the length), " (cont)
– Yaroslav Nikitenko
Jun 12 '17 at 20:14
(cont) "then you jump to the end again with G, you will not see the modified data. But if you don't jump to the end and back to the beginning, then the first time you execute the G command it must read the data there for the first time, and of course it will see any modifications that have happened since less was first invoked. "
– Yaroslav Nikitenko
Jun 12 '17 at 20:14
In this case I mentioned it being a one-time refresh as opposed to a dynamic refresh, which is part of what the original question is asking.
– jorb
Jun 12 '17 at 20:31
add a comment |
I normally just type G to tail the output on a one-time basis. I find it especially helpful over a a network file system like CIFS.
I normally just type G to tail the output on a one-time basis. I find it especially helpful over a a network file system like CIFS.
edited Jun 5 '17 at 19:53
answered May 1 '12 at 22:42
jorbjorb
7816
7816
This is more of an on-demand refresh of the file opened with less. In addition to jumping to the end of the file, it also reloads the file if it has changed.
– jorb
Jun 6 '17 at 13:23
1
Thanks. First time it didn't refresh for me, but now it seems to work properly. In the man it's not written that it refreshes the file.man less
: 'G or > or ESC-> Go to line N in the file, default the end of the file.' I delete my old wrong comments here, sorry for them.
– Yaroslav Nikitenko
Jun 8 '17 at 13:56
1
BTW, what do you call a 'one-time basis'? The maintainer ofless
, Mark Nudelman, replied the following: "The G command does not normally force a re-read of the file like the R command does. It may seem do that if the end of the file has not yet been read when G is invoked, so that jumping to the end of the file must read the data there for the first time. For example, if you jump to the end with G, then jump back to the beginning with 1G, then another program modifies the data at the end of the file (without changing the length), " (cont)
– Yaroslav Nikitenko
Jun 12 '17 at 20:14
(cont) "then you jump to the end again with G, you will not see the modified data. But if you don't jump to the end and back to the beginning, then the first time you execute the G command it must read the data there for the first time, and of course it will see any modifications that have happened since less was first invoked. "
– Yaroslav Nikitenko
Jun 12 '17 at 20:14
In this case I mentioned it being a one-time refresh as opposed to a dynamic refresh, which is part of what the original question is asking.
– jorb
Jun 12 '17 at 20:31
add a comment |
This is more of an on-demand refresh of the file opened with less. In addition to jumping to the end of the file, it also reloads the file if it has changed.
– jorb
Jun 6 '17 at 13:23
1
Thanks. First time it didn't refresh for me, but now it seems to work properly. In the man it's not written that it refreshes the file.man less
: 'G or > or ESC-> Go to line N in the file, default the end of the file.' I delete my old wrong comments here, sorry for them.
– Yaroslav Nikitenko
Jun 8 '17 at 13:56
1
BTW, what do you call a 'one-time basis'? The maintainer ofless
, Mark Nudelman, replied the following: "The G command does not normally force a re-read of the file like the R command does. It may seem do that if the end of the file has not yet been read when G is invoked, so that jumping to the end of the file must read the data there for the first time. For example, if you jump to the end with G, then jump back to the beginning with 1G, then another program modifies the data at the end of the file (without changing the length), " (cont)
– Yaroslav Nikitenko
Jun 12 '17 at 20:14
(cont) "then you jump to the end again with G, you will not see the modified data. But if you don't jump to the end and back to the beginning, then the first time you execute the G command it must read the data there for the first time, and of course it will see any modifications that have happened since less was first invoked. "
– Yaroslav Nikitenko
Jun 12 '17 at 20:14
In this case I mentioned it being a one-time refresh as opposed to a dynamic refresh, which is part of what the original question is asking.
– jorb
Jun 12 '17 at 20:31
This is more of an on-demand refresh of the file opened with less. In addition to jumping to the end of the file, it also reloads the file if it has changed.
– jorb
Jun 6 '17 at 13:23
This is more of an on-demand refresh of the file opened with less. In addition to jumping to the end of the file, it also reloads the file if it has changed.
– jorb
Jun 6 '17 at 13:23
1
1
Thanks. First time it didn't refresh for me, but now it seems to work properly. In the man it's not written that it refreshes the file.
man less
: 'G or > or ESC-> Go to line N in the file, default the end of the file.' I delete my old wrong comments here, sorry for them.– Yaroslav Nikitenko
Jun 8 '17 at 13:56
Thanks. First time it didn't refresh for me, but now it seems to work properly. In the man it's not written that it refreshes the file.
man less
: 'G or > or ESC-> Go to line N in the file, default the end of the file.' I delete my old wrong comments here, sorry for them.– Yaroslav Nikitenko
Jun 8 '17 at 13:56
1
1
BTW, what do you call a 'one-time basis'? The maintainer of
less
, Mark Nudelman, replied the following: "The G command does not normally force a re-read of the file like the R command does. It may seem do that if the end of the file has not yet been read when G is invoked, so that jumping to the end of the file must read the data there for the first time. For example, if you jump to the end with G, then jump back to the beginning with 1G, then another program modifies the data at the end of the file (without changing the length), " (cont)– Yaroslav Nikitenko
Jun 12 '17 at 20:14
BTW, what do you call a 'one-time basis'? The maintainer of
less
, Mark Nudelman, replied the following: "The G command does not normally force a re-read of the file like the R command does. It may seem do that if the end of the file has not yet been read when G is invoked, so that jumping to the end of the file must read the data there for the first time. For example, if you jump to the end with G, then jump back to the beginning with 1G, then another program modifies the data at the end of the file (without changing the length), " (cont)– Yaroslav Nikitenko
Jun 12 '17 at 20:14
(cont) "then you jump to the end again with G, you will not see the modified data. But if you don't jump to the end and back to the beginning, then the first time you execute the G command it must read the data there for the first time, and of course it will see any modifications that have happened since less was first invoked. "
– Yaroslav Nikitenko
Jun 12 '17 at 20:14
(cont) "then you jump to the end again with G, you will not see the modified data. But if you don't jump to the end and back to the beginning, then the first time you execute the G command it must read the data there for the first time, and of course it will see any modifications that have happened since less was first invoked. "
– Yaroslav Nikitenko
Jun 12 '17 at 20:14
In this case I mentioned it being a one-time refresh as opposed to a dynamic refresh, which is part of what the original question is asking.
– jorb
Jun 12 '17 at 20:31
In this case I mentioned it being a one-time refresh as opposed to a dynamic refresh, which is part of what the original question is asking.
– jorb
Jun 12 '17 at 20:31
add a comment |
You can use vim to read the file then add the following mapping to your .vimrc
file and you can easily reload a file with ,r:
let mapleader = ","
nnoremap <leader>r :edit <CR>
Note if you edited the file already, vim will complain. Just change to
let mapleader = ","
nnoremap <leader>r :edit! <CR>
To ignore changes.
They'll have to pryvim
from your cold, dead hands. The context of the question is aboutless
, but as someone with monomaniacal tendencies myself, I sympathise!
– Benjamin R
Oct 26 '18 at 16:05
add a comment |
You can use vim to read the file then add the following mapping to your .vimrc
file and you can easily reload a file with ,r:
let mapleader = ","
nnoremap <leader>r :edit <CR>
Note if you edited the file already, vim will complain. Just change to
let mapleader = ","
nnoremap <leader>r :edit! <CR>
To ignore changes.
They'll have to pryvim
from your cold, dead hands. The context of the question is aboutless
, but as someone with monomaniacal tendencies myself, I sympathise!
– Benjamin R
Oct 26 '18 at 16:05
add a comment |
You can use vim to read the file then add the following mapping to your .vimrc
file and you can easily reload a file with ,r:
let mapleader = ","
nnoremap <leader>r :edit <CR>
Note if you edited the file already, vim will complain. Just change to
let mapleader = ","
nnoremap <leader>r :edit! <CR>
To ignore changes.
You can use vim to read the file then add the following mapping to your .vimrc
file and you can easily reload a file with ,r:
let mapleader = ","
nnoremap <leader>r :edit <CR>
Note if you edited the file already, vim will complain. Just change to
let mapleader = ","
nnoremap <leader>r :edit! <CR>
To ignore changes.
answered Mar 16 '12 at 23:43
pukpuk
1931110
1931110
They'll have to pryvim
from your cold, dead hands. The context of the question is aboutless
, but as someone with monomaniacal tendencies myself, I sympathise!
– Benjamin R
Oct 26 '18 at 16:05
add a comment |
They'll have to pryvim
from your cold, dead hands. The context of the question is aboutless
, but as someone with monomaniacal tendencies myself, I sympathise!
– Benjamin R
Oct 26 '18 at 16:05
They'll have to pry
vim
from your cold, dead hands. The context of the question is about less
, but as someone with monomaniacal tendencies myself, I sympathise!– Benjamin R
Oct 26 '18 at 16:05
They'll have to pry
vim
from your cold, dead hands. The context of the question is about less
, but as someone with monomaniacal tendencies myself, I sympathise!– Benjamin R
Oct 26 '18 at 16:05
add a comment |
R
for repaint does not always reload the file.[1]
A workaround that always reloads the file is to press hq
, which will open the Help page, then quit. It has a side effect of forcing the file to reload.
[1] Here are some examples of situations that R
do and do not reload:
>
and>>
changes: DO get reloadedsed -i
, gEdit, TextEdit: DO NOT get reloaded- On Linux,
vi
changes: DO get reloaded - On Mac,
vi
changes: DO NOT get reloaded
I believe the difference comes down to whether the inode changes (you can check with ls -i foo.txt
). If the inode changes, then R
will not work.
add a comment |
R
for repaint does not always reload the file.[1]
A workaround that always reloads the file is to press hq
, which will open the Help page, then quit. It has a side effect of forcing the file to reload.
[1] Here are some examples of situations that R
do and do not reload:
>
and>>
changes: DO get reloadedsed -i
, gEdit, TextEdit: DO NOT get reloaded- On Linux,
vi
changes: DO get reloaded - On Mac,
vi
changes: DO NOT get reloaded
I believe the difference comes down to whether the inode changes (you can check with ls -i foo.txt
). If the inode changes, then R
will not work.
add a comment |
R
for repaint does not always reload the file.[1]
A workaround that always reloads the file is to press hq
, which will open the Help page, then quit. It has a side effect of forcing the file to reload.
[1] Here are some examples of situations that R
do and do not reload:
>
and>>
changes: DO get reloadedsed -i
, gEdit, TextEdit: DO NOT get reloaded- On Linux,
vi
changes: DO get reloaded - On Mac,
vi
changes: DO NOT get reloaded
I believe the difference comes down to whether the inode changes (you can check with ls -i foo.txt
). If the inode changes, then R
will not work.
R
for repaint does not always reload the file.[1]
A workaround that always reloads the file is to press hq
, which will open the Help page, then quit. It has a side effect of forcing the file to reload.
[1] Here are some examples of situations that R
do and do not reload:
>
and>>
changes: DO get reloadedsed -i
, gEdit, TextEdit: DO NOT get reloaded- On Linux,
vi
changes: DO get reloaded - On Mac,
vi
changes: DO NOT get reloaded
I believe the difference comes down to whether the inode changes (you can check with ls -i foo.txt
). If the inode changes, then R
will not work.
edited 10 hours ago
answered May 23 '18 at 21:17
wisbuckywisbucky
728810
728810
add a comment |
add a comment |
You could pipe it to tail -f
instead, it would result in you following the output. You'd be losing the ability to move (scroll) through your output though.
add a comment |
You could pipe it to tail -f
instead, it would result in you following the output. You'd be losing the ability to move (scroll) through your output though.
add a comment |
You could pipe it to tail -f
instead, it would result in you following the output. You'd be losing the ability to move (scroll) through your output though.
You could pipe it to tail -f
instead, it would result in you following the output. You'd be losing the ability to move (scroll) through your output though.
answered Nov 26 '10 at 19:41
GertGert
7,35123035
7,35123035
add a comment |
add a comment |
If you're not averse to using a browser you could launch the Algernon web server with this command:
algernon -a -t /directory/name
A list of files will then be displayed, and auto-refreshed, at http://localhost:3000/
Wrong thread?..
– Tomasz
Jun 5 '17 at 23:45
It seems to be a way to watch a directory, although it's a long way fromless
– Jeff Schaller♦
Jun 6 '17 at 0:17
add a comment |
If you're not averse to using a browser you could launch the Algernon web server with this command:
algernon -a -t /directory/name
A list of files will then be displayed, and auto-refreshed, at http://localhost:3000/
Wrong thread?..
– Tomasz
Jun 5 '17 at 23:45
It seems to be a way to watch a directory, although it's a long way fromless
– Jeff Schaller♦
Jun 6 '17 at 0:17
add a comment |
If you're not averse to using a browser you could launch the Algernon web server with this command:
algernon -a -t /directory/name
A list of files will then be displayed, and auto-refreshed, at http://localhost:3000/
If you're not averse to using a browser you could launch the Algernon web server with this command:
algernon -a -t /directory/name
A list of files will then be displayed, and auto-refreshed, at http://localhost:3000/
answered Jun 5 '17 at 19:59
AlexanderAlexander
6,11322246
6,11322246
Wrong thread?..
– Tomasz
Jun 5 '17 at 23:45
It seems to be a way to watch a directory, although it's a long way fromless
– Jeff Schaller♦
Jun 6 '17 at 0:17
add a comment |
Wrong thread?..
– Tomasz
Jun 5 '17 at 23:45
It seems to be a way to watch a directory, although it's a long way fromless
– Jeff Schaller♦
Jun 6 '17 at 0:17
Wrong thread?..
– Tomasz
Jun 5 '17 at 23:45
Wrong thread?..
– Tomasz
Jun 5 '17 at 23:45
It seems to be a way to watch a directory, although it's a long way from
less
– Jeff Schaller♦
Jun 6 '17 at 0:17
It seems to be a way to watch a directory, although it's a long way from
less
– Jeff Schaller♦
Jun 6 '17 at 0:17
add a comment |
I just found this thread like anyone else.
I would like to add the solution of when you are already at the end of the file, using 'g' followed by 'G' will force a refresh of the file.
I ended up making a macro button for this in my terminal program (SecureCRT).
The macro is simply 'gG'.
add a comment |
I just found this thread like anyone else.
I would like to add the solution of when you are already at the end of the file, using 'g' followed by 'G' will force a refresh of the file.
I ended up making a macro button for this in my terminal program (SecureCRT).
The macro is simply 'gG'.
add a comment |
I just found this thread like anyone else.
I would like to add the solution of when you are already at the end of the file, using 'g' followed by 'G' will force a refresh of the file.
I ended up making a macro button for this in my terminal program (SecureCRT).
The macro is simply 'gG'.
I just found this thread like anyone else.
I would like to add the solution of when you are already at the end of the file, using 'g' followed by 'G' will force a refresh of the file.
I ended up making a macro button for this in my terminal program (SecureCRT).
The macro is simply 'gG'.
answered May 24 '18 at 20:54
ZMitchellZMitchell
1
1
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f4351%2fis-there-a-way-to-dynamically-refresh-the-less-command%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
-less, watch
I am looking for
tail -f foo.log | grep bar
, and to be able to dynamically change the grep command with restarting the tail/grep pipeline.– Alexander Mills
Sep 13 '18 at 23:56