System and process management
Session
Exit the current terminal session
exitShutdown or restart the system
shutdown
rebootProcesses
Kill process you own or created
killall <process-name>Search for named running process and return process id (-l to include process name)
pgrep -l <process-name>Kill named process (-l for long output, -f to match against full arguments)
pkill -l <process-name>Search for process details
ps aux | grep <process-name>Kill a running process (by id)
kill <process-id>
sudo kill <process-id>Hangup process
kill -1 <process-id>Kill process (using force kill signal -9)
kill -9 <process-id>Open File Processes
List open process IDs for file
fuser <file>List open files for all processes
lsofList open files for a user
lsof -u <username>List processes for a specific file or volume
lsof <file>
lsof <volume>List open files for internet address processes
lsof -iFilter internet address listing by port
lsof -i :<port>Identify processes using a volume (eg. when unable to unmount external drive)
lsof /Volumes/<volume-name>
sudo lsof /Volumes/<volume-name>Kill process using a volume
kill <process-id>Terminal
Change Unix shell (enter path to new shell when prompted)
chshOutput default shell
echo $SHELLMaintenance
Update package list
sudo apt-get updateUpgrade outdated packages
sudo apt-get upgradeLast updated