Unix tip: Useful Unix aliases
Unix aliases provide an easy way to customize your working environment. Let's look at some especially useful aliases that you might like.
View full article »
Esther Schindler
If the comments are ugly, the code is ugly
claird
SVG a graphics format for 21st century
pasmith
Take Chrome OS for a test spin
Sandra Henry-Stocker
Solaris Tip: Have Your Files Changed Since Installation?
jfruh
Android fragments vs. the iPhone monolith
mikelgan
What Gizmodo missed about the Pro WX Wireless USB disk drive
Sidekick: The Good News & the Bad News
Either way you look at it Microsoft Data Center management did not follow standards or best practices in this failure. In which case it makes me wonder more about the outsourcing of corporate data much less personal data.
- mburton325
Join the conversation here
Quick, practical advice for IT pros. Made fresh daily.
Want to cash in on your IT savvy? Send your tip to tips@itworld.com. If we post it, we'll send you a $25 Amazon e-gift card.













Aliases etc.
Thanks - there were some useful aliases in your latest article. You might like this function, which I find very useful when looking for permission errors:lsdup() {
here=$(pwd)
while true
do
print "$(ls -ld) $PWD"
cd ..
[ $PWD = "/" ] && break
done
cd $here
}
moving to previous directory
To go back to the previous directory I just use "cd -". No special alias is required. But what if you're working amongst three directories? What's a good way to quickly set up shortcuts which allow to bounce between them?aliases
You may not want to aliase rm -i as rm, especially if you use rm to remove files, etc using a script in cron, using the next choice would be better.grep through code
Here's one I like to use, this one for Python applications, but easy to set up for other languages as well:alias greppy="find . | grep -v [.]svn | grep -v bundle | grep [.]py$ | xargs grep "Beginning with the current directory, look for all of the Python files that are not part of subversion, not part of a bundle, skipping those that are like .py~ and .pyc, and pass those to grep.
Use of alias for rm -1
Regarding the comment on not aliasing rm to 'rm -i' due to its effect in scripts:An alias shouldn't make any difference in scripts, as scripts should have hard paths for commands.
Scripts should contain something like this:
RM=/bin/rm
LS=/bin/ls
...
rm is then called in the script as $RM
There are at least 2 reasons for doing so:
* Your script will always run /bin/rm, not some script or executable named 'rm' that appears somewhere in your PATH
This is the same reason you probably don't want ./ in your path
* The PATH value becomes irrelevant to the running of frequently used commands in the script.
Personally, I use a function hardpath() that determines the location of each executable within a predetermined set of directories, and sets the requisite variable to that location. The script fails if a required executable is not found in the path set.
CD between 3 directories quickly
THE CODE:cdA()
{
A_old_dir=$PWD
[ ! -z $* ] && A_new_dir=$*
cd $A_new_dir
}
cdB()
{
B_old_dir=$PWD
[ ! -z $* ] && B_new_dir=$*
cd $B_new_dir
}
cdC()
{
C_old_dir=$PWD
[ ! -z $* ] && C_new_dir=$*
cd $C_new_dir
}
alias ,a=cdA
alias ,b=cdB
alias ,c=cdC
# I use a comma as a shortcut to 'cd'
# Both begin with a comma.
# Now ,a is easier than cdA
# Your choice, name them anything.
# try these
,a /usr/local/bin # puts you in specified directory
,b /var/adm
,c /usr/bin
# now use just the alias (no directory)
,a # puts you in /usr/local/bin
,c # puts you in /var/adm
,c # puts you in /usr/bin
# and my two favorite cd-related shortcuts
alias ,=cd # cd to a directory
alias ,,='cd -' # cd back to the previous directory
# I picked parts of these up over the years doing
# UNIX support. I've tweaked them and made them
# do what I've needed. Have fun.
typos - CD between 3 directories quickly
I meant to say that 'cd' and comma both begin with a 'c', that's how I remember it.Also, in the 'now use just the alias' section, the second one should be ,b (not ,c).
Ciao
Unix alias
Some more information about unix alias commandreplica bags
If I didn't read this artcle ,I wounldn't believe these things replica bags happened in the world . Why people are always replica handbags so stoniess to others ? Man are really stupy creature.ake-prada-bags
ush Valention handbag replica up calculator, notebook, cheap Coach handbags etc)Such watches are cheap Bottega Veneta handbags usually dulled by handbags replica ever changing and cheap replica handbag dynamic family who Dolce&Gabbana handbag replica seal not stutter cheap LouisVuitton Wallets & Purse handbags to bring decisions. Coach handbags They promote non-standard replica handbags solutions further they cheap Mulberry handbags discharge Chloe knockoff handbags replica handbag Fendi knockoff handbags cheap Fendi handbags Prada handbags replica Mulberry handbags designer inspired Christian Dior Mulberry handbags replica cheap Hermes handbags knockoff gucci