• Skip to primary navigation
  • Skip to content
  • Skip to primary sidebar
  • Skip to footer
sharadchhetri.com

sharadchhetri.com

Linux,Cloud Computing And DevOps

  • Home
  • Linux
  • CloudComputing
    • Introduction Cloud Computing
    • Amazon AWS
  • Free E-Books
  • About Me

set and unset line number in file with vi editor

November 18, 2013 by Sharad Chhetri Leave a Comment

In this tutorial we will learn, set and unset line number in file with vi editor. The same is applicable to vim editor also.(vim is advanced vi editor).vi editor is one of the famous and bydefault file editor in many linux distro. In vi editor you can use regex tricks.

To set line number in file with vi or vim editor

Open the file with vi or vim editor and type the below given command by firstly pressing ESC key

:set number

OR

:set nu

To unset or remove line number in file with vi or vim editor

:set nonumber

OR

:set nonu
:set number!

OR

:set nu!

To permanently set line number in file for user

To permanently set line number in files for user edit .vimrc file in user’s home directory

Step 1: Edit .vimrc file

vi ~/.vimrc

Step 2: Now in .vimrc file insert below given command

set number

OR

set nu

Do'nt be greedy, share the knowledge!

  • Click to share on Facebook (Opens in new window)
  • Click to share on WhatsApp (Opens in new window)
  • Click to share on Twitter (Opens in new window)
  • Click to share on Pinterest (Opens in new window)
  • Click to share on Reddit (Opens in new window)
  • Click to share on Pocket (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)

Related

Filed Under: Tips And Tricks Tagged With: vi, vim

Reader Interactions

Leave a Reply Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Help To Needy

If you like our posts and tutorials, please support/donate to ANY “Open Source Project” or do some Charity work. Hope this will make someone happy in this world. Drop me an email if you want to inspire others!

Thank You!

Follow Us

  • Facebook
  • Twitter
  • GitHub
  • YouTube

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Top Posts & Pages

  • How to delete mail queue in Postfix
  • How to start / stop / restart / reload iptables on CentOS 7 / RHEL 7
  • How to find absolute path of command on Linux / Unix : which command
  • How to fix read only USB pen drive in Ubuntu
  • How to set hostname and FQDN on CentOS 7 and RHEL 7
  • Install KVM on Ubuntu 14.04 LTS Desktop
  • How to zip the directory in linux with command line
  • 4 different commands to check the load average in linux
  • How to install XAMPP on CentOS/RHEL 6.5
  • CentOS 7 / RHEL 7 : change OpenSSH port number ( SELINUX enabled )

Recent Posts

  • Install and setup maven in Linux for Jenkins
  • How to setup Jenkins Credentials for Git repo access
  • How to manage Jenkins Credentials
  • Managing Jenkins plugins from command line and GUI
  • How to create Jenkins user by command line and GUI

Footer

Sharad Chhetri is an experienced Linux - Cloud Engineer & freelancer. Working on Open Source Technology since RHEL 4.0 (Red Hat Enterprise Linux). He loves sharing the knowledge which earned from real scenarios. Don't be surprised if you find him in technology seminars and meetup groups. You can contact him on email for freelance projects at admin@sharadchhetri.com. Read More…

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Our GitHub Repo

sharadchhetri @ GitHub
  • java-samples
    Java Sample Project For Tutorial
    December 25, 2018 - 2:29 pm UTC
  • misc
    OpenSSH rpm created from tar ball
    November 21, 2018 - 3:12 am UTC
  • scripts
    Cassandra Backup Script
    November 21, 2018 - 3:09 am UTC
  • packer
    Packer : Create server images in automated way
    November 21, 2018 - 3:08 am UTC
  • Nagios
    My Nagios custom plugins
    November 21, 2018 - 3:07 am UTC

Recent Comments

  • Sharad Chhetri on CentOS 7 / RHEL 7 : change OpenSSH port number ( SELINUX enabled )
  • Dave on CentOS 7 / RHEL 7 : change OpenSSH port number ( SELINUX enabled )
  • Prafulla S on Install Shotcut on Ubuntu 16.04 LTS desktop
  • Sujata on Install Telnet Server on CentOS 7 / RHEL 7
  • kishen sharma on How to install redis server on CentOS 7 / RHEL 7
  • Sharad Chhetri on Secondary Logging : save all users history command output as log
  • Anand on Secondary Logging : save all users history command output as log
  • Sharad Chhetri on Install redis 3.0 from source on Ubuntu 14.04 / CentOS 7 / RHEL 7

Copyright © 2009 - 2019 · All Rights Reserved sharadchhetri.com · · Privacy Policy ·
· sitemap.xml · ·The content is copyrighted to sharadchhetri.com and may not be reproduced on other websites without our permission. ·