This page provides a cheat cheat for mac OS. I use these commands regularly when testing, installing and developing solutions on Mac OS projects.
File & Directory Commands
Command Description defaults write com.apple.Finder AppleShowAllFiles true && killall FinderEnable the setting to view hidden files in finder from CLI lsLists directory contents. ls -llist directory contents and their attributes ls -lalist directory contents to include hidden files & their attributes cd <path>Changes the directory. clearClears the terminal. touch <file>Creates an empty file in your current working directory. mkdir <directory>Creates a new directory in your current working directory mv /Users/htb-student/Documents/Test /Users/htb-student/Desktop/TestMove a file from one directory to another chmod -vv <octal value> <file>Modify permissions of a file and show the results sudo chown <userOwn>:<groupOwn> <file>Change the user and group owner of a file
Networking Commands
Command Description ifconfigView basic networking configurations ifcofnig <interface>View specific networking configurations of an interface ifconfig en0 inet <192.168.1.1> netmask < 255.255.255.0 >Manually set an interfaces IP address and subnet mask lsof -n -i4TCP -PView TCP ports that are bound while displaying the application that has it bound hostnameCheck the hostname of the computer networksetup -listallnetworkservicesDisplays a list of all the network services (devices) on the computer’s hardware. This will print out the logical name of the device. (ex. Wi-Fi) networksetup -listnetworkserviceorderThis will print out the network services running and the order in which they are queried for connection. A service at the beginning of the list is checked first. networksetup -getinfo <devicename>Get basic info about a networkservice (device), such as the IP address assigned, subnet mask, gateway, and Mac-Address. networksetup -getcurrentlocationPrints out the currently set network location. networksetup -setmanual <networkservice> <ip> <netmask> <Gateway>This will manually configure the IP address, network mask, and gateway for the device specified. networkQuality -I <interface>Check network speeds of a specific interface security find-generic-password -wa <SSID>Pull the password associated with a specific SSID from the security keychain ncCan be used to bind ports to connect with or listen from
Application Management
Command Description /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Install Homebrew brew -vDisplay the version/package information for Homebrew brew install <package>Install a package using Homebrew brew search firefoxHave Homebrew search its repository for a package named “firefox” brew install <package> --caskInstall a cask application brew uninstall <package>Remove a package from the host brew upgradeUpgrade Homebrew and all packages installed with it brew cleanupCleanup old & unused files and applications with Homebrew
Shell Management Commands
Command Description .bashrcConfiguration file for Bash .zshrcConfiguration file for Zsh chsh -s /bin/bashChange our env shell to Bash brew install zshInstall zsh with Homebrew chsh -s /bin/zshChange our env shell to Zsh alias ll='ls -l'Set an alias for ll in the .zshrc file sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"Install Oh My Zsh git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlightingInstall Zsh-syntax-highlighting git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10kInstall the Powerlevel-10k theme to Zsh brew install romkatv/powerlevel10k/powerlevel10kInstall the Powerlevel-10k theme to Zsh using Homebrew echo "source $(brew --prefix)/opt/powerlevel10k/powerlevel10k.zsh-theme" >>~/.zshrcSet the theme of our shell in the .zshrc file