Command line, terminal and PowerShell: how to use them

The black window you type commands into puts many people off. Yet it is the command line that lets you do things quickly, precisely and in bulk, which is often impossible with a mouse. Let us thoroughly explain what the terminal and PowerShell are, the basic commands and how to use them at a higher level.
What the command line is
The command line is a text interface for controlling the computer. Instead of clicking with a mouse, you type commands that the computer carries out. The advantage is speed, precision and the ability to automate and repeat things. Professionals use it daily, because with commands you do in a second what would take long through windows.
Terminal, shell and command line: the terms
These words get mixed up, yet they mean slightly different things:
- The terminal is the window you type into.
- The shell is the program that processes commands. On Windows it is Command Prompt (cmd) or PowerShell, on Mac and Linux bash or zsh.
- The command line is the place itself where you type the command.
Put simply: the terminal is the window, the shell is the brain behind it.
Windows: cmd versus PowerShell
On Windows you have two main options. Command Prompt (cmd) is older and simple. PowerShell is modern and far more powerful: it works with objects, handles the management of the whole system and lets you write full scripts. You can conveniently launch both today through the Windows Terminal app.
Basic commands
Here is an overview of the most used commands in cmd, PowerShell and bash (Linux and Mac):
| What it does | cmd (Windows) | PowerShell | bash (Linux, Mac) |
|---|---|---|---|
| List a folder | dir | ls or dir | ls |
| Change folder | cd | cd | cd |
| Current folder | cd | pwd | pwd |
| Make a folder | mkdir | mkdir | mkdir |
| Copy a file | copy | Copy-Item | cp |
| Move a file | move | Move-Item | mv |
| Delete a file | del | Remove-Item | rm |
| Clear the screen | cls | cls | clear |
| Test the network | ping | ping | ping |
Higher-level tricks
This is where the command line becomes a powerful tool:
- History and arrows. The up arrow recalls previous commands, you do not have to retype them.
- Tab completion. Start typing a name and Tab finishes it.
- Output redirection.
command > file.txtsaves the result to a file. - Chaining via a pipe.
command1 | command2sends the output of the first as input to the second. This is the basis of advanced work. - Running as administrator. Many commands require elevated rights (on Windows “Run as administrator”, on Linux
sudo).
PowerShell specifically
PowerShell is exceptional in that it works not just with text but with objects. Commands (so-called cmdlets) have a uniform form, for example Get-Process or Set-Service. They can be chained into work with the whole system. Scripts are saved to .ps1 files.
Automation and scripts
The greatest strength is in automation. You save a sequence of commands into a script (.bat for cmd, .ps1 for PowerShell, .sh for bash) and run it with a single click or schedule it to run by itself. That is how you can do backups, maintenance or bulk file changes.
Watch out for security
One important warning: do not copy commands from the internet blindly. A misunderstood or malicious command can delete data or damage the system, especially with administrator rights. If you are not sure what a command does, check it first.
Want to learn to work more efficiently or automate routine in your company? Get in touch, we will advise and prepare a solution. See also basic Linux commands.
Need help with IT?
We will take care of your computers, networks and security - for businesses and households in the Liptov region.
Contact us