Check These Out
Uses the shell builtin `declare` with the '-f' flag to output only functions to grep out only the function names.
You can use it as an alias or function like so:
alias shfunctions="builtin declare -f | command grep --color=never -E '^[a-zA-Z_]+\ \(\)'"
shfunctions () { builtin declare -f | command grep --color=never -E '^[a-zA-Z_]+\ \(\)'; }
I put this command on my ~/.bashrc in order to learn something new about installed packages on my Debian/Ubuntu system each time I open a new terminal
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"
}
Source: http://superuser.com/questions/49408/how-do-i-monitor-or-view-the-thread-count-of-a-certain-process-on-aix
remotely connects to an https site, fetches the ssl certificate and displays the valid dates for the cert
This one-liner will use strace to attach to all of the currently running apache processes output and piped from the initial "ps auxw" command into some awk.
i sorta stole this from
http://www.shell-fu.org/lister.php?id=878#MTC_form
but it didn't work, so here it is, fixed.
---
updated to work with jpegs, and to use a fancy positive look behind assertion.
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"
Shows a file without comments (at least those starting by #)
- removes empty lines
- removes lines starting by # or "some spaces/tabs then #'"
Useful when you want to quickly see what you have to customize on a freshly installed application without reading the comments that sometimes are a full 1000 lines documentation :)
While posting, I saw this http://www.commandlinefu.com/commands/view/1041/display-contents-of-a-file-wo-any-comments-or-blank-lines
But it's dirty and incomplete, to my mind
My original goal was to remove lines like "\t*#" but I can't figure out how to do a egrep '\t' on a command-line. Two workarounds if needed:
$egrep -v 'press control + V then TAB then #' /your/file
or
$egrep -v -f some_file /your/file #where some_file contains what you want to exclude, example a really inserted TAB