set filec
Filename completion allows you to enter the first character or two of a command or file name and then press the Escape key to have the shell complete the name. This is useful when you have long filenames with many suffixes. If more than one file or directory or command matches the characters you have given, the shell completes as much as possible of the name, and then prompts you with a beep for more information. You can also use the <Ctrl-D> character to select all files or directories that match your given characters.
ps -ef | grep commandname
The pipe character directs the shell to use the output of the ps command as the input to the grep command. The result is that all instances of the command commandname in the process list are printed on the screen, saving the administrator the effort of searching through the process listing.
ls -CF | more
This command line executes the ls command with certain options and ensures that if the output is greater than a screenful it will be stopped until you have read it. However, it would be tedious to type the whole command each time you wanted to see a directory listing in your preferred format. Therefore, you should create an alias. You can alias the above command line to any series of keystrokes you like. You can even alias it to "ls," thus bypassing the standard meaning of the ls command.
When you create the alias, however, be aware that any command that requires one or more arguments, or one such as ls that may or may not receive arguments, must have a provision made in the alias for those arguments. The standard provision made in aliases for possible arguments is the following regular expression:
\!*
The leading backslash escapes the initial meaning of the exclamation point to the shell and passes the exclamation point through to the command line, where it is interpreted by the shell to refer to arguments given on the aliased command line. The asterisk in the expression means that all characters typed in as arguments are to be passed through to the shell. As an example, the line you place in your .cshrc file to create the example alias is:
alias ls 'ls -CF \!* | more'
Then, when you type the command:
ls filename
at your shell prompt, the command is executed as:
ls -CF filename | more
Aliases can be used freely within shell scripts, with filename completion and full use of regular expressions and output redirection.
!!
To execute the most recent command beginning with the letter "q," use the command line:
!q
And to execute a command by its number in the history, give the command line:
!n
where n is the number of the previous command you wish to re-execute.