macOS Specific Terminal Commands
Apple’s 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
- Conclusion
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.
System Information Commands
sw_vers
: Display macOS version details.system_profiler
: Detailed report about hardware and software.hostinfo
: Summary of system configuration.
File Management and Spotlight
mdfind
: Search using the Spotlight index.mdls
: List metadata attributes for a file.SetFile and GetFileInfo
: Change and view file attributes.View file info:
1
GetFileInfo /path/to/file
Hide a file in Finder:
1
SetFile -a V /path/to/file
Disk Utility Commands
diskutil
: Manage disks and volumes.hdiutil
: Work with disk images (ISO, DMG).Mount a disk image:
1
hdiutil mount /path/to/diskimage.dmg
Network Utility Commands
networksetup
: Configure network settings.airport
: Interface with Wi-Fi settings.View Wi-Fi network details:
1
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I
Software Management
softwareupdate
: Interface with software update mechanism.pkgutil
: Manage package receipts.mas
: Command-line interface for the Mac App Store.Search for an app:
1
mas search "app name"
User and Group Management
dscl
: Directory Service command-line utility.List all users:
1
dscl . -list /Users
Create a new user:
1
sudo dscl . -create /Users/username
sysadminctl
: Administer sysadmin accounts.Add a new user:
1
sudo sysadminctl -addUser username -password userpassword -admin
dscacheutil
: Cache lookup tool.Flush DNS cache:
1
sudo dscacheutil -flushcache
Conclusion
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.