macOS Terminal is a powerful tool for performing tasks quickly and efficiently. Below are 10 essential commands, explained step-by-step, that every Mac user should know to navigate, manage files, and troubleshoot effectively.
List Files and Folders:
Use ls
to view all files and folders in the current directory. Add -l
for detailed info or -a
for hidden files.
ls -la
Change Directory:
Navigate to a folder with cd
. Use cd ..
to go up one level or cd ~
to return home.
cd Documents
Print Working Directory:
Use pwd
to display the full path of your current directory location.
pwd
Create a Folder:
Use mkdir
to create a new folder in the current directory.
mkdir
Copy Files or Folders:
Copy files with cp
. Use -r
to copy entire directories.
cp file.txt /path/to/destination
cp -r SourceFolder/ DestinationFolder/
Move or Rename Files:
Use mv
to move files to another location or rename them.
mv oldname.txt newname.txt
mv file.txt /path/to/destination/
Delete Files or Folders:
Use rm
to delete files or rm -r
to remove folders permanently.
rm file.txt
rm -r FolderName
Open Files or Apps:
Use open
to launch files, folders, or apps.
open file.txt
open -a "Safari"
Monitor System Performance:
Use top
to view live system resource usage like CPU and memory. Exit with Ctrl + C.
top
Shut Down the Mac:
Use sudo shutdown
for an immediate or scheduled shutdown.
sudo shutdown -h now
sudo shutdown -h +30