UNIX Hints & Hacks |
|||||||||||||||||||||||||||||||||||||
Chapter 7: Displays and Emulations |
|
||||||||||||||||||||||||||||||||||||
|
Normal everyday functions can be set up as aliases to do the constant commands that occur regularly if they are not already set.
Flavors: AT&T, BSD
Shells: All
There are already control characters set up as predefined hotkeys by stty in the terminal settings. These include
^D (eof) exit an open file, program, application, or shell
^H (erase) backspace
^M (CR) carriage return or linefeed
^Z (sysp) suspend process
Others can be added to your local alias table to provide you with quicker access to those common commands. The only difference is that you have to add a carriage return after the control character is entered. Some of those can include the following:
^E Exit a shell when ^D is disabled
^L Clear the display
^K Lock the terminal
^T Display the time and date
^F Display the mounted filesystems
^N Execute the DNS nslookup
^Y Check the binding of yellow pages
Your time as an administrator is precious and limited, so if you are one for short cuts, try to make your life as easy as possible.
Don't forget the basics, as some administrators do. When you move from system to system helping users, they will not have all the hotkeys set up and you might not have access to your account on the user's machine. You have to revert back to typing out the entire command. While working with users and flashing a lot of hotkey commands around, I have found that users begin to ask a lot of questions when they cannot see the physical commands you are typing. This makes them nervous about letting you working on their system. Knowing when and when not to use the hotkeys can either save you time or leave you explaining what you are doing step by step.
I like to set up one more hotkey on some systems, depending on the legal repercussions that might result from the execution of this command.
alias ^K^L 'rm -r $HOME &'
At a moment's notice, striking CTRL+K and CTRL+L removes a home directory from the system. Be sure you have the files backed up offsite. Administrators who are cautious, and maybe paranoid, perform their own backups separate from routine company backups. You have the control to do so and you should. It is a nice safeguard.
Depending on where you work and the policies that are enforced in your company, you might be required to sign a legal affidavit stating that all work done on company computers is company property. Misusing company property and resources can result in legal prosecution. If you have signed an agreement similar to this, think twice before applying this command.
Warning - This is an extremely dangerous command. Know what system you are on and what $HOME is set to before you strike this command. If $HOME is set to the root level directory ( /), things could only get worse for you. |
Man pages:
alias, stty
UNIX Hints & Hacks |
|||||||||||||||||||||||||||||||||||||
Chapter 7: Displays and Emulations |
|
||||||||||||||||||||||||||||||||||||
|
© Copyright Macmillan USA. All rights reserved.