# Enable some colors
alias ls="ls -G"
# Gimme details and size in KB, MB or GB, I'm not good reading bytes
alias l="ls -lh"
# SSH aliases
alias moe="ssh moe.warp.es"
# I always misspelled that one
alias mow=moe
alias ebox="ssh root@ebox"
alias amedias="ssh amedias.org"
alias rssh="ssh -l root"
# Git alias
ci="git ci" # Formerly svn ci
# Jump to github from repository
alias github="git config -l | grep 'remote.origin.url' | sed -n \
's/remote.origin.url=git@github.com:\(.*\)\/\(.*\).git/https:\/\/github.com\/\1\/\2/p' \
| xargs open"
# MySQL
alias myserver="sudo /usr/local/mysql/support-files/mysql.server"
# Start webserver on localhost:8000 sharing current directory
alias webshare='python -c "import SimpleHTTPServer;SimpleHTTPServer.test()"'
# Rails server
alias ss="./script/server"
alias sss="screen ./script/server"
alias sr="screen -r"
Like this:
Like Loading...
My ~/.ssh/config file looks a lot like so:
Host foo
HostName foo.bar.com
Host baz
HostName 192.168.0.1
Host *
Protocol 2
….
Then I can use “foo” or “baz” as hostnames in ssh/scp without needing to come up with any cleverly named aliases.
Here are a couple more I use:
alias ls=’ls –color -F’
alias rm=’rm -i’ # personal preference, I suppose.
alias grep=’grep –color=tty -d skip’
alias egrep=’egrep –color=tty -d skip’
alias fgrep=’fgrep –color=tty -d skip’
Good tips, thanks!
Hi, can you explain what are these for exactly to the novices?Is it about optimization or else?Thanks in advance.
As a general security rule, you usually want to disable remote root login. I’d suggest adding:
PermitRootLogin no
To your sshd_config and restart sshd while we’re editing files.
Also, if you’re a tcsh user (yes, we still exist!), play with the ‘complete’ command:
complete ssh ‘p/1/(eday@host1.com someone@somewhere.com kitchensink.com)/’
complete cd ‘p/1/d/’
This allows you to program your own TAB auto-complete options (instead of normal files). The cd example will only auto-complete with directory entries (hence the d). The ssh one:
ssh e
would auto-complete to
ssh eday@host1.com
I’m guessing there is some bash equivalent but I’ve not checked.
BTW ‘python -m SimpleHTTPServer’ is a shorter equivalent spelling of ‘python -c “import SimpleHTTPServer;SimpleHTTPServer.test()”‘.