Using Unix

Hi,
Im a beginner in unix.

How can i get the command which i typed in an xterm earlier by typing the first few letters ....with out using those up/down key stuff and history command...???

thanks
Alex

try like this

# history -a
# sed = "/root/.bash_history" | sed -e N -e 's/\(.*\)\n\(.*\)/\1. history command->  \2/'
.......
.......
15. history command->  service jbossas status
16. history command->  echo "Hello World"
17. history command->  cat /etc/services
18. history command->  history -w
.......
.......

in ksh you can use "ctrl+r" to search through the command history...

Hi DukeNuke2, ctrl-r is in bash . In ksh it is esc-k and then repeated k presses to go backward and j to go forward, or use /<search term> to search for the previous commands and then repeated / to go furter back with that search term, ? to go forward. "set -o vi" should be set beforehand...

Thanks for yr replays...

I am using TCSH. is there any specific way to do for that. I have seen som people typing first few letters of any of the previous commands and using some keyboard shortcuts getting all the cmds starting with those letters...
hw is that done?????

probably using the key combo ESC-p

i.e. type in start of line then hit ESC and p together.

try a "man tcsh" and read the section on history searching.

:slight_smile:

1 Like

thanks dude...this is what i was looking for :slight_smile: