Basic Linux commands: a clear guide for beginners

Linux is most effectively controlled through the terminal, and a few dozen commands open the door to its full power. It is not hard, you just need to know the basics. Let us go through the most important Linux commands clearly and by group. If you are just starting, the article which Linux distribution to choose also helps.
Moving through the file system
| Command | What it does |
|---|---|
pwd | prints which folder you are in |
ls | lists the contents of a folder |
ls -la | lists everything including hidden files and details |
cd folder | goes into a folder |
cd .. | one level up |
Working with files and folders
| Command | What it does |
|---|---|
mkdir name | creates a folder |
touch file | creates an empty file |
cp source target | copies a file |
mv source target | moves or renames |
rm file | deletes a file |
rm -r folder | deletes a folder with its contents |
Be careful with rm, what is deleted does not go to a recycle bin.
Viewing file contents
| Command | What it does |
|---|---|
cat file | prints the whole content |
less file | pages through a long file |
head / tail | start / end of a file |
nano file | a simple text editor in the terminal |
Searching
| Command | What it does |
|---|---|
find . -name "*.txt" | finds files by name |
grep "text" file | finds text in a file |
locate name | quick search using a database |
Permissions and rights
In Linux every file has rights to read, write and execute. These commands help:
| Command | What it does |
|---|---|
ls -l | shows the rights (rwx) |
chmod | changes a file’s rights |
chown | changes the owner |
sudo command | runs a command with administrator rights |
System and processes
| Command | What it does |
|---|---|
top or htop | running processes and load |
ps aux | list of processes |
kill PID | ends a process |
df -h | free space on disks |
free -h | memory usage |
uname -a | information about the system |
Installing software
The way depends on the distribution, because each family has its own package manager:
| System | Example of installation |
|---|---|
| Debian, Ubuntu, Mint | sudo apt install name |
| Fedora | sudo dnf install name |
| Arch | sudo pacman -S name |
Before installing it is good to update the lists, for example sudo apt update.
Network commands
| Command | What it does |
|---|---|
ip a | shows network addresses |
ping address | tests reachability |
ssh user@server | a remote connection to a server |
wget / curl | downloads a file or calls an address |
Useful tricks
- Tab completes names, the up arrow recalls previous commands.
man commandshows the manual for any command.- The pipe
|joins commands, for examplels -la | grep ".txt". historyshows the command history.
Watch out for dangerous commands
Especially rm -rf in combination with sudo can irreversibly delete large parts of the system. Never run sudo rm -rf / and always check commands you copy from the internet. This relates to the article on the command line and terminal.
Do you need help with Linux or to deploy a server? Get in touch, we will advise and set it up. The article revive an old computer with Linux also comes in handy.
Need help with IT?
We will take care of your computers, networks and security - for businesses and households in the Liptov region.
Contact us