Essential Linux Commands for Beginners (With Examples)

3 min read

The Linux terminal looks intimidating at first, but with about twenty commands you can do practically everything you need day to day. Here are the most important ones with practical examples.

Navigating the File System

  • pwd — shows which folder you are in right now (print working directory)
  • ls — lists files and folders in the current directory
  • ls -la — lists everything including hidden files and permissions
  • cd /path/folder — navigate to a folder
  • cd .. — go up one level in the folder tree
  • cd ~ — go to your home folder

Managing Files and Folders

  • mkdir name — create a new folder
  • touch file.txt — create an empty file
  • cp source destination — copy a file
  • cp -r folder/ destination/ — copy an entire folder
  • mv source destination — move or rename a file
  • rm file.txt — delete a file (NO trash, be careful)
  • rm -rf folder/ — delete a folder and all its contents (be very careful)

Viewing and Editing Files

  • cat file.txt — show the contents of a file
  • less file.txt — show contents paginated (q to exit)
  • nano file.txt — edit a file with the nano editor (easiest)
  • grep 'text' file.txt — search for text inside a file

Permissions and Users

  • sudo command — run a command as administrator (superuser)
  • chmod +x script.sh — give execute permissions to a file
  • chown user file — change the owner of a file
  • whoami — show your current username

Processes and System

  • ps aux — list all running processes
  • top or htop — real-time process monitor
  • kill PID — close a process by its ID
  • df -h — show available disk space
  • free -h — show available RAM

Networking

  • ping google.com — check internet connection
  • curl https://example.com — download content from a URL
  • wget https://example.com/file.zip — download a file
  • ifconfig or ip addr — show network configuration

Installing Programs (Ubuntu/Debian)

  • sudo apt update — update the list of available packages
  • sudo apt install program-name — install a program
  • sudo apt remove program-name — uninstall a program
  • sudo apt upgrade — update all installed programs

What is the first Linux command I should learn?

Start with ls (list files), cd (navigate folders) and pwd (see where you are). With these three commands you can already move around any Linux system confidently. They are the foundation of everything else.

How do I avoid accidentally deleting important files in Linux?

The rm command in Linux has NO trash: files are permanently deleted. To avoid mistakes: (1) use rm -i (asks for confirmation before deleting), (2) install trash-cli which sends to a real trash bin, (3) never use rm -rf / which deletes the entire system.

What is sudo in Linux and when should I use it?

sudo (super user do) lets you run commands with administrator permissions. Use it only when the system requires it or when installing/configuring system software. Do not use it for normal tasks — for security, always work as a regular user.

Conclusion

These commands cover 95% of what you will need as a Linux user. The trick to learning the terminal is to use it: instead of using the file explorer, navigate with cd and ls. After a couple of weeks it will feel completely natural.

Similar Posts