macOS operating system, built on a Unix foundation, offers a rich set of command-line utilities. While many commands are shared with other Unix-based systems,
macOS brings its unique set of tools tailored for its environment. This article focuses on some macOS-specific terminal commands.
Table of Contents:
- System Information Commands
- File Management and Spotlight
- Disk Utility Commands
- Network Utility Commands
- Software Management
- User and Group Management
The power of macOS’s Unix foundation shines when delving into Terminal commands. Let’s uncover more macOS-specific commands to assist with various tasks.
sw_vers: Display macOS version details.
system_profiler: Detailed report about hardware and software.
hostinfo: Summary of system configuration.
mdfind: Search using the Spotlight index.
mdls: List metadata attributes for a file.
SetFile and GetFileInfo: Change and view file attributes.
View file info:
Hide a file in Finder:
SetFile -a V /path/to/file
diskutil: Manage disks and volumes.
hdiutil: Work with disk images (ISO, DMG).
Mount a disk image:
hdiutil mount /path/to/diskimage.dmg
networksetup: Configure network settings.
airport: Interface with Wi-Fi settings.
View Wi-Fi network details:
softwareupdate: Interface with software update mechanism.
pkgutil: Manage package receipts.
mas: Command-line interface for the Mac App Store.
Search for an app:
mas search "app name"
dscl: Directory Service command-line utility.
List all users:
dscl . -list /Users
Create a new user:
sudo dscl . -create /Users/username
sysadminctl: Administer sysadmin accounts.
Add a new user:
sudo sysadminctl -addUser username -password userpassword -admin
dscacheutil: Cache lookup tool.
Flush DNS cache:
sudo dscacheutil -flushcache
macOS is packed with versatile terminal commands, streamlining system administration and troubleshooting tasks. Delve into each command’s manual with
man commandname for deeper insights.