Check These Out
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).
Even adds a newline.
exclude-dir option requires grep 2.5.3
An example of zsh glob qualifiers.
Netcat is used to serve a log-file over a network on port 1234.
Point a browser to the specified server/port combo to view log-file updates in real-time.
I took matthewbauer's cool one-liner and rewrote it as a shell function that returns all the suggestions or outputs "OK" if it doesn't find anything wrong. It should work on ksh, zsh, and bash. Users that don't have tee can leave that part off like this:
$spellcheck(){ typeset y=$@;curl -sd "$y" https://google.com/tbproxy/spell|sed -n '/s="[1-9]"/{s/]*>/ /g;s/\t/ /g;s/ *\(.*\)/Suggestions: \1\n/g;p}';}
Replace 10.0.0.0/8 with your largest local subnet. replace 10.1.1.123:3128 with your proxy information.. Note this only works with a proxy server configured for passive setup..
Now your firefox transparently proxy's stuff destined outside your network.. and Doesn't proxy stuff inside your network. as well as all your other favorite web applications. curl, wget, aria2 ect.
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"
Using this command you can track a moment when usb device was attached.