Command line basics for beginners are useful even when you normally use a mouse. A terminal can help you follow developer instructions, organise project files and run tools. This lesson focuses on safe navigation and file-listing commands; it does not ask you to change system settings or delete files.
What is the command line?
The command line is a text interface where you type instructions for a computer program called a shell. A terminal is the application window that lets you interact with the shell. Commands can navigate folders, display information, create files and run software tools.
On Windows, common choices include PowerShell and Command Prompt. On Linux and macOS, learners often use a Bash or Zsh shell. Some command names look similar, but their options and behaviour are not always the same. Always identify the shell before copying a command from a tutorial.
Open a terminal and understand the prompt
Open PowerShell from the Windows Start menu, or open Terminal on a Linux or macOS computer. You will see a prompt that may show a folder path and a cursor. The prompt is waiting for a command; it is not a place to paste an entire tutorial without reading it.
A shell command normally has a command name followed by optional arguments. For example, Get-ChildItem is a PowerShell command that lists items in the current folder. Press Enter to run a command. Use the up-arrow key to review a previous command, and use Tab completion when you recognise the path you are selecting.
How do you check your current folder?
Use Get-Location in PowerShell or pwd in many Linux and macOS shells to display the current working directory. This tells you where a relative path or file command will operate, so check it before creating anything or following a tutorial.
The folder shown is called the current working directory. A path such as Documents/Practice is relative to it. A full path starts from a drive or root location. Folder names containing spaces should be placed inside quotation marks when a command expects one path argument.
List files and move between folders
| Task | PowerShell | Linux/macOS shell |
|---|---|---|
| Show current folder | Get-Location | pwd |
| List items | Get-ChildItem | ls |
| Move into a folder | Set-Location "Documents" | cd "Documents" |
| Move to parent folder | cd .. | cd .. |
| Create a folder | New-Item -ItemType Directory -Name "Practice" | mkdir Practice |
Some PowerShell commands have aliases such as pwd, ls and cd. These aliases make familiar commands available, but the underlying shell and syntax still matter. In a lesson or workplace task, use the command style documented for the system you are using.
How do you create and read a practice file?
Move to a folder where you are allowed to create practice material, make a new directory and create a harmless text file inside it. In PowerShell, use New-Item; in a Linux/macOS shell, use touch. Then list the folder to confirm the file exists.
Example in PowerShell:
New-Item -ItemType Directory -Name "CLI-Practice"
Set-Location "CLI-Practice"
New-Item -ItemType File -Name "notes.txt"
Get-ChildItem
Get-Content "notes.txt"
Example in a Linux/macOS shell:
mkdir CLI-Practice
cd CLI-Practice
touch notes.txt
ls
cat notes.txt
The examples create a folder and an empty file. To add text, open the file in a text editor rather than guessing an unfamiliar command. The cat command displays file content in many Unix-like shells; PowerShell's Get-Content performs a similar reading task.
Understand paths before running commands
- Current folder: the directory where the shell is currently working.
- Relative path: a location described from the current directory, such as
Projects/Website. - Absolute path: a full location, such as
C:\Users\Student\Documentsin Windows or/home/student/Documentson many Linux systems. - Parent directory: the folder one level above the current directory, represented by
..in common shells.
Do not assume that a path copied from a Windows tutorial will work in Linux or that a Linux path will work in PowerShell. Check separators, drive names, permissions and quotation marks when a path contains spaces.
Command-line safety checklist
Commands can change many files very quickly. Practise in a folder you created for learning, read the command and its arguments before pressing Enter, and check the current directory. Do not run administrator commands simply because a website suggests them.
- Avoid destructive commands such as recursive delete or disk-format operations while learning.
- Do not paste commands from an unknown source when you cannot explain what they do.
- Do not expose passwords, tokens or private files in screenshots or terminal output.
- Ask before changing a shared or school computer.
- When a command reports an error, read the message and verify the spelling and path before trying again.
Practice task: create a small project folder
Open your terminal, confirm the current folder, create a directory named Study-CLI, move into it and create a text file named plan.txt. List the directory to check the result. Write down which shell you used and which commands worked. Do not use a folder containing important coursework for this first exercise.
Frequently asked questions
Is the command line the same as a terminal?
They are related but not identical. The terminal is the application window that accepts text input and displays output; the command line is the text-based way of giving instructions. A shell runs commands inside the terminal, and different shells can use different syntax or tools.
Do Windows and Linux use the same commands?
Some basic commands and aliases look similar, but Windows PowerShell, Command Prompt and Linux shells have different command names, options and path conventions. Check the shell in use and follow documentation for that environment rather than assuming a command behaves identically everywhere.
What does the pwd command do?
In many Linux and macOS shells, pwd prints the current working directory. It helps you see where relative paths will be resolved. PowerShell provides the equivalent Get-Location command and also supports pwd as an alias. This is useful when a tutorial shows a familiar Unix-style command.
Can I damage my computer by using the command line?
Yes, commands can delete files, change settings or affect the whole system, especially when run with administrator privileges. Start with safe listing and navigation commands, practise in a folder you created, read each command and avoid instructions you do not understand.
Do I need programming skills to learn command-line basics?
No. You can begin by checking locations, listing folders and creating a practice directory without writing a program. Programming and scripting become useful later when you want to automate repeated tasks, but they are not prerequisites for basic terminal navigation.
Key takeaway
The command line is a practical text interface for working with folders, files and tools. Learn your shell, check the current directory, practise basic navigation and create files only in a safe folder. Read commands before running them, especially when they request administrator access.