Check These Out
I've been using linux for almost a decade and only recently discovered that most terminals like putty, xterm, xfree86, vt100, etc., support hundreds of shades of colors, backgrounds and text/terminal effects.
This simply prints out a ton of them, the output is pretty amazing.
If you use non-x terminals all the time like I do, it can really be helpful to know how to tweak colors and terminal capabilities. Like:
$ echo $'\33[H\33[2J'
Using this command you can track a moment when usb device was attached.
Optimal way of deleting huge numbers of files
Using -delete is faster than:
$ find /path/to/dir -type f -print0 | xargs -0 rm
$ find /path/to/dir -type f -exec rm {} +
$ find /path/to/dir -type f -exec rm \-f {} \;
Replace 'csv_file.csv' with your filename.
If you're a moron like me, sometimes your fingers get away from you and you, for example, enter your password when you're already authenticated to ssh-agent, sudo, etc., and your password ends up in shell history. Here's how to get it out.
This snippet allows to process the output of any bash command line by line.
Can be useful to granulary flush files in a CDN after they've been changed in the S3 bucket.
I had a hard time in finding the correct settings to get reasonable output from a coin selector which sends its data over a serial line. In the end, minicom came to the rescue and pointed me on the right track.
So, if you need to do something similar, these settings may help you.
Replace ttyUSB0 with your device file, 9600 with your baud rate, 5 with your read timeout (10ths of a second), and 1 with the minimum numbers of characters you want to read.
You can then open the device file like you are used to do, example:
$ DATA="`xxd -ps -l 5 \"$DEV\"`"
in Debian-based systems apt-get could be limited to the specified bandwidth in kilobytes using the apt configuration options(man 5 apt.conf, man apt-get). I'd quote man 5 apt.conf:
"The used bandwidth can be limited with Acquire::http::Dl-Limit which accepts integer values in kilobyte. The default value is 0 which deactivates the limit and tries uses as much as possible of the bandwidth..."
"HTTPS URIs. Cache-control, Timeout, AllowRedirect, Dl-Limit and proxy options are the same as for http..."