DEVTOME.COM HOSTING COSTS HAVE BEGUN TO EXCEED 115$ MONTHLY. THE ADMINISTRATION IS NO LONGER ABLE TO HANDLE THE COST WITHOUT ASSISTANCE DUE TO THE RISING COST. THIS HAS BEEN OCCURRING FOR ALMOST A YEAR, BUT WE HAVE BEEN HANDLING IT FROM OUR OWN POCKETS. HOWEVER, WITH LITERALLY NO DONATIONS FOR THE PAST 2+ YEARS IT HAS DEPLETED THE BUDGET IN SHORT ORDER WITH THE INCREASE IN ACTIVITY ON THE SITE IN THE PAST 6 MONTHS. OUR CPU USAGE HAS BECOME TOO HIGH TO REMAIN ON A REASONABLE COSTING PLAN THAT WE COULD MAINTAIN. IF YOU WOULD LIKE TO SUPPORT THE DEVTOME PROJECT AND KEEP THE SITE UP/ALIVE PLEASE DONATE (EVEN IF ITS A SATOSHI) TO OUR DEVCOIN 1M4PCuMXvpWX6LHPkBEf3LJ2z1boZv4EQa OR OUR BTC WALLET 16eqEcqfw4zHUh2znvMcmRzGVwCn7CJLxR TO ALLOW US TO AFFORD THE HOSTING.

THE DEVCOIN AND DEVTOME PROJECTS ARE BOTH VERY IMPORTANT TO THE COMMUNITY. PLEASE CONTRIBUTE TO ITS FURTHER SUCCESS FOR ANOTHER 5 OR MORE YEARS!

Creating and Editing Files in vi

Hayek's Linux Manual

Description

The world's favorite text editor

vi is a visual text editor for Unix and Unix-based systems. It was introduced in 1979 as part of BSD Unix and based on an earlier line editor program named ex. Its name is derived from an abbreviation of ‘visual’ a command used to change ex to a visually mode.

vi is a modal editor. It has two modes – insert and command. Understanding the difference between modes is a major hurdle for a new user. While in insert mode, vi behaves much like a standard text editor. However, in command mode the keyboard is used to issue commands to vi. The commands are interpreted and an action is performed on the file. Below is a table containing some commonly used vi commands.

  • vi <filename>
    • From the shell, this creates a new file in the current directory as ‘filename.’ Or, if a file with that name exists, opens that file for editing.
  • view <filename>
    • From the shell, view is identical to vi but opens the file as read-only.
  • i
    • From within vi, “i” changes vi to insert mode and behavior changes to that of a text editor’s.
  • [ESC]
    • From within vi, the escape key changes vi from insert mode to command mode.
  • :w
    • From command mode, “w” writes changes to disk
  • :q
    • From command mode, “q” quits vi and exits back to the shell
  • [SHIFT]+G
    • From command mode, “[SHIFT]+G” moves the cursor to the end of the file and changes vi to insert mode
  • 0
    • From command mode, “0” moves the cursor to the beginning of the current line
  • $
    • From command mode, “$” moves the cursor to the end of the current line
  • [SHIFT]+A
    • From command mode, “[SHIFT]+A” moves the cursor one character past the end of the line and puts vi in insert mode
  • A
    • From command mode, “A” moves the cursor one character ahead and puts vi in insert mode
  • w
    • From command mode, “w” moves the cursor ahead one word
  • b
    • From command mode, “b” moves the cursor back one word
  • o
    • From command mode, “o” creates a new line after the current line and puts vi in insert mode
  • O
    • From command mode, “O” creates a new line before the current line and puts vi in insert mode
  • r + [Character]
    • From command mode, “r” replaces the current character with the next character typed after “r”
  • x
    • From command mode, “x” deletes the current character
  • /[string] + [Enter]/n
    • From command mode, “/” moves the cursor to the first instance of [string]. “n” is used to move the cursor to the next occurrence of [string].

Tips: Even while using ‘view’ changes can be made using “w!”. The “!” forces the command. Also, some commands can be combined, for example “wq” would save and quit a file.

Computing


QR Code
QR Code creating_and_editing_files_with_vi_hayek.0 (generated for current page)
 

Advertise with Anonymous Ads