5 bash shortcuts I use on the reg

I have already showed you my genpasswd function. Here are 5 more shortcuts (functions/aliases) I use daily:

checkgzip

Allows you to quickly check whether a file is Gzipped.

Code:

function checkgzip { curl -sI -H 'Accept-Encoding: gzip,deflate' $1 |grep Content-Encoding --color; }

Usage:

$ checkgzip http://www.maxcdn.com/wp-content/themes/maxcdn/js/libs/modernizr.min.js
Content-Encoding: gzip

l (lower case L)

This will allow you to view new files in a directory placing old files at the top and new files on the bottom.

Code:

alias l="ls -alhtr"

Usage:

$ l
-rw-r--r--   1 jdorfman  wheel     72k Jun  10 18:05 3.log
-rw-r--r--   1 jdorfman  wheel     10k Jun  11 13:06 2.log
-rw-r--r--   1 jdorfman  wheel     34k Jun  12 16:06 1.log

sec2 (ssh EC2)

Allows you to ssh to your EC2 instance.

Code:

function sec2 () { ssh ec2-user@ec2-00-000-0-000.compute-1.amazonaws.com -i ~/.ssh/ec2.pem; }

Usage:

$ sec2
Welcome to Ubuntu 12.10 (GNU/Linux 3.5.0-17-generic i686)
Last login: Wed Jun 12 05:10:26 2013 from foo.bar.com
jdorfman@micro:~$

jpp (json pretty print)

Make ugly JSON pretty.

Code:

alias jpp="python -m json.tool" 

Usage (Before):

$ cat foo.json

{"id":"2","user_id":"1","name":"testing","type":"bouldering","picture":null,"lat":"36","long":"81","alt":"41932","accuracy":"53","thumbnail":null}

Usage (After):

$ cat foo.json |jpp
{
    "accuracy": "53",
    "alt": "41932",
    "id": "2",
    "lat": "36",
    "long": "81",
    "name": "testing",
    "picture": null,
    "thumbnail": null,
    "type": "bouldering",
    "user_id": "1"
}

gs (git status)

Quickly view the status of your git repo.

Code:

alias gs="git status"

Usage:

jdorfman@air:~/github/bootstrap-cdn$ gs
# On branch 2.3.2
nothing to commit (working directory clean)



Enjoy.  I got more...