Solved

Vi commands

Posted on 2014-02-04
9
270 Views
Last Modified: 2014-04-03
I wanted to get some type of Vi commands - for dummies crash couse.

Help!
0
Comment
Question by:uppercut71412
9 Comments
 
LVL 14

Expert Comment

by:comfortjeanius
ID: 39833330
Here some articles for assistance Vi Cheat Sheet and Vi Commands
0
 
LVL 20

Expert Comment

by:netcmh
ID: 39833389
0
 
LVL 37

Assisted Solution

by:Gerwin Jansen, EE MVE
Gerwin Jansen, EE MVE earned 166 total points
ID: 39833797
vi <filename>
i - insert
(type some text)
<ESC> - go to command mode
:wq - write and quit vi

cursor movement:
i j k l - move cursor
$ - go to end of line
^ - go to beginning of line
0
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 
LVL 31

Assisted Solution

by:farzanj
farzanj earned 166 total points
ID: 39835358
Gerwin Jansen has given you the basic commands that you can use to pretty much use vi.  I'd only add the copy and paste to this list.

Copy -- yank
Copy 1 line
yy

Copy, say, 5 lines from my cursor
5yy

Cut: same as delete, only that in delete, you don't need to paste
1 line
dd

cut/delete say 5 lines
5dd

Paste after the current cursor location -- p
Paste before the current location          -- P

Visual mode:

Things get much easier with visual mode.
Highlight within a single line  -- v
Highlight multiple lines          -- V
And then you can use d or x to cut, y to yank (copy) and p to paste as usual.
0
 
LVL 5

Accepted Solution

by:
Dave Gould earned 168 total points
ID: 39836027
I'd also add change:

change word --- cw
change to end of line -- c$

replace a character -- r
0
 
LVL 20

Expert Comment

by:netcmh
ID: 39956576
@SouthMod, it doesn't seem that the asker understood your comment. I received an answer accepted at Wed 3/26/2014 11:38 AM EST. Possibly, the same comment being selected as the answer. I object, but I couldn't find the button. Thanks
0
 
LVL 5

Expert Comment

by:Dave Gould
ID: 39956721
I must admit, I was a bit suprised to get all points for an "add-on". I would have thought that the points should have been split across all those that posted. Its also one of those questions where all posts are correct as there is no right or wrong answer.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my business, I use the LTS (Long Term Support) versions of Linux. My workstations do real work, and so I rarely have the patience to deal with silly problems caused by an upgraded kernel that had experimental software on it to begin with from a r…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question