http://techrepublic.com.com/5138-10877-5827301.html
What is your favorite bash command; what trick, tip, tool, or shortcut is missing from this download? Do you prefer a different Linux shell?
Discussion on:
View:
Show:
I started to work with Unix (Solaris and AIX) before I took on Linux, and I have three observations to make on your article:
1. While its true that all this shortcuts are very useful when using the bash shell, it's also good to point out that they also exists in one form or another in other Unix/Linux shells as ksh or csh.
2. For me what really makes bash/korn shell/cshell really powerful is their solid scripting abilities, allowing complex manipulations and using the popular piping method of interchanging information between applications, long before visual basic scripting in Windows.
3. And last, but not least, no Unix/Linux shell discussion would be complete without mentioning two venerable tools, frequently used in shell scripting: sed and awk. Although both are cryptical and intimidating for the novice, they can prove very useful and powerful for many system administration tasks, such as analyzing and processing long log files from the innumerable Unix/Linux services.
1. While its true that all this shortcuts are very useful when using the bash shell, it's also good to point out that they also exists in one form or another in other Unix/Linux shells as ksh or csh.
2. For me what really makes bash/korn shell/cshell really powerful is their solid scripting abilities, allowing complex manipulations and using the popular piping method of interchanging information between applications, long before visual basic scripting in Windows.
3. And last, but not least, no Unix/Linux shell discussion would be complete without mentioning two venerable tools, frequently used in shell scripting: sed and awk. Although both are cryptical and intimidating for the novice, they can prove very useful and powerful for many system administration tasks, such as analyzing and processing long log files from the innumerable Unix/Linux services.
One of these days, I'll learn sed and awk. It just seems superfluous with tools like Perl at my fingertips.
I can't bring myself to learn Perl. I know it's powerful and well suited to text manipulation and parsing, but the language is too irregular for me. I know REs well, so I can do useful things with sed (mostly just the s(ubstitute) command), but I do a great deal with awk (usually gawk). It is really powerful for parsing and the C-based language is straightforward. Try them, you might like them!
Point 2 refers to creating aliases. While bash supports aliases, they are considered deprecated in favor of shell functions. That latter are more powerful and flexible and should be preferred. The example which changes ls to ls -l can be written thus:
ls()
{
command ls -l
}
Here, the command builtin is necessary to avoid a recursive call to the new ls shell function. (In this regard, using a shell function is slightly more complicated.)
That same point also failed to mention how one would ensure that the alias (or shell function) so defined would be available to subsequent shells. Indeed, one must define them in a file, such as .bashrc, for each subsequent interactive shell to provide the same functionality.
In point 4, the author discussed a number of command line editing keys. However, it should be noted that those are the default key bindings and that "set -o vi" will enable vi command line editing bindings. As before, such a setting must be encoded in a startup file (.bashrc is again the likely place).
Point 7 fails to mention that the CDPATH must be saved in a startup file (.bashrc). Likewise, point 9's changes to PS1 will be lost unless saved in a startup file (yep, .bashrc again).
ls()
{
command ls -l
}
Here, the command builtin is necessary to avoid a recursive call to the new ls shell function. (In this regard, using a shell function is slightly more complicated.)
That same point also failed to mention how one would ensure that the alias (or shell function) so defined would be available to subsequent shells. Indeed, one must define them in a file, such as .bashrc, for each subsequent interactive shell to provide the same functionality.
In point 4, the author discussed a number of command line editing keys. However, it should be noted that those are the default key bindings and that "set -o vi" will enable vi command line editing bindings. As before, such a setting must be encoded in a startup file (.bashrc is again the likely place).
Point 7 fails to mention that the CDPATH must be saved in a startup file (.bashrc). Likewise, point 9's changes to PS1 will be lost unless saved in a startup file (yep, .bashrc again).
- Keyboard Shortcuts:
- Prev
- Next
- Toggle

































