Solved

Vi commands

Posted on 2014-02-04
9
268 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
Comment Utility
Here some articles for assistance Vi Cheat Sheet and Vi Commands
0
 
LVL 20

Expert Comment

by:netcmh
Comment Utility
0
 
LVL 37

Assisted Solution

by:Gerwin Jansen
Gerwin Jansen earned 166 total points
Comment Utility
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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 31

Assisted Solution

by:farzanj
farzanj earned 166 total points
Comment Utility
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
Comment Utility
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
Comment Utility
@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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
This article will explain how to establish a SSH connection to Ubuntu through the firewall and using a different port other then 22. I have set up a Ubuntu virtual machine in Virtualbox and I am running a Windows 7 workstation. From the Ubuntu vi…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.:

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now