Here are some of the commands that are rarely used and here as a reference and also some commands that are just fun and useful. While all of the syntax below is specific to MacOS. They will work with linux, but your milage may vary.

On my Macs I like to install iTerm. It is a great terminal emulator and much better than the stock one from Apple. I also installed zsh along with it. It makes for a very nice, well put-together, package.

# Change the default for screenshot to jpg
>>defaults write type jpg

# Add custom message to the login window
>>sudo defaults write /Library/Preferences/ LoginwindowText "Put custom text here"

# Add blank tile to the Dock to help organization
>>defaults write persistent-apps -array-add '{"tile-type"="spacer-tile";}'
>>killall Dock

# Reload .zshrc file after making changes
>>source ~/.zshrc

# Serial terminal RS232 connection
>>screen /dev/tty.SLAB_USBtoUART

# Find the Top 10 commands used
# Just for fun
>> history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a; }' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n10

# When Spotlight lets you down trying to find a file the command
# line can help out. -onlyin specifies the directory to search
# The example searches my home directory for any file with MarsEdit.
>>mdfind -onlyin ~/ MarsEdit

# Which process is listening on what port.
>>sudo lsof -P -n -iTCP -sTCP:LISTEN

# RPi backup      
>>sudo dd if=/dev/rdisk2 of=./retropie.img bs=1m
# and restore
>>sudo dd if=./retropie.img of=/dev/rdisk2 bs=1m

# A better top application
>>gotop -c monokai -b brew install gotop

# and one up on gtop and top.

# the king of tops
>>gotop -c monokai -b

# Diskutil, searching for drives. This lists all drives attached
# to the Mac.
>>diskutil list

# Encrypt a file on the command line
>>openssl aes-256-cbc -a -salt -in testEncrypt.txt -out

# Easy Peasy password generation containing 8 characters
# e.g. 90hmn5AskHs=
>>openssl rand -base64 8
# (change the num 8 for more or less characters)
# or
>>date |md5 | head -c8; echo

# PHP local dev >>php -S localhost:8000 -t /Users/w001pnh/Development/testWWW

# Change wireless MAC
>>openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/./0/2; s/.$//‘
>>sudo ifconfig en0 ether b0:a6:0a:69:e1:7b

# the shortest command, displays user related information
# login time, load, etc.
>> w

© 2020, wrightmac. All rights reserved.

No tags for this post.