Technology Insights

Change vi Defaults To Not Display Line Numbers When Editing Files On Linux

Recently I was contracted to do some work for a new client that had around 25 CentOS Linux and Ubuntu Linux servers. The client needed various system administration tasks completed such as updating the servers, modifying a couple scripts that performed automated tasks, and a couple other basic tasks. I typically use vi to modify scripts or text files on Linux servers so when I started to perform my tasks I started getting annoyed as the vi default configuration included the line numbers which makes it a pain to copy/paste from the files you are editing. You can obviously turn off the line number display by typing “:” followed by “set nonu” (both without the quotes) however that does get old. Use the information below to change the default vi configuration so line numbers no longer display by default.