Abra 'menos' rolado para o final

43

Existe uma maneira de abrir less e rolá-lo até o final do arquivo? Eu estou sempre fazendo less app.log e, em seguida, pressionando G para ir para o fundo.

Espero que haja algo como less --end ou less -exec 'G' .

    
por Miles 26.06.2017 / 16:32

3 respostas

73

less +G app.log

+ executará um comando em cada arquivo aberto

G pula para o final

    
por 26.06.2017 / 16:32
20
less +F filename

vai até o final e segue o arquivo.

De menos man page:

F Scroll forward, and keep trying to read when the end of file is reached. Normally this command would be used when already at the end of the file. It is a way to monitor the tail of a file which is growing while it is being viewed. (The behavior is similar to the "tail -f" command.)

    
por 26.06.2017 / 21:54
7

Na página menos man:

If a command line option begins with +, the remainder of that option is taken to be an initial command to less. For example, +G tells less to start at the end of the file rather than the beginning, and +/xyz tells it to start at the first occurrence of "xyz" in the file. As a special case, + acts like +g; that is, it starts the display at the specified line number (however, see the caveat under the "g" command above). If the option starts with ++, the initial command applies to every file being viewed, not just the first one. The + command described previously may also be used to set (or change) an initial command for every file.

    
por 26.06.2017 / 16:40

Tags