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;








128















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.










share|improve this question
























  • 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

















128















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.










share|improve this question
























  • 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













128












128








128


40






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.










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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
















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










11 Answers
11






active

oldest

votes


















108














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.





share|improve this answer




















  • 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


















63














Shift+F will make less similar to tailf. That is, it gets refreshed if more data is appended to the file.






share|improve this answer




















  • 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



















36














Simply type:



less +F filename


This emulates pressing "F" within the editor.






share|improve this answer


















  • 1





    Thanks; added the alias alias check="less +F" to my .bashrc.

    – Luke Davis
    Jul 27 '17 at 21:31



















19














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






share|improve this answer


















  • 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 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


















5














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.






share|improve this answer






























    5














    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.






    share|improve this answer

























    • 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 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











    • 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


















    1














    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.






    share|improve this answer























    • 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


















    1














    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 reloaded


    • sed -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.






    share|improve this answer
































      0














      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.






      share|improve this answer






























        0














        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/






        share|improve this answer























        • 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


















        0














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






        share|improve this answer























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



          );













          draft saved

          draft discarded


















          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









          108














          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.





          share|improve this answer




















          • 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















          108














          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.





          share|improve this answer




















          • 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













          108












          108








          108







          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.





          share|improve this answer















          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.






          share|improve this answer














          share|improve this answer



          share|improve this answer








          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












          • 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













          63














          Shift+F will make less similar to tailf. That is, it gets refreshed if more data is appended to the file.






          share|improve this answer




















          • 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
















          63














          Shift+F will make less similar to tailf. That is, it gets refreshed if more data is appended to the file.






          share|improve this answer




















          • 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














          63












          63








          63







          Shift+F will make less similar to tailf. That is, it gets refreshed if more data is appended to the file.






          share|improve this answer















          Shift+F will make less similar to tailf. That is, it gets refreshed if more data is appended to the file.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          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













          • 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












          36














          Simply type:



          less +F filename


          This emulates pressing "F" within the editor.






          share|improve this answer


















          • 1





            Thanks; added the alias alias check="less +F" to my .bashrc.

            – Luke Davis
            Jul 27 '17 at 21:31
















          36














          Simply type:



          less +F filename


          This emulates pressing "F" within the editor.






          share|improve this answer


















          • 1





            Thanks; added the alias alias check="less +F" to my .bashrc.

            – Luke Davis
            Jul 27 '17 at 21:31














          36












          36








          36







          Simply type:



          less +F filename


          This emulates pressing "F" within the editor.






          share|improve this answer













          Simply type:



          less +F filename


          This emulates pressing "F" within the editor.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jun 21 '12 at 13:58









          jhclarkjhclark

          49944




          49944







          • 1





            Thanks; added the alias alias check="less +F" to my .bashrc.

            – Luke Davis
            Jul 27 '17 at 21:31













          • 1





            Thanks; added the alias alias 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












          19














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






          share|improve this answer


















          • 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 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















          19














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






          share|improve this answer


















          • 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 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













          19












          19








          19







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






          share|improve this answer













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







          share|improve this answer












          share|improve this answer



          share|improve this answer










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












          • 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 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







          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











          5














          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.






          share|improve this answer



























            5














            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.






            share|improve this answer

























              5












              5








              5







              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.






              share|improve this answer













              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.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Nov 26 '10 at 17:21









              Dave JenningsDave Jennings

              21914




              21914





















                  5














                  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.






                  share|improve this answer

























                  • 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 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











                  • 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















                  5














                  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.






                  share|improve this answer

























                  • 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 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











                  • 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













                  5












                  5








                  5







                  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.






                  share|improve this answer















                  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.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








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











                  • 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






                  • 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 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











                  • 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











                  1














                  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.






                  share|improve this answer























                  • 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















                  1














                  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.






                  share|improve this answer























                  • 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













                  1












                  1








                  1







                  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.






                  share|improve this answer













                  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.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 16 '12 at 23:43









                  pukpuk

                  1931110




                  1931110












                  • 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
















                  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











                  1














                  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 reloaded


                  • sed -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.






                  share|improve this answer





























                    1














                    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 reloaded


                    • sed -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.






                    share|improve this answer



























                      1












                      1








                      1







                      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 reloaded


                      • sed -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.






                      share|improve this answer















                      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 reloaded


                      • sed -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.







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited 10 hours ago

























                      answered May 23 '18 at 21:17









                      wisbuckywisbucky

                      728810




                      728810





















                          0














                          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.






                          share|improve this answer



























                            0














                            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.






                            share|improve this answer

























                              0












                              0








                              0







                              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.






                              share|improve this answer













                              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.







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Nov 26 '10 at 19:41









                              GertGert

                              7,35123035




                              7,35123035





















                                  0














                                  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/






                                  share|improve this answer























                                  • 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















                                  0














                                  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/






                                  share|improve this answer























                                  • 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













                                  0












                                  0








                                  0







                                  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/






                                  share|improve this answer













                                  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/







                                  share|improve this answer












                                  share|improve this answer



                                  share|improve this answer










                                  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 from less

                                    – Jeff Schaller
                                    Jun 6 '17 at 0:17

















                                  • 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
















                                  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











                                  0














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






                                  share|improve this answer



























                                    0














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






                                    share|improve this answer

























                                      0












                                      0








                                      0







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






                                      share|improve this answer













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







                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered May 24 '18 at 20:54









                                      ZMitchellZMitchell

                                      1




                                      1



























                                          draft saved

                                          draft discarded
















































                                          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.




                                          draft saved


                                          draft discarded














                                          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





















































                                          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

                                          Popular posts from this blog

                                          Mobil Contents History Mobil brands Former Mobil brands Lukoil transaction Mobil UK Mobil Australia Mobil New Zealand Mobil Greece Mobil in Japan Mobil in Canada Mobil Egypt See also References External links Navigation menuwww.mobil.com"Mobil Corporation"the original"Our Houston campus""Business & Finance: Socony-Vacuum Corp.""Popular Mechanics""Lubrite Technologies""Exxon Mobil campus 'clearly happening'""Toledo Blade - Google News Archive Search""The Lion and the Moose - How 2 Executives Pulled off the Biggest Merger Ever""ExxonMobil Press Release""Lubricants""Archived copy"the original"Mobil 1™ and Mobil Super™ motor oil and synthetic motor oil - Mobil™ Motor Oils""Mobil Delvac""Mobil Industrial website""The State of Competition in Gasoline Marketing: The Effects of Refiner Operations at Retail""Mobil Travel Guide to become Forbes Travel Guide""Hotel Rankings: Forbes Merges with Mobil"the original"Jamieson oil industry history""Mobil news""Caltex pumps for control""Watchdog blocks Caltex bid""Exxon Mobil sells service station network""Mobil Oil New Zealand Limited is New Zealand's oldest oil company, with predecessor companies having first established a presence in the country in 1896""ExxonMobil subsidiaries have a business history in New Zealand stretching back more than 120 years. We are involved in petroleum refining and distribution and the marketing of fuels, lubricants and chemical products""Archived copy"the original"Exxon Mobil to Sell Its Japanese Arm for $3.9 Billion""Gas station merger will end Esso and Mobil's long run in Japan""Esso moves to affiliate itself with PC Optimum, no longer Aeroplan, in loyalty point switch""Mobil brand of gas stations to launch in Canada after deal for 213 Loblaws-owned locations""Mobil Nears Completion of Rebranding 200 Loblaw Gas Stations""Learn about ExxonMobil's operations in Egypt""Petrol and Diesel Service Stations in Egypt - Mobil"Official websiteExxon Mobil corporate websiteMobil Industrial official websiteeeeeeeeDA04275022275790-40000 0001 0860 5061n82045453134887257134887257

                                          Frič See also Navigation menuinternal link

                                          Identify plant with long narrow paired leaves and reddish stems Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?What is this plant with long sharp leaves? Is it a weed?What is this 3ft high, stalky plant, with mid sized narrow leaves?What is this young shrub with opposite ovate, crenate leaves and reddish stems?What is this plant with large broad serrated leaves?Identify this upright branching weed with long leaves and reddish stemsPlease help me identify this bulbous plant with long, broad leaves and white flowersWhat is this small annual with narrow gray/green leaves and rust colored daisy-type flowers?What is this chilli plant?Does anyone know what type of chilli plant this is?Help identify this plant