Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 09-05-2008, 01:06 PM   #1
Registered: Feb 2007
Posts: 386

Rep: Reputation: 30
vi help, how to modify previous command

Is there a way to get the command in vi that I typed in previously? I am sure there must be, but I just don't know how to get it.

Here is an example,
I typed following command to modify the word outputofthisfile from a file

:%s/outputofthisfile/output of this file/g
After executed, it reported that it could not find that word.. Well I realized that it should be /inputofthisfile/ instead.

I want to modify the /outputofthisfile/ to /inputofthisfile/ instead of writing the whole thing again.
Old 09-05-2008, 01:20 PM   #2
Registered: Feb 2007
Location: /home
Distribution: Kubuntu and CentOS
Posts: 214

Rep: Reputation: 32
use colon ( : ) to enter extended mode, then press the up arrow. vim (assuming you are actually using vim not vi) lets you see a history of commands you have run in the past.

Good luck =0)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
In Solaris(command Line ), How to get the previous commands? kcarun Solaris / OpenSolaris 22 10-19-2012 04:49 AM
Help Please!! -- need to find command that will switch you back to your previous CWD Tron55555 Linux - General 2 05-15-2008 11:35 PM
Unix command to delete the previous and next line of the searched pattern navin29 Linux - Newbie 7 03-14-2008 02:23 PM
Timestamp of previous command issued benjaminrtz Linux - General 1 04-16-2005 02:53 AM
date command getting previous day swinchen Programming 6 08-23-2004 01:17 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:45 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration