How to Use Terminal on Mac for Beginners
Learn Terminal basics on Mac. Open Terminal, navigate files, run commands, and master essential shortcuts for macOS command line interface.
- Open Terminal. Press Command+Space to open Spotlight search. Type 'Terminal' and press Enter. Alternatively, go to Applications → Utilities → Terminal. A black window with white text appears, showing your username and computer name followed by a dollar sign ($).
- Learn your current location. Type 'pwd' and press Enter. This shows your present working directory—where you currently are in your file system. You'll likely see something like '/Users/yourname', which is your home folder. This command helps you understand your starting point.
- View folder contents. Type 'ls' and press Enter to list files and folders in your current location. You'll see items like Desktop, Documents, Downloads. Type 'ls -la' for detailed information including hidden files, file sizes, and permissions.
- Navigate between folders. Type 'cd Desktop' to move into your Desktop folder. Type 'cd ..' to go up one level to the parent folder. Type 'cd ~' to return to your home folder instantly. Use Tab completion by typing the first few letters of a folder name and pressing Tab.
- Create and manage files. Type 'mkdir test_folder' to create a new folder. Type 'touch test_file.txt' to create an empty text file. Type 'rm test_file.txt' to delete a file, or 'rmdir test_folder' to remove an empty folder. Always double-check before deleting anything.
- Clear Terminal and access history. Type 'clear' or press Command+K to clear the Terminal window for a fresh start. Press the up arrow key to cycle through previously entered commands. Press down arrow to move forward through your command history.
- Get help and exit safely. Type 'man' followed by any command name (like 'man ls') to see its manual page—press Q to exit the manual. Type 'exit' or press Command+Q to close Terminal. If a command seems stuck, press Control+C to cancel it.