Check These Out
This command displays a simple menu of file names in the current directory. After the user made a choice, the command invokes the default editor to edit that file.
* Without the break statement, the select command will loop forever
* Setting the PS3 prompt is optional
* If the user types an invalid choice (such as the letter q), then the variable $f will become an empty string.
* For more information, look up the bash's select command
Use `zless` to read the content of your *rss.gz file:
$ zless commandlinefu-contribs-backup-2009-08-10-07.40.39.rss.gz
Converts any number of seconds into days, hours, minutes and seconds.
sec2dhms() {
declare -i SS="$1"
D=$(( SS / 86400 ))
H=$(( SS % 86400 / 3600 ))
M=$(( SS % 3600 / 60 ))
S=$(( SS % 60 ))
[ "$D" -gt 0 ] && echo -n "${D}:"
[ "$H" -gt 0 ] && printf "%02g:" "$H"
printf "%02g:%02g\n" "$M" "$S"
}
When you start screen as `ssh-agent screen`, agent will die after detatch.
If you don't want to take care about files when stored agent's pid/socket/etc, you have to use this command.
You probably want to run `brew update` before you run this command
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"
Resize `file.png` to a 32x32 px image. Use a value other than 32 to create other icon sizes (e.g. 16x16 or 32x32). Combine two favicon sizes using: `convert icon-16px.png icon-32px.png favicon.ico`
For a social media preview image, use `2:1#` for the extent and `1200` for the scale.
You could do the following, however, brace expansion with {} is not defined in POSIX, and therefore not guaranteed to work in all shells. But, if it does, it's more convenient (although it's certainly not less typing):
$ cp -r {*,.??*} /dest
Sometimes there are times when I need to cp(1), mv(1) or rm(1) files recursively, but don't want to traverse the previous directory by following ../../../../ etc out of the current directory. This command prevents that. The secret sauce is ".??*". The file globbing ensures that it must start with a dot, and be followed by at least two characters. So, three characters must exist in the filename, which eliminates "." and "..".