Skip to content

Command Line Basics for Support Technicians

20 min read Training Guide

Open Command Prompt, PowerShell or Mac Terminal with the right level of rights, move around folders, handle files without losing them, and copy command output into a ticket.

Table of contents

Sooner or later a knowledge base article tells you to "open a command prompt and run this." The command line is a text window where you type an instruction and the computer runs it. It is faster than clicking through menus, it works over a slow remote session, and it gives you exact text to paste into a ticket. It also does exactly what you type, right away, with no Recycle Bin and no "Are you sure?" A wrong path in a delete command can wipe a user's files.

Steps were checked in November 2026 on Windows 11, version 26H2, and macOS 27 (Golden Gate), against Microsoft Learn and Apple's Terminal User Guide. Menus move between releases. Command names change much more slowly.

What You Will Be Able to Do

  • Tell Command Prompt, PowerShell and Mac Terminal apart, and open each with or without administrator rights.
  • Read a file path and move between folders.
  • Copy, move, rename and delete files from the command line without losing data.
  • Get help for any command, and read the most common error messages.
  • Save or copy command output into a ticket.

Three Shells and One Window

A shell is the program that reads what you type and runs it. The terminal is the window the shell runs in. On Windows, the Windows Terminal app holds tabs, and each tab can run a different shell. Unless someone changed its settings, a new tab opens PowerShell.

Shell Where you find it What it is good for
Command Prompt (cmd) Every Windows PC Older commands, and many knowledge base steps
Windows PowerShell 5.1 Built into Windows Admin tasks, with verb-noun commands such as Get-Process
PowerShell 7 A separate install The same language, newer, if your team installs it
Terminal with zsh Mac, in Applications, then Utilities Mac support. zsh is the default since macOS 10.15

Know which one you are in before you type. The prompt, the text before your cursor, tells you:

  • C:\Users\jlee> is Command Prompt.
  • PS C:\Users\jlee> is PowerShell. The PS gives it away.
  • jlee@MacBook-Air ~ % is zsh on a Mac.

A command written for one shell often fails in another, so check the prompt first whenever a step does not work.

Opening a Shell With and Without Admin Rights

Most support commands, such as listing files, need no special rights. Some, such as repairing system files, need an elevated window, one running with administrator rights. Elevate only when the step needs it.

On Windows:

  1. Right-click the Start button, or press Windows key + X.
  2. Choose Terminal for a normal window, or Terminal (Admin) for an elevated one. If those are missing, type "terminal", "powershell" or "cmd" in Start, then choose Run as administrator.
  3. Approve the User Account Control prompt with your own admin account, the way your employer's policy says. Never use a user's password.
  4. Check the title bar. An elevated window says Administrator in its title.

On a Mac:

  1. Press Command + Space, type "Terminal", and press Return.
  2. For a command that needs admin rights, type sudo and a space before it. Only administrator accounts can use sudo.
  3. Type the account's password when asked, and press Return. Nothing appears on the screen as you type, and the cursor does not move. That is normal.

Warning: An elevated window can change or delete anything on the computer, including system files and other users' data. Close it as soon as the step is done, and never leave one open on a user's screen.

Whose Account Is This Window Running As

An elevated window often runs under your admin account, not the user's. Then shortcuts such as $HOME, ~ and %USERPROFILE% point to your profile folder, not theirs, so a folder you check can look empty when it is not. Type whoami in any of the three shells to see which account the window runs as. For a user's files, type the full path, such as C:\Users\mreyes\Downloads.

Paths: The Address of Every File

A path is a file's address.

  • Windows: C:\Users\jlee\Documents\Invoices. A drive letter, then folders separated by backslashes.
  • A network share on Windows: \\fileserver\shared\ops. Two backslashes, then the server name.
  • Mac: /Users/jlee/Documents/Invoices. Forward slashes, starting at the top of the disk.

An absolute path starts at the top, such as C:\ or /, and works from anywhere. A relative path starts from the folder you are in now. Two dots, .., mean the folder above this one. One dot, ., means this folder. On a Mac, ~ means your home folder.

Spaces need quotes. A shell splits what you type at each space, so wrap any path with a space in double quotes: cd "C:\Users\jlee\OneDrive - Example Co\Invoices". Work OneDrive folders almost always have spaces in their names.

Let the computer type paths for you. Typing long paths by hand causes most "cannot find the path" errors.

  • Tab completion. Type the first few letters of a folder name and press Tab. The shell fills in the rest and handles spaces.
  • Copy as path. In File Explorer, right-click a file or folder and choose Copy as path.
  • Drag and drop on a Mac. Drag a file from Finder into the Terminal window, and its path appears at the cursor.

The Commands You Will Use Most

Task Command Prompt PowerShell Mac Terminal
Show where you are cd pwd pwd
List what is here dir dir or ls ls -la
Go into a folder cd Reports cd Reports cd Reports
Go up one level cd .. cd .. cd ..
Make a folder mkdir Old mkdir Old mkdir Old
Copy a file copy a.txt b.txt copy a.txt b.txt cp a.txt b.txt
Move or rename move, ren move, ren mv
Delete a file del a.txt del a.txt rm a.txt
Show a text file type a.txt cat a.txt cat a.txt
Help for a command copy /? Get-Help Copy-Item man cp

A few details that trip people up:

  • PowerShell borrows the names, not the options. In PowerShell, dir, ls, copy and del are aliases, short names for full commands such as Get-ChildItem and Remove-Item. They take PowerShell options. So ls -la and dir /s both fail in PowerShell. Use dir -Recurse to include subfolders, and dir -Force to show hidden files.
  • Hidden files. In Command Prompt, dir /a shows them. On a Mac, ls -la shows files whose names start with a dot. Press Q to leave a man help page.
  • Changing drives in Command Prompt. Use cd /d D:\Scans to change drive and folder at once.
  • Open the folder you are in. Type explorer . on Windows or open . on a Mac.
  • Repeat and stop. The up arrow brings back an earlier command. Ctrl + C stops one that is running or stuck, in all three shells.

Working With Files Without Losing Them

Warning: Files deleted with del, rm or Remove-Item do not go to the Recycle Bin or the Trash. They are gone unless a backup has them.

Follow these rules every time:

  1. Look before you act. Run dir or ls with the same path or wildcard you plan to use, and read the list. If it surprises you, stop.
  2. Know where you are. Run cd or pwd before a command that uses a relative path or a wildcard.
  3. Quote every path with a space.
  4. Copy first, delete later. Delete the original only after the copy opens.
  5. Preview in PowerShell. Add -WhatIf to Remove-Item, Copy-Item or Move-Item to see what it would do without doing it.
  6. No recursive deletes on user data. del /s, rmdir /s /q, rm -rf and Remove-Item -Recurse delete whole folder trees. Use them on a user's files only when a written procedure says to and a checked backup exists.

A wildcard stands for any characters. *.tmp means every file ending in .tmp.

Worked Example: The Unquoted Space

A ticket asks you to clear temporary files from C:\Users\mreyes\Old Projects. In Command Prompt you type del C:\Users\mreyes\Old Projects\*.tmp with no quotes. Command Prompt reads that as two separate names: C:\Users\mreyes\Old and Projects\*.tmp. The first matches nothing. The second is a relative path, so it deletes every .tmp file in a folder named Projects inside whatever folder you happen to be in, which might be another user's work.

The safe version takes three commands:

cd /d "C:\Users\mreyes\Old Projects"
dir *.tmp
del *.tmp

The dir line shows 31 files, all ending in .tmp, so the del line is safe to run. In PowerShell, Remove-Item "C:\Users\mreyes\Old Projects\*.tmp" -WhatIf gives the same preview in one step.

Reading the Answer

Read the whole message first. Most errors are one of these.

Message What it usually means What to do
"is not recognized" or "command not found" A typo, the wrong shell, or the program is not installed Check the spelling and the prompt
"Access is denied" or "Permission denied" Your account lacks rights for that file or task Decide if the step really needs admin rights, then elevate by policy
"cannot find the path" or "No such file or directory" A typo, or a path with a space and no quotes Use Tab completion and quotes
"being used by another process" A program has the file open Ask the user to save and close it
"running scripts is disabled on this system" PowerShell's script policy blocks it Do not change the policy. Ask the script's owner

Getting Output Into a Ticket

Command output beats a screenshot as ticket evidence, because the next technician can search it and copy from it.

  • Send it to the clipboard. Add a vertical bar and clip on Windows, or pbcopy on a Mac, then paste into the ticket.
  • Save it to a file. Add > and a file name to save it. That replaces the file if it exists. Use >> to add to the end of a file instead.
systeminfo | clip
sw_vers | pbcopy
dir "C:\Users\mreyes\Documents" > C:\Temp\mreyes-docs.txt

The first copies a Windows PC's details, including its version, last boot time and memory. The second copies a Mac's version and build. The third saves a folder listing to a text file. Its folder, C:\Temp here, must already exist. These quick checks work almost everywhere:

Question Windows Mac
What is this computer called? hostname hostname
Who is this window running as? whoami whoami
Which OS version is this? winver or systeminfo sw_vers
How long since a restart? systeminfo (System Boot Time) uptime

Before you paste, remove anything private, and never paste a password or recovery key into a ticket.

Network commands such as ipconfig, ping and tracert run in these same windows during network troubleshooting. So does sfc /scannow, the system file check, from an elevated window during Windows repair work.

Never Paste a Command You Do Not Understand

A pasted command runs with your rights. In a trick Microsoft calls ClickFix, a fake CAPTCHA or error page tells people to press Windows key + R, paste a line and press Enter, or to paste a line into Terminal on a Mac. The line installs malware. Microsoft reported in 2025 that these campaigns reached thousands of devices a day, and that a real CAPTCHA or error message never asks for this.

  • Run only commands from your team's knowledge base, the vendor's documentation, or ones you understand part by part.
  • Never run a command that a caller, an email or a pop-up gives you.
  • If a user says a website had them paste and run something, treat it as a security incident. Report it right away through your incident process, and do not run the command yourself to "see what it does."

Common Mistakes

Mistake What it costs
Running del or rm with a wildcard before listing the matches Files gone, with no Recycle Bin
Leaving out quotes around a path with spaces The wrong files deleted
Using $HOME in an elevated window You work in your own profile, not the user's
Leaving an elevated window open Anyone at the keyboard has admin rights
Pasting a command from a website or caller Malware runs with your rights

Check Your Understanding

1. A knowledge base article says to run dir /s C:\Scans. Your window shows PS C:\Users\jlee> and the command fails. What happened, and what do you do?

You are in PowerShell, and /s is a Command Prompt option. Run dir C:\Scans -Recurse instead, or run the original in a Command Prompt tab.

2. You open Terminal (Admin) with your own admin account, type cd $HOME\Downloads, and find the folder empty. The user insists their Downloads folder is full. Who is right?

The user. $HOME points to your admin profile, because the elevated window runs as you. Run whoami to confirm, then use the full path, such as C:\Users\mreyes\Downloads.

3. A ticket asks you to delete the .log files in D:\App Data\Logs. What do you type, in order, in Command Prompt?

cd /d "D:\App Data\Logs" to get there with the space quoted, dir *.log to see what matches, and only then del *.log.

4. A user calls. A website told them to press Windows key + R, paste a line and press Enter "to prove they are human." They did. What do you do?

Treat it as a security incident and report it right away through your incident process. A real CAPTCHA never asks for that. Do not run the pasted command yourself.

Key Takeaways

  • Check the prompt first: C:\> is Command Prompt, PS is PowerShell, % is zsh on a Mac.
  • Elevate only when a step needs it, with your own admin account, and close the window when you finish.
  • Quote paths with spaces, and list before you delete. Command line deletes skip the Recycle Bin and the Trash.
  • Pipe output to clip or pbcopy so the ticket gets searchable text, with anything private removed.
  • Never run a command from a caller, an email or a pop-up.