123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- #
- # Linux Stuff
- #
- #
- # Alias / Functions
- #
- mdstat() {
- if [ -f /proc/mdstat ]; then
- cat /proc/mdstat
- else
- print "Linux Software RAID not available on this system."
- return 1
- fi
- }
- # Fancy cp with progressbar (using strace)
- # from http://chris-lamb.co.uk/2008/01/24/can-you-get-cp-to-give-a-progress-bar-like-wget/
- cp_p() {
- strace -q -ewrite cp -- "${1}" "${2}" 2>&1 | awk '{
- count += $NF
- if (count % 10 == 0) {
- percent = count / total_size * 100
- printf "%3d%% [", percent
- for (i=0;i<=percent;i++)
- printf "="
- printf ">"
- for (i=percent;i<100;i++)
- printf " "
- printf "]\r"
- }
- }
- END { print "" }' total_size=$(stat -c '%s' "${1}") count=0
- }
- lsswap () {
- awk 'BEGIN{printf "%-7s %-16s %s (KB)\n", "PID","COMM","VMSWAP"} {
- if($1 == "Name:"){
- n=$2
- }
- if($1 == "Pid:"){
- p=$2
- }
- if($1 == "VmSwap:" && $2 != "0"){
- printf "%-7s %-16s %s\n", p,n,$2 | "sort -nrk3"
- }
- }' /proc/*/status
- }
|