<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0" xmlns:osnews="http://osnews.com/rss2#">
	<channel>
		<title>OSNews: </title>
		<link>http://www.osnews.com/story/20025/Ten_Handy_Bash_Aliases</link>
		<description>Exploring the Future of Computing</description>
		<language>en-us</language>
		<copyright>Copyright 2001-2009, David Adams</copyright>
		<webMaster>adam+nospam@osnews.com</webMaster>
		<lastBuildDate>Mon, 06 Jul 2009 19:05:39 GMT</lastBuildDate>
		<image>
			<url>http://www.osnews.com/images/osnews.gif</url>
			<title>OSNews.com</title>
			<link>http://www.osnews.com</link>
		</image>
		<item>
			<title>some more</title>
			<link>http://osnews.com/thread?322355</link>
			<guid isPermaLink="true">http://osnews.com/thread?322355</guid>
			<description>some that i've found useful and that were popular at my previous workplace:<br />
<br />
<i>Make common administration tasks go through sudo without having to type sudo:</i><br />
<br />
alias dpkg=&quot;sudo dpkg&quot;<br />
alias apt-get=&quot;sudo apt-get&quot;<br />
alias modprobe=&quot;sudo modprobe&quot;<br />
<br />
<i>Serve files from CWD via a webserver:</i><br />
<br />
alias serve=&quot;python2.5 -m SimpleHTTPServer&quot;<br />
<br />
<i>Color stuff; grep w/ less that doesn't mess it up </i><br />
<br />
alias ls=&quot;ls --color=auto -F&quot;<br />
alias grep=&quot;grep --color=auto&quot;<br />
alias less=&quot;less -R&quot;<br />
<br />
<i>open up files in existing vim session</i><br />
<br />
alias rvim=&quot;gvim --remote&quot;</description>
			<pubDate>Thu, 10 Jul 2008 16:48:00 GMT</pubDate>
			<author>donotreply@osnews.com (jonas)</author>
			<category>Comments</category>
		</item>

		<item>
			<title>rm alias</title>
			<link>http://osnews.com/thread?322357</link>
			<guid isPermaLink="true">http://osnews.com/thread?322357</guid>
			<description>I don't agree with the rm -i alias. I've gotten into the habit of explicitly using mv -i and rm -i (when using wildcards). If a user assumes rm will provide interactive feedback - i.e. because it's aliased that way on a couple systems - s/he may be very surprised when working on a system that does not.</description>
			<pubDate>Thu, 10 Jul 2008 16:54:00 GMT</pubDate>
			<author>donotreply@osnews.com (anomie)</author>
			<category>Comments</category>
		</item>

		<item>
			<title>Mine</title>
			<link>http://osnews.com/thread?322358</link>
			<guid isPermaLink="true">http://osnews.com/thread?322358</guid>
			<description>Instead of ssh aliases, I edit ~/.ssh/config to something similar:<br />
 host NAME<br />
     Hostname IPADDRESS<br />
     Port PORT<br />
     RemoteForward REMOTEPORT localhost:LOCALPORT<br />
 and then just &quot;ssh NAME&quot;<br />
 <br />
 And here are my most important aliases:<br />
 fichiers=/home/me/files<br />
 alias cdh='cd $fichiers'<br />
 alias cdt='cd $fichiers/downloads'<br />
 [...]<br />
 <br />
 alias burn_dvd_iso='growisofs -speed=2 -dvd-compat -Z /dev/dvdrw='<br />
 alias nano='nano -w'<br />
 alias screen=&quot;screen -U&quot;<br />
 alias df=&quot;df -h --print-type&quot;<br />
 alias du=&quot;du -h --max-depth=1 .&quot;<br />
 alias free='free -m'<br />
 alias grpe='grep'<br />
 alias top=&quot;htop&quot;<br />
 alias untar=&quot;tar -xvf&quot;<br />
 <br />
 # Find process<br />
 alias pss=&quot;ps aux | grep -i&quot;<br />
 <br />
 alias dc='cd'<br />
 alias sl='ls'<br />
 alias sls='ls'<br />
 alias l='ls'<br />
 alias rm='rm -i'<br />
 lsbase='/bin/ls -h --group-directories-first --color=auto'<br />
 alias ls=&quot;$lsbase -gG&quot;<br />
 alias lsg=&quot;$lsbase -l&quot;<br />
 alias la=&quot;$lsbase -la&quot;<br />
 <br />
 alias su='sudo -i'<br />
 alias shutdown=&quot;sudo shutdown&quot;<br />
 alias halt=&quot;sudo halt&quot;<br />
 alias nanos='sudo nano'<br />
 alias snano='sudo nano'<br />
 alias svim='sudo vim'<br />
 alias cpufreq-set='sudo cpufreq-set'<br />
 <br />
 And now functions, instead of alias. Allows you to give arguments:<br />
 # Diff svn workdir to head with kompare:<br />
 sdiff() {<br />
     svn diff $1 | kompare -o -<br />
 }<br />
 <br />
 I can't live without these <img src="/images/emo/smile.gif" alt=";)" /> Edited 2008-07-10 16:59 UTC</description>
			<pubDate>Thu, 10 Jul 2008 16:56:00 GMT</pubDate>
			<author>donotreply@osnews.com (big_gie)</author>
			<category>Comments</category>
		</item>

		<item>
			<title>RE: rm alias</title>
			<link>http://osnews.com/thread?322359</link>
			<guid isPermaLink="true">http://osnews.com/thread?322359</guid>
			<description>yeah that's true. But this is slower to type... and CLI is all about speed!<br />
I remember someone suggesting a different alias for &quot;rm -i&quot; like rmi...</description>
			<pubDate>Thu, 10 Jul 2008 16:58:00 GMT</pubDate>
			<author>donotreply@osnews.com (big_gie)</author>
			<category>Comments</category>
		</item>

		<item>
			<title>My .bashrc</title>
			<link>http://osnews.com/thread?322365</link>
			<guid isPermaLink="true">http://osnews.com/thread?322365</guid>
			<description>I have a lot of aliases to cd to specific directions.  I also have:<br />
<br />
# Can't even remember what it all does.  N is probably line numbers<br />
alias less='less -x4 -R -N'<br />
<br />
# Needs 256color support in the terminal<br />
PSCOLOR=&quot;214&quot; # or another color, each server i use has a different color<br />
export PS1=&quot;\033[38;5;${PSCOLOR}m\h\033[38;5;231m:\033[38;5;${PSCOLOR}m\w\n\0 33[38;5;231m#\033[0m  &quot;<br />
<br />
I also have a bunch on my .vimrc as well..</description>
			<pubDate>Thu, 10 Jul 2008 17:45:00 GMT</pubDate>
			<author>donotreply@osnews.com (sappyvcv)</author>
			<category>Comments</category>
		</item>

		<item>
			<title>put some of them in $home/.inputrc</title>
			<link>http://osnews.com/thread?322367</link>
			<guid isPermaLink="true">http://osnews.com/thread?322367</guid>
			<description>Nice tips, but i prefer to put them in my ~/.inputrc (linked to a function key)<br />
<br />
sample:<br />
~# grep apt .inputrc <br />
&quot;\e[17~&quot;: &quot;aptitude update &amp;&amp; aptitude safe-upgrade\n&quot;</description>
			<pubDate>Thu, 10 Jul 2008 17:56:00 GMT</pubDate>
			<author>donotreply@osnews.com (cobbaut)</author>
			<category>Comments</category>
		</item>

		<item>
			<title>..step 2, profit!</title>
			<link>http://osnews.com/thread?322370</link>
			<guid isPermaLink="true">http://osnews.com/thread?322370</guid>
			<description>Here's an alias for you...<br />
<br />
alias crap_article=&quot;history&gt;article.txt&quot;</description>
			<pubDate>Thu, 10 Jul 2008 18:06:00 GMT</pubDate>
			<author>donotreply@osnews.com (robinh)</author>
			<category>Comments</category>
		</item>

		<item>
			<title>RE: rm alias</title>
			<link>http://osnews.com/thread?322372</link>
			<guid isPermaLink="true">http://osnews.com/thread?322372</guid>
			<description>I always use &quot;rm -f&quot; anyway. <img src="/images/emo/tongue.gif" alt=";)" /></description>
			<pubDate>Thu, 10 Jul 2008 18:11:00 GMT</pubDate>
			<author>donotreply@osnews.com (Nico57)</author>
			<category>Comments</category>
		</item>

		<item>
			<title>Directory aliases</title>
			<link>http://osnews.com/thread?322375</link>
			<guid isPermaLink="true">http://osnews.com/thread?322375</guid>
			<description>I find the following two aliases to be very useful<br />
<br />
List only directories:<br />
alias lsd=&quot;ls -d */&quot;   <br />
<br />
take back to previous directory (cd - takes you to the previous directory):<br />
<br />
alias p=&quot;cd -&quot;</description>
			<pubDate>Thu, 10 Jul 2008 18:33:00 GMT</pubDate>
			<author>donotreply@osnews.com (amjith)</author>
			<category>Comments</category>
		</item>

		<item>
			<title>RE: ..step 2, profit!</title>
			<link>http://osnews.com/thread?322383</link>
			<guid isPermaLink="true">http://osnews.com/thread?322383</guid>
			<description>alias remove_crap_article=&quot;find ~/ -type f -exec perl -p -i -e 's/http:\/\/blogs.techrepublic.com.com\/10things\/\?p=352\&amp;tag=rbx ccnbtr1//'  {} \;&quot;<br />
<br />
<br />
Use this every time you mistakingly visit that article.</description>
			<pubDate>Thu, 10 Jul 2008 19:16:00 GMT</pubDate>
			<author>donotreply@osnews.com (libray)</author>
			<category>Comments</category>
		</item>

		<item>
			<title>RE: ..step 2, profit!</title>
			<link>http://osnews.com/thread?322390</link>
			<guid isPermaLink="true">http://osnews.com/thread?322390</guid>
			<description>rofl to death !<br />
the best thing I read today man !<br />
can't stop laughing !!<br />
<br />
_THANK_YOU_!</description>
			<pubDate>Thu, 10 Jul 2008 20:14:00 GMT</pubDate>
			<author>donotreply@osnews.com (gnemmi)</author>
			<category>Comments</category>
		</item>

		<item>
			<title>Aliases for FreeBSD</title>
			<link>http://osnews.com/thread?322426</link>
			<guid isPermaLink="true">http://osnews.com/thread?322426</guid>
			<description>Here are some nice aliases for use with FreeBSD.<br />
<br />
The obvious ls:<br />
alias   ls              'ls -FG'<br />
alias   ll              'ls -laFG'<br />
setenv  LSCOLORS        ExGxdxdxCxDxDxBxBxegeg<br />
<br />
Playing with the floppy disk:<br />
alias   flop            'tar cvjf /dev/fd0'<br />
alias   unflop          'tar xvjf /dev/fd0'<br />
<br />
Creating CDs:<br />
alias   burndata        'cdrecord -v -eject -tao -data'<br />
alias   burnaudio       'cdrecord -v -eject -dao -audio'<br />
<br />
Unmounting and ejecting (inconsequent implementation):<br />
alias  ucd             'umount /media/cdrom &amp;&amp; cdcontrol eject'<br />
alias  udvd            'umount /media/dvd &amp;&amp; cdcontrol eject'<br />
alias  uwr             'umount /media/writer &amp;&amp; cdcontrol -f /dev/acd1 eject'<br />
alias  ujaz            'umount /media/jaz &amp;&amp; camcontrol eject 0:4:0'<br />
alias  upd             'umount /media/pd &amp;&amp; camcontrol eject 0:1:0'<br />
alias  upcd            'umount /media/pcd &amp;&amp; cdcontrol -f /dev/cd0 eject'<br />
<br />
They should work with bash, as well as with csh (/etc/csh.cshrc).<br />
<br />
I will definitely keep a copy of the article and the corresponding discussion due to the many inspirations for further aliasing.<br />
<br />
Remember the recursion!<br />
$ alias alias alias<br />
Too dangerous to alias that<br />
:-)</description>
			<pubDate>Fri, 11 Jul 2008 02:10:00 GMT</pubDate>
			<author>donotreply@osnews.com (Doc Pain)</author>
			<category>Comments</category>
		</item>

		<item>
			<title>RE: rm alias</title>
			<link>http://osnews.com/thread?322477</link>
			<guid isPermaLink="true">http://osnews.com/thread?322477</guid>
			<description>i've aliased rm to essentially &quot;what ???&quot;<br />
so I have to type the full path /bin/rm<br />
and habitually use -iv &quot;always&quot;<br />
......................<br />
the time it takes to type &quot;/bin/rm -iv&quot;<br />
seems to prevent the hurriedly-typing <br />
errors (rm oops I meant cp) which<br />
otherwise could occur.  <br />
HAS WORKED for over 3 years great here<br />
.............................</description>
			<pubDate>Fri, 11 Jul 2008 10:14:00 GMT</pubDate>
			<author>donotreply@osnews.com (J-freebsd_98)</author>
			<category>Comments</category>
		</item>

		<item>
			<title>Comment by petrasl</title>
			<link>http://osnews.com/thread?322486</link>
			<guid isPermaLink="true">http://osnews.com/thread?322486</guid>
			<description><i>alias rm='rm -i'</i><br />
<br />
for Windows(TM) nostalgics</description>
			<pubDate>Fri, 11 Jul 2008 12:23:00 GMT</pubDate>
			<author>donotreply@osnews.com (petrasl)</author>
			<category>Comments</category>
		</item>

		<item>
			<title>RE[2]: rm alias</title>
			<link>http://osnews.com/thread?322509</link>
			<guid isPermaLink="true">http://osnews.com/thread?322509</guid>
			<description>Instead of typing &quot;/bin/rm&quot; you can always type &quot;\rm&quot; to escape the alias...</description>
			<pubDate>Fri, 11 Jul 2008 14:36:00 GMT</pubDate>
			<author>donotreply@osnews.com (big_gie)</author>
			<category>Comments</category>
		</item>

		<item>
			<title>Some of my bash aliases</title>
			<link>http://osnews.com/thread?322602</link>
			<guid isPermaLink="true">http://osnews.com/thread?322602</guid>
			<description><i># print the boot time</i><br />
<br />
alias boottime=&quot;date --date=@$(grep btime /proc/stat | gawk '{print $2}') +'%a %b %d, %r'&quot;<br />
<br />
<i># recursizely clean backup files (*~)</i><br />
<br />
alias clean='find -type f \( -name &quot;*~&quot; -or -name &quot;.*~&quot; \) -print0 | xargs --null --no-run-if-empty rm --verbose'<br />
<br />
alias clean1='find -maxdepth 1 -type f \( -name &quot;*~&quot; -or -name &quot;.*~&quot; \) -print0 | xargs --null --no-run-if-empty rm --verbose'<br />
<br />
alias clean2='find -mindepth 2 -type f \( -name &quot;*~&quot; -or -name &quot;.*~&quot; \) -print0 | xargs --null --no-run-if-empty rm --verbose'<br />
<br />
alias d='ls -hop --color'<br />
<br />
<i># move items to a trash directory (~/Trash.$USER)</i><br />
<br />
alias del='mv --verbose --backup=simple --suffix=$(date +&quot;.(%F_%T)&quot;) --target-directory=$HOME/Trash.$USER/'<br />
<br />
<i># list dir sizes</i><br />
<br />
alias dir-sizes='du --separate-dirs --bytes | sort --numeric-sort'<br />
<br />
<i># list file sizes</i><br />
<br />
alias file-sizes='find -type f -printf &quot;%s %p\n&quot; | sort --numeric-sort'<br />
<br />
<i># fancy formatting for ps</i><br />
<br />
alias ps1='ps --forest --headers -e                 --sort pid'<br />
<br />
alias ps2='ps --forest --headers -U root -u root -N --sort pid'<br />
<br />
alias ps3='ps --forest --headers -U $USER -u $USER  --sort pid'<br />
<br />
<i># recursively remove empty folders<br />
# (while there are empty folders, remove empty folders)</i><br />
<br />
alias rmdirempty='while [[ -n $(find -mindepth 1 -empty -type d -printf 1 -quit) ]] ; do find -mindepth 1 -empty -type d -print0 | xargs --null --no-run-if-empty rmdir --verbose ; done'<br />
<br />
<i># remove empty files</i><br />
<br />
alias rmempty='find -empty -type f -print0 | xargs --null --no-run-if-empty rm --verbose'<br />
<br />
<i># remove old files (uses -mtime -1)<br />
# be careful!</i><br />
<br />
alias rmold='find -type f -daystart -not -mtime -1 -print0 | xargs --null --no-run-if-empty rm --verbose'<br />
<br />
<i># remove orphans</i><br />
<br />
alias rmorphan='find -xtype l -print0 | xargs --null --no-run-if-empty rm --verbose'<br />
<br />
<i># empty trash directory<br />
# print the number of items deleted<br />
</i><br />
alias trash=&quot;rm --force --recursive --verbose ~/Trash.$USER/* ~/Trash.$USER/.*[^.]* | wc --lines | gawk '{if(\$1 == 1) {print \&quot;1 item removed\&quot;} else {print \$1 \&quot; items removed\&quot;}}'&quot;</description>
			<pubDate>Sat, 12 Jul 2008 03:52:00 GMT</pubDate>
			<author>donotreply@osnews.com (supersteve1440)</author>
			<category>Comments</category>
		</item>

		<item>
			<title>One I always use...</title>
			<link>http://osnews.com/thread?322605</link>
			<guid isPermaLink="true">http://osnews.com/thread?322605</guid>
			<description>alias clh=&quot;history -c &amp;&amp; exit&quot;<br />
<br />
This will allow you to clear the bash history and then send the exit command by simply typing &quot;clh&quot;.  If you've got a terminal opened and have used su to become root or another user, typing this in will clear root's (or whoever you've switched to) bash history and then return you to your original user.  If you're yourself (ie. haven't used su to become root), it will clear your own history and close the terminal.  Of course, it has to be in the .bashrc files of any user who wants to use it (in my case, both my own personal home and /root).  This will also completely wipe out the history, which may not be desired by everyone.</description>
			<pubDate>Sat, 12 Jul 2008 04:41:00 GMT</pubDate>
			<author>donotreply@osnews.com (UZ64)</author>
			<category>Comments</category>
		</item>

		<item>
			<title>powershell? nah</title>
			<link>http://osnews.com/thread?322629</link>
			<guid isPermaLink="true">http://osnews.com/thread?322629</guid>
			<description>if test &quot;$UID&quot; != &quot;0&quot;; then<br />
  umask 077<br />
 fi<br />
 if test &quot;$UID&quot; != &quot;0&quot;; then<br />
 chmod go-rwx -R $HOME/.<br />
 fi<br />
 if test &quot;$UID&quot; != &quot;0&quot;; then<br />
 chmod +t -R $HOME/*<br />
 fi<br />
 <br />
 in /etc/profile<br />
<br />
Can MS powershell do the same?<br />
<br />
Enough said.Edited 2008-07-12 13:16 UTC</description>
			<pubDate>Sat, 12 Jul 2008 13:15:00 GMT</pubDate>
			<author>donotreply@osnews.com (netpython)</author>
			<category>Comments</category>
		</item>

		<item>
			<title>RE: powershell? nah</title>
			<link>http://osnews.com/thread?322630</link>
			<guid isPermaLink="true">http://osnews.com/thread?322630</guid>
			<description>yeah it can, the only difference is that the windows security model is way more complex then the UNIX one.</description>
			<pubDate>Sat, 12 Jul 2008 13:33:00 GMT</pubDate>
			<author>donotreply@osnews.com (google_ninja)</author>
			<category>Comments</category>
		</item>
	</channel>
</rss>
