Check These Out
Trick to avoid the form:
grep process | grep - v grep
from http://git-scm.com/book/en/Git-Tools-Stashing
Useful for when stash cannot be applied to current branch
Source: http://www.bashoneliners.com/oneliners/oneliner/225/
Tested on Fedora 12. This function will take a man page and convert it to pdf, saving the output to the current working directory. In Gnome, you can then view the output with "gnome-open file.pdf", or your favorite pdf viewer.
Traditionally we rewind a tape using this syntaxis:
$ mt -f /dev/rmt/0cbn rewind
Redirecting the dispositive to nothing as shown above is faster. Less typing is always better.
Sometimes commands give you too much feedback.
Perhaps 1/100th might be enough. If so, every() is for you.
$ my_verbose_command | every 100
will print every 100th line of output.
Specifically, it will print lines 100, 200, 300, etc
If you use a negative argument it will print the *first* of a block,
$ my_verbose_command | every -100
It will print lines 1, 101, 201, 301, etc
The function wraps up this useful sed snippet:
$ ... | sed -n '0~100p'
don't print anything by default
$ sed -n
starting at line 0, then every hundred lines ( ~100 ) print.
$ '0~100p'
There's also some bash magic to test if the number is negative:
we want character 0, length 1, of variable N.
$ ${N:0:1}
If it *is* negative, strip off the first character ${N:1} is character 1 onwards (second actual character).
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"
Works for debian and ubuntu based distros.
$F[0] filters using first word. $F[1] - 2nd, and so on.
If are a Bash user and you are in a directory and need to go else where for a while but don't want to lose where you were, use pushd instead of cd.
cd /home/complicated/path/.I/dont/want/to/forget
pushd /tmp
cd thing/in/tmp
popd (returns you to /home/complicated/path/.I/dont/want/to/forget)