- Discovering What Shell You're Using
- Understanding Shells and Options
- Changing Your Shell with chsh
- Changing Your Shell Temporarily
- Using Completion in the bash Shell
- Viewing Session History in the bash Shell
- Using Completion in the zsh Shell
- Viewing Session History in the zsh Shell
- Using Completion in the ksh Shell
- Viewing Session History in the ksh Shell
- Viewing Session History in the csh Shell
- Changing Your Identity with su
- Fixing Terminal Settings with stty
- Exiting the Shell
Viewing Session History in the csh Shell
If you're a C programmer (or have C programmers to turn to for help), csh might be a good shell for you because the syntax is quite similar to the C programming language.csh doesn't offer command completion, but the history capabilities are fairly similar to those of bash or zsh (see Code Listing 3.14). In general, csh is a powerful scripting shell (and acceptable interactive shell) for those who take the time and effort to become familiar with it.
Code Listing 3.14. csh also lets you recycle commands by number, although other history functions are not available.
xmission> history 1 ls 2 vi temp.info 3 ls 4 cd pub* 5 ls 6 cp *.pdf .. 7 cd .. 8 rm *.pdf 9 history 10 lynx 11 ftp ftp.wustl.edu 12 ls 13 vi .plan 14 finger firstname.lastname@example.org 15 history 16 finger email@example.com 17 ls 18 pine 19 history 20 lynx 21 history xmission> !12 ls Desktop files tmp bin a.out xmission>
To view session history in the csh shell:
- If you haven't already, use the shell for a little while, changing directories, redirecting output, or doing other tasks.
Type history at the shell prompt to see the list of the most recent commands you've entered. Note the number of each command line (Code Listing 3.14).
Type ! followed by the command number (no space in between) to rerun one of the commands. In this example, we're rerunning command 10.