Important macOS Terminal commands for developers

Introduction

macOS provides a Unix-based terminal environment that developers use daily for navigation, file management, system monitoring, and networking. Below are essential commands with examples you can copy and use directly.

Navigation Commands

pwd                  :: print current working directory
ls                   :: list files and folders
ls -la               :: list all files with details
cd foldername        :: change directory
cd ..                :: go up one directory

File and Folder Management

mkdir myproject      :: create a new folder
rmdir myproject      :: remove an empty folder
rm file.txt          :: delete a file
rm -r foldername     :: delete a folder and its contents
cp file.txt ~/backup/ :: copy file
mv file.txt ~/work/   :: move file

File Viewing and Editing

cat file.txt         :: display file contents
less file.txt        :: view file with scrolling
nano file.txt        :: edit file in nano editor
vim file.txt         :: edit file in vim editor
open file.txt        :: open file with default app

System Information

whoami               :: show current user
date                 :: show date and time
uname -a             :: show system details
df -h                :: show disk usage
top                  :: monitor processes in real time
sw_vers              :: show macOS version

Process and Task Management

ps aux               :: list running processes
kill -9 PID          :: kill process by ID
activity monitor     :: GUI process viewer (open via Spotlight)

Networking Commands

ping google.com      :: test connectivity
curl example.com     :: fetch content from URL
wget example.com     :: download file (if installed)
ifconfig             :: show network interfaces
ipconfig getifaddr en0 :: show IP address of Wi-Fi

Package Management

brew install git     :: install Git using Homebrew
brew update          :: update Homebrew
brew upgrade         :: upgrade installed packages

Developer Utilities

git --version        :: check Git installation
node -v              :: check Node.js version
python3 --version    :: check Python version
gcc --version        :: check C compiler version
java -version        :: check Java installation

Conclusion

These macOS Terminal commands cover navigation, file management, system monitoring, networking, and developer utilities. By mastering them, developers can streamline daily tasks and work more efficiently in the macOS environment.