Check These Out
Although less behaves more or less like vim in certain aspects, the vim regex for word boundaries (\< and \>) do not work in less. Instead, use \b to denote a word boundary. Therefore, if you want to search for, say, the word "exit", but do not want to search for exiting, exits, etc., then surround "exit" with \b. This is useful if you need to search for specific occurrences of a keyword or command. \b can also be used at just the beginning and end, if needed.
Same as original, but works in bash
in this examp start htop command in tmux session over the shell cosole and set title for the tmux without doing it manuelly in tmux
Find the unique values of a column utilizing awk.
Credits goes to here (posted by "era"): http://www.unix.com/shell-programming-scripting/77138-awk-print-distinct-col-values.html
This is just one method of checking to see if an IP is blocked via IP tables or CSF. Simple and to the point. Replace xx.xx.xx.xx with the IP you wish to check.
Halt script progress until a key has been pressed.
Source: http://bash-hackers.org/wiki/doku.php/mirroring/bashfaq/065
This command will log the output of your simple cronjobs to syslog, and syslog will take it from there. Works great for monitoring scripts which only produce simple output.
Advantages:
* This can be used by regular users, without modifying system files like /etc/syslog.conf
* Reduce cron spam to root@localhost (Please stop spaming the sysadmins)
* Uses common tools like syslog (and logrotate) so that you don't need to maintain yet another krufty logfile.
* Still ensures that the output is logged somewhere, for posterity. Perhaps it's stored the secure, central syslog server, for example.
* Seems to work fine on Ubuntu, CentOS, FreeBSD & MacOSX
You may also use the $(which foo) variant instead of backticks. I personnaly have an alias ll='ls -l'.
I used this fragment with Imagemagick convert so that I can place long text strings in pictures. The "\n" gets converted to a true newline in the image.
So this fragment uses fold command to wrap the line and then sed to convert newlines (and any trailing spaces on the line) to the text "\n"