views:

514

answers:

19

Which one alias would you choose to keep if your .bash_alias/.bashrc/etc could only contain one line?

A: 
alias py='python2.5 -O'
ΤΖΩΤΖΙΟΥ
A: 
alias ss="script/server"

Clearly, I work in Rails most of the time. :)

ctcherry
+4  A: 

alias ls="ls --color"

Dark Shikari
If you think that "color" is actually spelled "colour", try this: http://ubuntuforums.org/showthread.php?t=684239
Ryan Thompson
+1  A: 

alias s="cd .."

Silly,but you cd all the time :)

Vhaerun
Why not just alias '..="cd .."'?
Yaba
A: 

alias prompt='PS1='\''[\e[7m]\u@\h \A $\w>[\e[27m] '\'''

It's just too difficult to type each time you log on, and all the other dbas don't like the oracle user to have a non-default prompt.

Jonathan
Can you not set PS1 in your .bashrc or whatever startup file you use? (Say, `export PS1="...."`)?
dbr
He already stated that the others using the same logon dislike non-default prompts.
ΤΖΩΤΖΙΟΥ
A: 
### SSH That tunnels X stuff (even through NAT)
alias 'xssh'='ssh -X -C -Y'
I always found ~/.ssh/config a much better place for configuring various hosts and their options
ΤΖΩΤΖΙΟΥ
+2  A: 
alias histgrep=history | grep

So I can find past commands very quickly by just typing

histgrep <part of command>

As well as

alias psgrep=ps -ef | grep

to quickly find out, if a specific process is still running.

Yaba
+1  A: 

alias ll="ls -al --color=auto"

The first thing I do when entering a new server; Gives much better readable dirlistings :)

D4V360
+1  A: 

My favourite is probably:

alias ff=find . -name $1

For more aliases, my complete bash profile is here

dogbane
If you want to be on-topic per the question requirements, you better edit your answer and turn it into a one-liner.
ΤΖΩΤΖΙΟΥ
+2  A: 
alias clean='rm -rf "#"* "."*~ *~ *.bak *.dvi *.aux *.log'

To clean unnecessary files from the current folder.

Rich Adams
+4  A: 

Not technically an alias, but it removes the need for a majority of them..

source /etc/bash_completion
dbr
+1  A: 
alias sl=ls

How many times a day does your left hand get the "s" out before your right hand can get the "l" out? :)

bstaz
similarly: alias mroe=more
Brian Postow
Or just install the "steam locomotive" package from your package manager. Often abbreviated "sl".
Ryan Thompson
+1  A: 

here's my Windows "alias" that I put on all the Windows computers I use:

c:\windows\ls.bat

dir $1 $2 $3 $4
nickf
+1  A: 

alias webshare='python -c "import SimpleHTTPServer;SimpleHTTPServer.test()"'

Chris
That is pretty neat.
Ryan Thompson
`alias webshare='python -m SimpleHTTPServer'` works, too.
Boldewyn
+1  A: 

I use dvorak keyboard, so my most important one is:

alias no=ls -f

my other favorite is:

alias devn='cat > /dev/nul'

Which lets me type random crap to myself without worrying whether it will ever get saved...

Brian Postow
A: 

My most frequently used ones:

alias la='ls -a -l'
alias ll='ls -l'
alias cats='konqueror http:'//icanhazcheezburger.com''

The last on is just a joke

Chase
Did you mean `alias cats="lynx http://ascii.icanhazcheezburger.com"`?
takeshin
+2  A: 
sudo apt-get install trash-cli; alias rm=trash

I like it when destructive commands have undo buttons. It also makes deleting happen faster, and I don't have to specify -r to delete recursively.

Ryan Thompson
Ironically, if you do this, then `mv` becomes the most dangerous command. I wish there was a way to trash files instead of overwriting them with mv.
Ryan Thompson
+1  A: 
#Useful find command to grep recursively for a string, usage "f blah"
alias f='find . | tr "\n" "\0" | xargs -0 grep'

#Some handy backtracking commands
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'

#Reload .bashrc good for when working with new aliases :-)
alias resource='source ~/.bashrc'

#Good if on cygwin and have notpad++ installed
alias edit='"/cygdrive/c/program files/notepad++/notepad++.exe"'

#This one prints out a treelike structure of directories.
alias tree='ls -R | grep ":$" | sed -e "s/:$//" -e "s/[^-][^\/]*\//--/g" -e "s/^/   /" -e s/-/|/"'
A: 

Found another handy one here on stackoverflow from Sanjaya R:

alias mkcd='_(){ mkdir $1; cd $1; }; _'

That's like mkdir foo; cd foo by just calling mkcd foo.

See the details on: http://stackoverflow.com/questions/941338/shell-script-how-to-pass-command-line-arguments-to-an-unix-alias/941390#941390

Jan