How do I get the line number at the foot of a vi screen

The vi editor has always, within my experience, had the line and character number at the foot of the screen but the version included with Rocky 9.5 no longer has this. I can get line numbers at the left (or right) of each line but not at only at the foot and much googling hasn’t found a solution. What is the command to do this?

Thanks in advance.

Is it the ‘:set ruler’ that you are looking for? It shows the current line, column at the bottom right side of the status bar at the bottom. ‘ctrl+g’ will show the total lines and the percentage of the file your cursor is currently at.

Yes, I found that when I was looking for a solution but it doesn’t seem to do anything. I tried to set it as a test from an edit session as “:set ruler” and I tried to put it in vimrc as “set ruler” and neither had any effect.

@johni Are you sure you are using vim and not straight vi… try a sudo dnf install vim then retest… Here is vim with the set ruler.

With straight vi the set ruler does not show the ruler at all, as you are reporting.

Yes, you are correct. Not sure how a pure vanilla install of Rocky 9.5 came up with vi instead of vim - the man page says that vi invokes vim. I have never acually seen vi and I have been using Linux in various flavours since 2007!

They are very similar, but not exact. If you had a minimal install of Rocky Linux 9.5, you would get plain vanilla vi. When I first tested this in a Rocky Linux 9.5 container, it had vi not vim, so installed vim and that gave the desired results. You live and learn, right?

Yes, I’m learning too much that I never wanted to know! And, yes, I did a minimal install.

1 Like

For a very long time, on most Linux distros, ‘vi’ launches vim in vi mode which is not exactly like vanilla vi. If you run ‘whereis vi’ you’ll see two locations, ‘/usr/bin/vi’ and ‘/usr/libexec/vi’. If you then run ‘file /usr/bin/vi’ you’ll see that it’s an ascii sh file; if you open it it explains how it opens vi, and that the libexec version is actually vi.