Check These Out
Often, when sorting you want the sort to ignore extraneous characters. The b, d, and f tell sort to ignore leading blanks, use 'dictionary order' (ignore punctuation), and ignore (fold) case. Add a "u" if you only want one copy of duplicate lines.
This is a great command to use within vim to sort lines of text, using !}sort -bdf
You must have smartmontools installed for this to work. This also assumes you 512 byte sector sizes, this is pretty standard.
I didn't come up with this myself, but I always add this to my .bash_aliases file. It's essentially the same idea as running "sudo !!" except it's much easier to type. (You can't just alias "sudo !!", it doesn't really work for reasons I don't understand.)
"fc" is a shell built-in for editing and re-running previous commands. The -l flag tells it to display the line rather than edit it, and the -n command tells it to omit the line number. -1 tells it to print the previous line.
For more detail:
$help fc
A quick and simple way of outputting the start and end date of a certificate, you can simply use 'openssl x509 -in xxxxxx.crt -noout -enddate' to output the end date (ex. notAfter=Feb 01 11:30:32 2009 GMT) and with the date command you format the output to an ISO format.
For the start date use the switch -startdate and for end date use -enddate.
Just run this command and it will printout all the info available about your current distribution and package management system.
Not everyone reads manpages. Aliasing this command will help with the task of doing audits with RKhunter. It will check for the latest version, update the definitions and then run a check on the system.
Hint: alias that in your .bashrc to make life for your fingers easier.
$ function echox { echo `tput cup $(($(tput lines))) $(( ($(tput cols) - $(echo "${#1}"))/2 ))`"$1"`tput cup $(tput lines) $(( $(tput cols)-1 ))`; }
echox prints given argument on bottom line center screen in terminal
$ function echoxy { echo `tput cup $(($(tput lines)/2)) $(( ($(tput cols) - $(echo "${#1}"))/2))`"$1"`tput cup $(tput lines) $(( $(tput cols)-1 ))`; }
exhoxy prints given argument center screen
$ function echos { echo `tput cup $(($(tput lines)-2)) $(($(tput cols)-$(echo ${#1})))&&tput sc`"$1"`tput cup $(($(tput lines)-2)) 0 && tput rc`; }
$ while [ 1 ]; do echos "`date`"; done
echos prints date and time on second from last line (used as status message)
you can easily use these functions by placing them in your .bashrc file, make sure to source your .bashrc once you do
Mac have direct conversion of seconds (Epoch time)