LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > AIX
User Name
Password
AIX This forum is for the discussion of IBM AIX.
eserver and other IBM related questions are also on topic.

Notices

Reply
 
LinkBack Search this Thread
Old 09-01-2007, 11:28 AM   #1
Vilius
Member
 
Registered: Jan 2006
Location: Lithuania
Distribution: CentOS, Debian
Posts: 184

Rep: Reputation: 15
Repeat last entered command ?


Hi,
how to do that ? I mean only print it but not execute. I'm using putty to interact with ksh.
(in windows cmd up arrow does the job)

thanks
vilius
 
Old 09-01-2007, 12:31 PM   #2
bsdunix
Senior Member
 
Registered: May 2006
Distribution: Caldera, CTOS, Debian, FreeBSD, Mac OS X, Mandrake, Minix, OpenBSD, Slackware, SuSE
Posts: 1,757

Rep: Reputation: 78
I pressume your looking for command history?

http://www.ahinc.com/aix/kornsh.htm

http://publib.boulder.ibm.com/infoce..._prev_cmds.htm

Last edited by bsdunix; 09-01-2007 at 12:35 PM.
 
Old 09-01-2007, 12:48 PM   #3
Vilius
Member
 
Registered: Jan 2006
Location: Lithuania
Distribution: CentOS, Debian
Posts: 184

Original Poster
Rep: Reputation: 15
I was looking a way to speed up my input, typing history is not a decision here.
 
Old 09-01-2007, 01:28 PM   #4
bsdunix
Senior Member
 
Registered: May 2006
Distribution: Caldera, CTOS, Debian, FreeBSD, Mac OS X, Mandrake, Minix, OpenBSD, Slackware, SuSE
Posts: 1,757

Rep: Reputation: 78
As far as I know, bash and tcsh are the only shells that support arrow up/down command history.

http://www.linuxquestions.org/questi...1&postcount=10

http://kb.iu.edu/data/abdj.html
 
Old 09-01-2007, 05:17 PM   #5
Vilius
Member
 
Registered: Jan 2006
Location: Lithuania
Distribution: CentOS, Debian
Posts: 184

Original Poster
Rep: Reputation: 15
It's almost exactly what I wanted - just one more thing - if I hit Esc key I enter vi editing mode - but how to leave this mode without entering comand( if I press enter kay vi mode is gone ) ?
 
Old 09-02-2007, 07:44 AM   #6
baznz
LQ Newbie
 
Registered: Oct 2005
Posts: 19

Rep: Reputation: 1
Quote:
Originally Posted by Vilius View Post
It's almost exactly what I wanted - just one more thing - if I hit Esc key I enter vi editing mode - but how to leave this mode without entering comand( if I press enter kay vi mode is gone ) ?
Just hit Ctrl+c
 
Old 09-05-2007, 03:41 AM   #7
opeyrega
LQ Newbie
 
Registered: Feb 2006
Location: Machecoul Fr
Distribution: fedora
Posts: 17

Rep: Reputation: 0
esc and key k
 
Old 09-13-2007, 03:23 AM   #8
bluesgone
LQ Newbie
 
Registered: Jul 2005
Location: Guangzhou,China
Distribution: aix5.3
Posts: 11

Rep: Reputation: 0
Quote:
Originally Posted by Vilius View Post
Hi,
how to do that ? I mean only print it but not execute. I'm using putty to interact with ksh.
(in windows cmd up arrow does the job)

thanks
vilius
What is putty command? I input putty in commandline, doesn't work.
ksh is a good shell, when you add "set -o vi" into .profile, you can
use vi to edit your command, that is an interesting thing. To get your
last command, you can first press 'Esc' key, then press 'K' key, that is all.
 
Old 09-13-2007, 02:46 PM   #9
DukeSSD
Member
 
Registered: Sep 2007
Posts: 87

Rep: Reputation: 20
PuTTY is a client program for the SSH, Telnet and Rlogin network protocols.

http://www.chiark.greenend.org.uk/~sgtatham/putty/
 
Old 12-10-2007, 08:42 AM   #10
naren_0101bits
Member
 
Registered: Jul 2004
Location: Guntur
Posts: 44

Rep: Reputation: 15
In your .profile make an entry
set -o vi

and then you can just use <ESC>k to get the last typed command just as opeyrega said.


------
Naren
 
Old 12-14-2007, 06:24 AM   #11
bluesgone
LQ Newbie
 
Registered: Jul 2005
Location: Guangzhou,China
Distribution: aix5.3
Posts: 11

Rep: Reputation: 0
Quote:
Originally Posted by naren_0101bits View Post
In your .profile make an entry
set -o vi

and then you can just use <ESC>k to get the last typed command just as opeyrega said.


------
Naren
I'm working under linux or AIX, alias r='fc -e -'
-e Editor Edits commands using the specified editor. The Editor parameter should
be a command name. The command is located using the PATH environment variable.
The value in the FCEDIT environment variable is used as a default when the -e flag is not specified. If the FCEDIT environment variable is null or unset, the ed editor is used.

For example, input "r vi", you can call your last "vi " command,
if your last vi command is " vi Iloveyou.c", the command will be interpreted again by the shell after you input "r vi", this little tool
is very useful when you work with unix, the alias command is also very useful, coz' it can save a lot of time.
 
Old 12-14-2007, 02:11 PM   #12
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , Solaris 10, RHEL
Posts: 1,927
Blog Entries: 1

Rep: Reputation: 176Reputation: 176
I always thought it was:

Code:
host1# !!
It works in bash, ksh, csh

-C
 
Old 12-20-2007, 08:02 AM   #13
bluesgone
LQ Newbie
 
Registered: Jul 2005
Location: Guangzhou,China
Distribution: aix5.3
Posts: 11

Rep: Reputation: 0
Smile

Quote:
Originally Posted by custangro View Post
I always thought it was:

Code:
host1# !!
It works in bash, ksh, csh

-C
what is !! command? It can't work under AIX, I input !! command in Linux, got "Connection close" and exit.
 
Old 12-20-2007, 11:54 AM   #14
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , Solaris 10, RHEL
Posts: 1,927
Blog Entries: 1

Rep: Reputation: 176Reputation: 176
I don't know about AIX but !! means "the last command entered" so if it closed your connection in Linux it most likely means that the last command entered was "exit". Test it buy logging into a Linux machine and type: ls then type: !!
 
Old 12-21-2007, 09:33 PM   #15
bluesgone
LQ Newbie
 
Registered: Jul 2005
Location: Guangzhou,China
Distribution: aix5.3
Posts: 11

Rep: Reputation: 0
Quote:
Originally Posted by custangro View Post
I don't know about AIX but !! means "the last command entered" so if it closed your connection in Linux it most likely means that the last command entered was "exit". Test it buy logging into a Linux machine and type: ls then type: !!
OK, I've got it, thank you. But I think vi mode is better than !!,
coz it can search all the command you've input, and it enable you
to edit your command.
 
  


Reply


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
configure bash to echo out the command entered? jrfk2 Linux - General 1 01-18-2007 12:03 PM
how-to: repeat OR iterate shell OR bash command delay OR interval admarshall Linux - General 5 07-18-2005 10:47 PM
Command to repeat another command every x seconds jimieee Linux - General 6 06-15-2005 07:52 AM
Cannot login since I entered chmod command? gopikrish Linux - Software 3 08-20-2004 05:44 PM
Boots to CD, then says no CD entered Nevermore Fedora - Installation 2 07-03-2004 09:57 AM


All times are GMT -5. The time now is 03:01 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration