Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command history in csh (amateur question)

Status
Not open for further replies.

JAFrank

Technical User
Nov 16, 2002
84
US
Is there a way to use the command history in csh in the same way that you can in bash, or even DOS (Doskey)?

I love the way you can use your arrow keys to scroll through the command history with the arrow keys and edit recent commands right on the command line.

I have read the man pages on history, and have tried out !! and !(historyid), but they run the command as soon as I hit Return - is there a way to get a recent command back on the command line and edit it prior to running it again?

Thanks!

Allen
 
You could use tcsh, same as csh but with more tools. It is free. Too bad I.T. is not cash business

Luc Foata
Unix sysadmin, Oracle DBA
 
I use ksh and the Esc-k command will bring up the last command run, then you can continue hitting the k command until you have the one you want. I then use vi editor commands to change it. make sure you export EDITOR=vi. This is a pretty simplistic way of doing repetitive commands without having to re-type them.....
 
in your .login enter
set history=1000
in .cshrc
alias h 'history 20'
alias hh 'history|more'
if you will repeat a cmd type h\n if you did not find it type hh\n
you get:
1: ls
2: ls qqq
3: make all
to repeat ls enter
!l OR !1
to repeat make enter
!m OR !?al OR !3
to repeat ls qqq enter
!?q OR !2
man pages are very usefull.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top