tags:

views:

62

answers:

5

Hi.

I'm looking a simple command, like

$ less -{view_from_bottom_of_the_file_option} filename

or

$ vi -{start_viewer_from_the_bottom} filename

viewer, editor - what ever.

Thanks.

+4  A: 

vi + filename (open the file filename at the last line)

or

vi +lineNumber filename (e.g. to open the file with filename at line 100, vi +100 filename)

shahkalpesh
+1  A: 
tac $file | less

will reverse the order of the lines

knittl
depends on the filetype. logfiles with one entry per line will read exactly the same (only reversed)
knittl
This is really the correct answer to the question
Shervin
@joey: the original question used `less` as an example, which will also not dynamically update the displayed file. `tail -[fF]` is another obvious solution – but that really depends on the intention of the OP
knittl
+1  A: 

You can use the +[num] command line option of vim.

+[num]  The cursor will be positioned on line "num" for the first
        file being edited.  If "num" is missing, the cursor will be
        positioned on the last line.

So to palce the cursor at the last line you can do:

vim + file_name
codaddict
+1  A: 

tail -n [lines] [file] will output the last [lines] of the [file]. When you add -f, the file will not be closed and you will see updates which are appended at the file.

itsme
+1  A: 

less (on linux, FreeBSD, MacOSX) has the + option to send initial commands to less. An example in the man page uses it exactly to start viewing the file at last line. Like this:

less +G filename
fungusakafungus
@fungusakafungus Thanks, really works! :)
mosg