Check These Out
You can search for CVEs at https://security-tracker.debian.org/tracker/ or use --report to get full links. This can be added to cron, but unless you're going to do manual patches, you'd just be torturing yourself.
Remove all hidden files in a directory excluding current dir . and parent dir .. with .??* that means files with at least two characters.
Avoiding a for loop brought this time down to less than 3 seconds on my old machine. And just to be clear, 33554432 = 8192 * 4086.
For the record: I didn't build this. Just shared what I found that worked. Apologies to the original author!
I decided I should fix the case where http://example.com is not matched for the next time I need this. So I read rfc1035 and formalized the host name regex.
If anyone finds any more holes, please comment.
Unlike other methods that use pipes and exec software like tr or sed or subshells, this is an extremely fast way to print a line and will always be able to detect the terminal width or else defaults to 80. It uses bash builtins for printf and echo and works with printf that supports the non-POSIX `-v` option to store result to var instead of printing to stdout.
Here it is in a function that lets you change the line character to use and the length with args, it also supports color escape sequences with the echo -e option.
$ function L() { local l=; builtin printf -vl "%${2:-${COLUMNS:-`tput cols 2>&-||echo 80`}}s\n" && echo -e "${l// /${1:-=}}"; }
With color:
$ L "`tput setaf 3`="
1. Use printf to store n space chars followed by a newline to an environment variable "l" where n is local environment variable from $COLUMNS if set, else it will use `tput cols` and if that fails it will default to 80.
2. If printf succeeds then echo `$l` that contains the chars, replacing all blank spaces with "-" (can be changed to anything you want).
From: http://www.askapache.com/linux/bash_profile-functions-advanced-shell.html http://www.askapache.com/linux/bash-power-prompt.html
Very entertaining when run on someone elses machine remotely ;)
The vi key sequence !}command will send the file contents from the cursor
to the next blank line as STDOUT to the command specified
and replace that sequence of file lines with the output of the command.
For example: sorting a block of data - !}sort
The sequence !{command will do the same but "upwards" (from the current position towards the start of the file.
It works as a method applicated to a variable, converts the string variable into an array
Uses the formatting of a man page to show an outline of its headers and sub-headers.