500 Mac Commands

1

Here are 200 commands you can use in the Mac Terminal, grouped by categories:

File Management

  1. ls

  2. ls -l

  3. ls -a

  4. ls -lh

  5. cd

  6. cd ..

  7. cd /

  8. cd ~

  9. mkdir

  10. rmdir

  11. touch

  12. rm

  13. rm -r

  14. rm -f

  15. cp

  16. cp -r

  17. mv

  18. ln

  19. ln -s

  20. cat

  21. more

  22. less

  23. head

  24. tail

  25. tail -f

  26. chmod

  27. chown

  28. chgrp

  29. stat

  30. file

  31. find

  32. locate

  33. du

  34. df

  35. pwd

  36. echo

  37. grep

  38. egrep

  39. fgrep

  40. wc

  41. diff

  42. cmp

  43. sort

  44. uniq

  45. cut

  46. paste

  47. tr

  48. sed

  49. awk

  50. xargs

System Information

  1. uname

  2. uname -a

  3. top

  4. ps

  5. ps aux

  6. kill

  7. killall

  8. pkill

  9. uptime

  10. who

  11. whoami

  12. id

  13. last

  14. w

  15. date

  16. cal

  17. df

  18. du

  19. free

  20. vm_stat

  21. system_profiler

  22. diskutil

  23. ioreg

  24. pmset

  25. sysctl

Network

  1. ping

  2. traceroute

  3. ifconfig

  4. ipconfig

  5. netstat

  6. nslookup

  7. dig

  8. host

  9. scp

  10. sftp

  11. ssh

  12. ftp

  13. curl

  14. wget

  15. telnet

  16. nc

  17. nmap

  18. route

  19. arp

  20. ip

Package Management

  1. brew

  2. brew install

  3. brew update

  4. brew upgrade

  5. brew uninstall

  6. brew list

  7. brew search

  8. brew info

  9. brew doctor

Disk and File System

  1. mount

  2. umount

  3. fsck

  4. diskutil list

  5. diskutil eraseDisk

  6. diskutil partitionDisk

  7. diskutil verifyDisk

  8. diskutil repairDisk

  9. hdiutil

  10. mkfs

  11. fsck

  12. resize2fs

  13. df -h

  14. du -sh

Process Management

  1. ps

  2. top

  3. htop

  4. kill

  5. pkill

  6. killall

  7. jobs

  8. bg

  9. fg

  10. nohup

  11. disown

  12. nice

  13. renice

  14. screen

  15. tmux

Text Processing

  1. cat

  2. less

  3. more

  4. head

  5. tail

  6. nano

  7. vi

  8. vim

  9. emacs

  10. sed

  11. awk

  12. grep

  13. egrep

  14. fgrep

  15. cut

  16. sort

  17. uniq

  18. tr

  19. wc

  20. diff

  21. patch

  22. tee

  23. fmt

System Maintenance

  1. sudo

  2. passwd

  3. crontab

  4. at

  5. batch

  6. shutdown

  7. reboot

  8. halt

  9. init

  10. systemctl

  11. launchctl

  12. pmset

  13. softwareupdate

  14. spctl

  15. csrutil

  16. nvram

  17. pmset

  18. kextload

  19. kextunload

Development Tools

  1. gcc

  2. clang

  3. make

  4. cmake

  5. git

  6. svn

  7. hg

  8. python

  9. python3

  10. node

  11. npm

  12. pip

  13. pip3

  14. ruby

  15. rails

  16. php

  17. javac

  18. java

  19. perl

  20. go

  21. rustc

  22. cargo

  23. g++

  24. swift

  25. xcodebuild

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

  1. basename

  2. dirname

  3. split

  4. csplit

  5. gzip

  6. gunzip

  7. bzip2

  8. bunzip2

  9. zip

  10. unzip

  11. tar

  12. tar -cvf

  13. tar -xvf

  14. tar -tvf

  15. tar -zcvf

  16. tar -zxvf

  17. tar -jcvf

  18. tar -jxvf

  19. zip -r

  20. unzip -l

System Information Continued

  1. hostname

  2. dmesg

  3. uptime

  4. diskutil info

  5. sw_vers

  6. systemsetup

  7. pmset -g

  8. sysdiagnose

  9. ioreg -l

  10. spindump

  11. system_profiler SPHardwareDataType

  12. sysctl -a

  13. vm_stat

  14. sudo periodic daily

  15. sudo periodic weekly

  16. sudo periodic monthly

  17. vmmap

  18. mdfind

  19. mdutil

  20. mdls

Network Continued

  1. ifconfig -a

  2. iwconfig

  3. iwlist

  4. iwpriv

  5. netstat -rn

  6. route -n

  7. ip route

  8. ip addr

  9. ip link

  10. arp -a

  11. nmap -sP

  12. nmap -A

  13. curl -I

  14. curl -X

  15. wget -c

  16. wget -r

  17. nc -zv

  18. nc -l

  19. nc -u

  20. nc -k

  21. rsync

  22. rsync -av

  23. rsync -avz

  24. scp -r

  25. scp -i

  26. ssh -L

  27. ssh -R

  28. ssh -D

  29. ssh -X

  30. ftp -i

  31. ftp -n

  32. ftp -v

Package Management Continued

  1. brew cask

  2. brew tap

  3. brew untap

  4. brew cleanup

  5. brew link

  6. brew unlink

  7. brew pin

  8. brew unpin

  9. brew outdated

  10. brew services

  11. brew services start

  12. brew services stop

  13. brew services restart

  14. brew services list

  15. brew bundle

  16. brew list --versions

  17. brew leaves

  18. brew outdated --greedy

  19. brew missing

  20. brew uses

  21. brew desc

Disk and File System Continued

  1. fsck_hfs

  2. fsck_apfs

  3. diskutil mount

  4. diskutil unmount

  5. diskutil eject

  6. diskutil rename

  7. diskutil verifyVolume

  8. diskutil repairVolume

  9. diskutil repairPermissions

  10. diskutil secureErase

  11. diskutil coreStorage

  12. diskutil coreStorage list

  13. diskutil coreStorage create

  14. diskutil coreStorage createVolume

  15. diskutil coreStorage delete

  16. diskutil coreStorage resizeVolume

  17. hdiutil create

  18. hdiutil attach

  19. hdiutil detach

  20. hdiutil verify

  21. hdiutil compact

  22. hdiutil resize

Process Management Continued

  1. ps -e

  2. ps -f

  3. ps -u

  4. ps -p

  5. ps -t

  6. ps -x

  7. ps --forest

  8. top -o cpu

  9. top -o mem

  10. top -u

  11. top -s

  12. htop -d

  13. htop -u

  14. htop -s

  15. htop -p

  16. kill -9

  17. pkill -9

  18. killall -9

  19. pkill -f

  20. nice -n

  21. renice -n

  22. screen -ls

  23. screen -r

  24. screen -S

  25. tmux new-session

  26. tmux attach-session

  27. tmux list-sessions

  28. tmux kill-session

Text Processing Continued

  1. cat file1 file2

  2. cat file1 | less

  3. cat file1 | more

  4. cat file1 | head

  5. cat file1 | tail

  6. grep -i

  7. grep -v

  8. grep -r

  9. grep -l

  10. grep -L

  11. grep -c

  12. grep -n

  13. egrep -i

  14. fgrep -i

  15. awk '{print $1}'

  16. awk '{print $2}'

  17. awk -F: '{print $1}'

  18. awk -F, '{print $1}'

  19. awk 'NR==1{print $0}'

  20. sed 's/foo/bar/'

  21. sed 's/foo/bar/g'

  22. sed 's/foo/bar/2'

  23. sed -n 'p'

  24. sed -n '1,3p'

  25. cut -d: -f1

  26. cut -d, -f1

  27. cut -c1-5

  28. cut -c6-10

  29. tr 'a-z' 'A-Z'

  30. tr -d ' '

  31. sort -n

  32. sort -r

  33. uniq -d

  34. uniq -c

  35. wc -l

  36. wc -w

  37. wc -c

  38. diff -u

  39. patch -p0

  40. tee file1

  41. tee -a file1

  42. fmt -w 80

  43. fmt -u

System Maintenance Continued

  1. sudo su

  2. sudo visudo

  3. sudo shutdown -h now

  4. sudo shutdown -r now

  5. sudo shutdown -c

  6. sudo reboot

  7. sudo halt

  8. sudo init 0

  9. sudo init 6

  10. sudo init 1

  11. sudo service

  12. sudo systemctl status

  13. sudo systemctl start

  14. sudo systemctl stop

  15. sudo systemctl restart

  16. sudo systemctl enable

  17. sudo systemctl disable

  18. sudo systemctl reload

  19. sudo crontab -e

  20. sudo crontab -l

  21. sudo crontab -r

  22. at now

  23. at 5pm

  24. atq

  25. atrm

  26. sudo launchctl list

  27. sudo launchctl load

  28. sudo launchctl unload

  29. sudo launchctl start

  30. sudo launchctl stop

  31. softwareupdate --list

  32. softwareupdate --install

  33. spctl --status

  34. spctl --enable

  35. spctl --disable

  36. csrutil status

  37. csrutil enable

  38. csrutil disable

  39. nvram -p

  40. nvram -d

  41. kextstat

  42. kextload -b

  43. kextunload -b

Development Tools Continued

  1. gcc -o

  2. gcc -Wall

  3. clang -o

  4. clang -Wall

  5. make clean

  6. cmake .

  7. cmake ..

  8. cmake --build .

  9. git init

  10. git clone

  11. git add

  12. git commit

  13. git push

  14. git pull

  15. git status

  16. git diff

  17. git log

  18. git checkout

  19. git branch

  20. git merge

  21. svn checkout

  22. svn update

  23. svn commit

  24. svn status

  25. svn log

  26. hg init

  27. hg clone

  28. hg add

  29. hg commit

  30. hg push

  31. hg pull

  32. python -m

  33. python -c

  34. python3 -m

  35. python3 -c

  36. node -v

  37. `


3

Sure, let's continue and finish the list:

  1. node -e

  2. npm install

  3. npm update

  4. npm uninstall

  5. npm list

  6. npm run

  7. pip install

  8. pip uninstall

  9. pip list

  10. pip show

  11. pip freeze

  12. pip search

  13. ruby -e

  14. rails server

  15. rails generate

  16. rails console

  17. rails db:migrate

  18. php -v

  19. php -r

  20. javac -d

  21. javac -cp

  22. java -jar

  23. java -cp

  24. perl -e

  25. perl -p

  26. go build

  27. go run

  28. go install

  29. go test

  30. rustc --version

  31. rustc -o

  32. cargo build

  33. cargo run

  34. cargo test

  35. cargo install

  36. g++ -o

  37. g++ -Wall

  38. swiftc

  39. swift build

  40. xcodebuild -scheme

  41. xcodebuild -workspace

  42. xcodebuild -project

  43. xcodebuild -target

  44. xcodebuild -list

  45. xcode-select --install

  46. xcode-select --switch

Advanced Usage

  1. alias

  2. unalias

  3. export

  4. unset

  5. source

  6. env

  7. printenv

  8. set

  9. echo $PATH

  10. echo $HOME

  11. echo $USER

  12. history

  13. history -c

  14. fc

  15. jobs

  16. bg

  17. fg

  18. wait

  19. disown

  20. exec

  21. time

  22. times

  23. ulimit

  24. alias ll='ls -la'

  25. alias grep='grep --color=auto'

  26. unalias ll

  27. trap

  28. shopt

  29. complete

  30. select

  31. printf

  32. read

  33. read -p

  34. read -s

  35. declare

  36. typeset

  37. declare -a

  38. declare -A

  39. declare -f

  40. declare -i

  41. declare -x

  42. declare -r

  43. eval

  44. mapfile

  45. coproc

  46. yes

  47. false

  48. true

  49. sleep

  50. exec command > file

  51. exec command < file

  52. command1 | command2

  53. command1 && command2

  54. command1 || command2

  55. command1 ; command2

  56. command1 &

  57. command1 > file

  58. command1 < file

  59. command1 2> file

  60. command1 2>&1

  61. command1 > /dev/null

  62. command1 < /dev/null

  63. command1 >> file

  64. command1 | tee file

  65. command1 | tee -a file

  66. diff <(command1) <(command2)

  67. sudo !!

  68. !$

  69. !*

  70. !^

  71. !n

  72. !?string

  73. !string

  74. ^old^new

  75. cd -

  76. cd ~-

  77. cd ~+

  78. cd --

  79. pushd

  80. popd

  81. dirs

  82. dirs -v

  83. dirs -p

  84. dirs -l

  85. sh

  86. bash

  87. zsh

  88. dash

  89. ksh

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