500 Mac Commands
1
Here are 200 commands you can use in the Mac Terminal, grouped by categories:
File Management
lsls -lls -als -lhcdcd ..cd /cd ~mkdirrmdirtouchrmrm -rrm -fcpcp -rmvlnln -scatmorelessheadtailtail -fchmodchownchgrpstatfilefindlocatedudfpwdechogrepegrepfgrepwcdiffcmpsortuniqcutpastetrsedawkxargs
System Information
unameuname -atoppsps auxkillkillallpkilluptimewhowhoamiidlastwdatecaldfdufreevm_statsystem_profilerdiskutilioregpmsetsysctl
Network
pingtracerouteifconfigipconfignetstatnslookupdighostscpsftpsshftpcurlwgettelnetncnmaproutearpip
Package Management
brewbrew installbrew updatebrew upgradebrew uninstallbrew listbrew searchbrew infobrew doctor
Disk and File System
mountumountfsckdiskutil listdiskutil eraseDiskdiskutil partitionDiskdiskutil verifyDiskdiskutil repairDiskhdiutilmkfsfsckresize2fsdf -hdu -sh
Process Management
pstophtopkillpkillkillalljobsbgfgnohupdisownnicerenicescreentmux
Text Processing
catlessmoreheadtailnanovivimemacssedawkgrepegrepfgrepcutsortuniqtrwcdiffpatchteefmt
System Maintenance
sudopasswdcrontabatbatchshutdownreboothaltinitsystemctllaunchctlpmsetsoftwareupdatespctlcsrutilnvrampmsetkextloadkextunload
Development Tools
gccclangmakecmakegitsvnhgpythonpython3nodenpmpippip3rubyrailsphpjavacjavaperlgorustccargog++swiftxcodebuild
This comprehensive list should give you a solid foundation for working in the Mac Terminal.
2
Sure, here are another 200 commands you can use in the Mac Terminal:
File Management Continued
basenamedirnamesplitcsplitgzipgunzipbzip2bunzip2zipunziptartar -cvftar -xvftar -tvftar -zcvftar -zxvftar -jcvftar -jxvfzip -runzip -l
System Information Continued
hostnamedmesguptimediskutil infosw_verssystemsetuppmset -gsysdiagnoseioreg -lspindumpsystem_profiler SPHardwareDataTypesysctl -avm_statsudo periodic dailysudo periodic weeklysudo periodic monthlyvmmapmdfindmdutilmdls
Network Continued
ifconfig -aiwconfigiwlistiwprivnetstat -rnroute -nip routeip addrip linkarp -anmap -sPnmap -Acurl -Icurl -Xwget -cwget -rnc -zvnc -lnc -unc -krsyncrsync -avrsync -avzscp -rscp -issh -Lssh -Rssh -Dssh -Xftp -iftp -nftp -v
Package Management Continued
brew caskbrew tapbrew untapbrew cleanupbrew linkbrew unlinkbrew pinbrew unpinbrew outdatedbrew servicesbrew services startbrew services stopbrew services restartbrew services listbrew bundlebrew list --versionsbrew leavesbrew outdated --greedybrew missingbrew usesbrew desc
Disk and File System Continued
fsck_hfsfsck_apfsdiskutil mountdiskutil unmountdiskutil ejectdiskutil renamediskutil verifyVolumediskutil repairVolumediskutil repairPermissionsdiskutil secureErasediskutil coreStoragediskutil coreStorage listdiskutil coreStorage creatediskutil coreStorage createVolumediskutil coreStorage deletediskutil coreStorage resizeVolumehdiutil createhdiutil attachhdiutil detachhdiutil verifyhdiutil compacthdiutil resize
Process Management Continued
ps -eps -fps -ups -pps -tps -xps --foresttop -o cputop -o memtop -utop -shtop -dhtop -uhtop -shtop -pkill -9pkill -9killall -9pkill -fnice -nrenice -nscreen -lsscreen -rscreen -Stmux new-sessiontmux attach-sessiontmux list-sessionstmux kill-session
Text Processing Continued
cat file1 file2cat file1 | lesscat file1 | morecat file1 | headcat file1 | tailgrep -igrep -vgrep -rgrep -lgrep -Lgrep -cgrep -negrep -ifgrep -iawk '{print $1}'awk '{print $2}'awk -F: '{print $1}'awk -F, '{print $1}'awk 'NR==1{print $0}'sed 's/foo/bar/'sed 's/foo/bar/g'sed 's/foo/bar/2'sed -n 'p'sed -n '1,3p'cut -d: -f1cut -d, -f1cut -c1-5cut -c6-10tr 'a-z' 'A-Z'tr -d ' 'sort -nsort -runiq -duniq -cwc -lwc -wwc -cdiff -upatch -p0tee file1tee -a file1fmt -w 80fmt -u
System Maintenance Continued
sudo susudo visudosudo shutdown -h nowsudo shutdown -r nowsudo shutdown -csudo rebootsudo haltsudo init 0sudo init 6sudo init 1sudo servicesudo systemctl statussudo systemctl startsudo systemctl stopsudo systemctl restartsudo systemctl enablesudo systemctl disablesudo systemctl reloadsudo crontab -esudo crontab -lsudo crontab -rat nowat 5pmatqatrmsudo launchctl listsudo launchctl loadsudo launchctl unloadsudo launchctl startsudo launchctl stopsoftwareupdate --listsoftwareupdate --installspctl --statusspctl --enablespctl --disablecsrutil statuscsrutil enablecsrutil disablenvram -pnvram -dkextstatkextload -bkextunload -b
Development Tools Continued
gcc -ogcc -Wallclang -oclang -Wallmake cleancmake .cmake ..cmake --build .git initgit clonegit addgit commitgit pushgit pullgit statusgit diffgit loggit checkoutgit branchgit mergesvn checkoutsvn updatesvn commitsvn statussvn loghg inithg clonehg addhg commithg pushhg pullpython -mpython -cpython3 -mpython3 -cnode -v`
3
Sure, let's continue and finish the list:
node -enpm installnpm updatenpm uninstallnpm listnpm runpip installpip uninstallpip listpip showpip freezepip searchruby -erails serverrails generaterails consolerails db:migratephp -vphp -rjavac -djavac -cpjava -jarjava -cpperl -eperl -pgo buildgo rungo installgo testrustc --versionrustc -ocargo buildcargo runcargo testcargo installg++ -og++ -Wallswiftcswift buildxcodebuild -schemexcodebuild -workspacexcodebuild -projectxcodebuild -targetxcodebuild -listxcode-select --installxcode-select --switch
Advanced Usage
aliasunaliasexportunsetsourceenvprintenvsetecho $PATHecho $HOMEecho $USERhistoryhistory -cfcjobsbgfgwaitdisownexectimetimesulimitalias ll='ls -la'alias grep='grep --color=auto'unalias lltrapshoptcompleteselectprintfreadread -pread -sdeclaretypesetdeclare -adeclare -Adeclare -fdeclare -ideclare -xdeclare -revalmapfilecoprocyesfalsetruesleepexec command > fileexec command < filecommand1 | command2command1 && command2command1 || command2command1 ; command2command1 &command1 > filecommand1 < filecommand1 2> filecommand1 2>&1command1 > /dev/nullcommand1 < /dev/nullcommand1 >> filecommand1 | tee filecommand1 | tee -a filediff <(command1) <(command2)sudo !!!$!*!^!n!?string!string^old^newcd -cd ~-cd ~+cd --pushdpopddirsdirs -vdirs -pdirs -lshbashzshdashksh
This completes a total of 400 commands you can use in the Mac Terminal. These commands should cover a wide range of functionalities for various tasks.
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Last updated