Finding file name οf currently open file in vi on terminal

How do I check the file name that is open in the terminal? That is, how do I check which file is open now in the terminal?

Now whenever I want to see the file name I have to exit and then have to check. Is there a way to check the current file name in the terminal?


To see the filename in vi(m) press esc and then type

:set title

The filename appears in the top bar of the terminal window. You can also do

:buffers

to see the file(s) currently open - the information is displayed inside the terminal at the bottom. If you have multiple files open, you can tell which one you are in as %a is shown beside the current file, for example

:buffers
  1 %a=   "unicorns"      line 19     
  2       "rainbows"      line 1
Press ENTER or type command to continue

I prefer Ctrl-G:

http://vimdoc.sourceforge.net/htmldoc/editing.html

CTRL-G      or              *CTRL-G* *:f* *:fi* *:file*
:f[ile]         Prints the current file name (as typed, unless ":cd"
            was used), the cursor position (unless the 'ruler'
            option is set), and the file status (readonly,
            modified, read errors, new file).  See the 'shortmess'
            option about how to make this message shorter.
            {Vi does not include column number}