How to show line numbers in vi / vim by default in CentOS


  1. login as root user (or you can just use su).
  2. Open .vimrc file
    [root@server ~]$vi ~/.vimrc
  3. Add this line, then save.
    set number

Now everytime you open a file using vi/vim, line numbers will be shown by default.

Leave a Reply

Your email address will not be published. Required fields are marked *