DbAppWeb.com

Menu
  • Home
  • Linux
  • HP-UX
  • macOS
  • Windows
  • Web Servers
  • App Servers
  • Storage

How to show or hide line numbers in vi text editor

October 27, 2017 DbAppWeb Admin

If you want to show the line numbers in vi editor while editing the file then you need to set the number flag. follow the steps given below to set the line numbers while using the vi editor:

Show Line Numbers in vi Editor

  • First, open the file in the vi editor
    [root@testserver ~]# vi /etc/httpd/conf/httpd.conf
  • Press the Esc key if you are in insert or append mode.
  • Press : (colon) and you will see that cursor will reappear at the lower-left corner of the screen next to the : prompt.
    :
    
  • Now type any one of the following commands and press Enter.
    set number

    or

    set nu
  • You will see that a column with sequential numbers will appear on the leftmost side of the screen as shown below.
         25 # Configuration and logfile names: If the filenames you specify for many
         26 # of the server's control files begin with "/" (or "drive:/" for Win32), the
         27 # server will use that explicit path.  If the filenames do *not* begin
         28 # with "/", the value of ServerRoot is prepended -- so "logs/foo.log"
         29 # with ServerRoot set to "/etc/httpd" will be interpreted by the
         30 # server as "/etc/httpd/logs/foo.log".
         31 #
         32
         33 ### Section 1: Global Environment
         34 #
         35 # The directives in this section affect the overall operation of Apache,
         36 # such as the number of concurrent requests it can handle or where it
         37 # can find its configuration files.
         38 #
         39
         40 #
         41 # Don't give away too much information about all the subcomponents
         42 # we are running.  Comment out this line if you don't mind remote sites
         43 # finding out what major optional modules you are running
         44 #ServerTokens OS
         45
         46 ServerTokens Prod
    

 

Hide Line Numbers in vi Editor

  • Type any one of the following commands at : prompt and press Enter to hide or turn off the line numbers in the vi editor.
    set number

    or

    set nu
Prev Article
Next Article
Tags:HP-UX Linux Mac OS X Sys Admin vi Editor

Leave a Reply Cancel Reply

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

  • Popular
  • Recent

Categories

  • Android (2)
  • Blogger (16)
  • Domain and Hosting (1)
  • Hardware Issues (7)
  • HP-UX (55)
  • HPE Data Protector (9)
  • IBM Lotus Notes (2)
  • IBM WebSphere Application Server (16)
  • Internet Tips & Tricks (15)
  • iOS (8)
  • JBoss/WildFly Application Server (2)
  • Linux (76)
  • macOS (15)
  • Microsoft Windows (31)
  • News and Updates (11)
  • Oracle Database (5)
  • SSL/TLS (1)
  • Storage Servers (23)
  • Tools/Softwares (1)
  • VMware ESXi (17)
  • Web Servers (14)
  • WordPress (5)

Archives

DbAppWeb.com

Solution of Database, Application and Web Server Problems

About DbAppWeb.com

One Stop Solution for Database Server, Application Server and Web Server Problems.

Subscribe to Blog via Email

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

DbAppWeb on Social Media

Copyright © 2025 DbAppWeb.com
Terms and Conditions   Theme by MyThemeShop.com