LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 09-05-2008, 12:06 PM   #1
ufmale
Member
 
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

Code:
:%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, 12:20 PM   #2
Hewson
Member
 
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)
 
  


Reply



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 03:49 AM
Help Please!! -- need to find command that will switch you back to your previous CWD Tron55555 Linux - General 2 05-15-2008 10:35 PM
Unix command to delete the previous and next line of the searched pattern navin29 Linux - Newbie 7 03-14-2008 01:23 PM
Timestamp of previous command issued benjaminrtz Linux - General 1 04-16-2005 01:53 AM
date command getting previous day swinchen Programming 6 08-23-2004 12:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:07 PM.

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