• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
sharadchhetri

sharadchhetri

Tutorials On Linux, Unix & Open Source

  • Home
  • Linux Commands
  • Resources
    • Learn Linux
  • My WordPress plugins

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

Share this:

  • Twitter
  • Facebook
  • More
  • Print
  • Email
  • LinkedIn
  • Reddit
  • Tumblr
  • Pinterest
  • Pocket
  • Telegram
  • WhatsApp
  • Mastodon

Related posts:

  1. Convert video file into gif file through command line in linux
  2. Change default editor of crontab in Ubuntu
  3. How to install vim editor in Linux Mint
  4. NOTICE: nagios.cmd file not found. Please specify the location of this file in your /etc/vshell.conf file
  5. How to see line numbers in file through cat command
  6. Search Keyword In Man Page Like We Search In vi / vim Editor
  7. Install yEd graph editor on Ubuntu
  8. How to convert rpm file into deb file
  9. search keyword in file with line number using grep command
  10. sed : find the pattern (keyword) and delete the line from file

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

Our Social Media Presence

  • Facebook
  • GitHub
  • Twitter

Linux Command

What is Linux Internal And External Command

Linux Basic Commands With Examples For Every Beginner

tr command to convert lines to space , tab and vertical tab

smbpasswd command not found on CentOS 7 and RHEL 7

Solution : semanage command not found

Unix / Linux : How to print duplicate lines from file

More Posts from this Category

You Might Like These Articles!

simplecodesyntax wordpress plugin

SimpleCodeSyntax : My Another WordPress Plugin

Install Nginx

How To Install Nginx On Ubuntu 22.04 LTS

Install Latest Git package in Ubuntu Operating System

How To Always Install Latest Git Package In Ubuntu Operating System

Bash script for installing VirtualBox on Ubuntu 22.04 LTS Desktop

Install VirtualBox On Ubuntu 22.04 LTS Desktop (Bash Script)

libfuse

dlopen(): error loading libfuse.so.2 – Got Error On Ubuntu

Failed to open/create the internal network

VirtualBox Error: Failed to open/create the internal network

Always Useful Tips And Tricks

How to see system load average in terminal with graphical representation

The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form

How to zip the directory in linux with command line

Allow only members of Wheel group to use su command on RHEL/CentOS

How to download package using apt-get command in ubuntu

Error installing rails

Error: Could not stat() command file ‘/var/lib/nagios3/rw/nagios.cmd’!

Explore 90+ Article On "Linux Tips And Tricks"

Copyright © 2023 ยท
The material in this site cannot be republished either online or offline, without our permission.
Proudly Blogging From Bharat.

  • Contact
  • About Me
  • My WordPress plugins
  • Privacy Policy