Hi,
I am using SunOS
I want to serch my previous command
from unix prompt
(like on AIX we can search by ESC -k)
how to get in SunOs
urgent help require.
Hi,
I am using SunOS
I want to serch my previous command
from unix prompt
(like on AIX we can search by ESC -k)
how to get in SunOs
urgent help require.
If you are on Bash or Ksh then you could use "history" command. "history n" lists the last n commands.
tyler_durden
try
set -o vi
I do not want to go through all history .
I want to get display cmd one by one and on my required one i will press enter key
or search previous cmd by pattern on prompt and when it display on prompt just enter and run .
please help me
do you try set -o vi, then ESC-k ?
when trying : set -o vi
getting error like-
: set: Syntax error
Hi.
That's a csh error.
In csh you can recall the history of the last command using !!, and other commands using the history
command or !10
for a specific command from the history.
% set history=200
% history
4 set history=100
5 history
% !5
history
4 set history=100
5 history
6 history
% !!
history
4 set history=100
5 history
6 history
7 history
The command for setting a vi-like mode to the tcsh shell is
bindkey -v
In my home dir
.profile
.boks_uenv
.cshrc
..
esin
personal.cshrc
myprog
.kshrc
while running :
bindkey -v
bindkey: Command not found
please suggest
.
---------- Post updated at 07:09 AM ---------- Previous update was at 07:05 AM ----------
!!, !3 etc works but I don't know the no. of cmd and want to search
like in AIX-ksh I was doing by Esc / and then type search pattern OR doing ESC-K and continue till get desire cmd.
help me
per the csh man page on Solaris. it looks like the Solaris csh does not support bindkey. it's different then using vi mode with ksh on AIX but it provides similar functionality. If you can I suggest changing your login shell to ksh or just run ksh after logging in.
Event Designators
An event designator is a reference to a command line entry
in the history list.
! Start a history substitution, except when followed by
a space character, tab, newline, = or (.
!! Refer to the previous command. By itself, this substi-
tution repeats the previous command.
!n Refer to command line n.
!-n Refer to the current command line minus n.
!str Refer to the most recent command starting with str.
!?str?
Refer to the most recent command containing str.
!?str? additional
Refer to the most recent command containing str and
append additional to that referenced command.
!{command} additional
Refer to the most recent command beginning with com-
mand and append additional to that referenced command.
^previous_word^replacement^
Repeat the previous command line replacing the string
previous_word with the string replacement. This is
equivalent to the history substitution:
!:s/previous_word/replacement/.
To re-execute a specific previous command AND make
such a substitution, say, re-executing command #6,
!:6s/previous_word/replacement/.
If not, just run:
ksh -o vi
and then you would be able to use ESC+K to recall previous commands.
Let us know