Terminal

1.8 Explain common features and tools of the macOS/desktop operating system

📘CompTIA A+ Core 2 (220-1202)


The Terminal is a powerful tool in macOS that lets users control the computer using text commands instead of clicking icons. Think of it as a “command line interface” (CLI) for macOS. Many tasks that you do with the mouse in Finder can also be done with Terminal—but often faster and more efficiently, especially for IT professionals.


1. Opening Terminal

  • Terminal is found in Applications → Utilities → Terminal.
  • You can also search for it using Spotlight (press Cmd + Space and type “Terminal”).

When you open Terminal, you’ll see a window with a prompt like this:

MacBook:~ user$

Here:

  • MacBook = the name of your computer
  • ~ = your current folder (home folder)
  • user = your username
  • $ = indicates the system is ready for a command

2. Why Terminal is important in IT

Terminal is widely used by IT professionals for tasks such as:

  • Managing files and folders quickly
  • Checking system information
  • Controlling network settings
  • Installing or updating software
  • Running scripts and automation tasks

For the CompTIA A+ exam, you mainly need to know the basic commands and their purposes.


3. Basic Terminal Commands

Here are some essential commands to know for the exam:

CommandPurposeExample
pwdShows your current folder pathpwd/Users/username
lsLists files and folders in the current directoryls → shows all files in home folder
cdChange directory (move to another folder)cd Documents → goes to Documents folder
mkdirCreate a new foldermkdir Projects → creates a folder named Projects
rmDelete filesrm file.txt → deletes file.txt
rmdirDelete empty foldersrmdir OldFolder → deletes OldFolder
cpCopy files/folderscp file.txt backup.txt → copies file.txt to backup.txt
mvMove or rename files/foldersmv file.txt Documents/ → moves file.txt to Documents
touchCreate a new empty filetouch notes.txt → creates notes.txt

💡 Tip for the exam: Be careful with rm — it permanently deletes files, unlike Trash in Finder.


4. Viewing File Content

Sometimes, you need to see what’s inside a file without opening a program. Use:

  • cat file.txt → shows the content of the file
  • less file.txt → shows content one screen at a time
  • head file.txt → shows the first 10 lines
  • tail file.txt → shows the last 10 lines

These are useful for reading logs or configuration files in IT environments.


5. System and Network Commands

Terminal can also be used for checking system and network info:

CommandPurpose
topShows active processes and system resource usage
dfShows disk space usage
duShows folder size
ifconfigShows network interfaces and IP addresses
pingChecks connectivity to another computer
tracerouteTracks the path to a remote server
whoamiShows current logged-in user

These commands are often used by IT technicians for troubleshooting.


6. Using Sudo (Superuser)

Some commands need administrator privileges. Terminal uses sudo for this:

sudo command
  • Example: sudo shutdown -r now → restarts the Mac immediately
  • The system will ask for your password before running the command.

⚠️ Only use sudo when necessary — wrong commands can break the system.


7. Command Shortcuts and Tips

  • Tab key → auto-completes file/folder names
  • Up/Down arrows → scroll through previous commands
  • Ctrl + C → stops a running command
  • Ctrl + L → clears the screen

These shortcuts make working in Terminal faster and more efficient.


8. Why IT Professionals Prefer Terminal

  • Automation: Scripts can run repetitive tasks automatically.
  • Remote management: Terminal works with SSH to control remote systems.
  • Power: Commands can perform complex tasks that Finder cannot.

For the A+ exam, you only need to know basic file management, system info, and network commands, not advanced scripting.


Key Points for the Exam

  1. Terminal is a CLI tool for macOS.
  2. Basic commands: pwd, ls, cd, mkdir, rm, cp, mv, touch.
  3. File content commands: cat, less, head, tail.
  4. System/network commands: top, df, ifconfig, ping.
  5. Use sudo for commands requiring admin privileges.
  6. Shortcuts like Tab (autocomplete) and Up/Down (command history) help efficiency.
Buy Me a Coffee