Skip to content

Instantly share code, notes, and snippets.

View petergi's full-sized avatar
💭
Just Busy Living On The Side Of A Square

Peter Giannopoulos petergi

💭
Just Busy Living On The Side Of A Square
View GitHub Profile
# These can be copied and pasted, one line at a time, to the Terminal, but since they recursively target
# specific folders, be sure to use this exact syntax to avoid any problems:
sudo rm -rf ~/.Trash
sudo rm -rf /Volumes/*/.Trashes
system_profiler SPDisplaysDataType | grep Resolution
#!/bin/bash
mem=$(sysctl -n hw.memsize)
mem="$((mem/1073741274)) GB"
echo $mem
#!/bin/bash
cpu=$(sysctl -n machdep.cpu.brand_string)
# removes (R) and (TM) from the CPU name so it fits in a standard 80 window
cpu=$(echo "$cpu" | awk '$1=$1' | sed 's/([A-Z]\{1,2\})//g')
echo "$cpu"
#!/bin/bash
disk=$(df -Hl | head -2 | tail -1)
dpercent=$(echo "$disk" | awk '{print $5}')
dfree=$(echo "$disk" | awk '{print $4}')
dused=$(echo "$disk" | awk '{print $3}')
dcapacity=$(echo "$disk" | awk '{print $2}')
echo "$disk"
#!/bin/bash
hostname=$(HOSTNAME | sed 's/.local//g' | sed 's/.gateway//g' )
# if hostname is >35 characters, truncates to make it fit on std. 80 window
if [ ${#HOSTNAME} -gt 35 ]
then
hostname=${HOSTNAME:0:35}
fi
#!/bin/bash
model=$(system_profiler SPHardwareDataType | awk '/Model Identifier/ { print $3 }')
# use grep to find the model in the list, then delete from ) to end of line
modelname=`grep $model $DIR/Models.txt | sed -e 's/).*/)/g'`
echo $modelname
networksetup -listallhardwareports