Linux for Beginners Essential Commands You Need

Linux for Beginners Essential Commands You Need

Learning a handful of essential terminal commands is the fastest way to feel confident on Linux. These commands cover navigating files, managing them, viewing content, and controlling your system, and they work across virtually every Linux distribution.

Navigating the Filesystem

The terminal always operates from a “current directory.” These commands move you around it:

  • pwd — print working directory; shows where you are.
  • ls — list files. Use ls -l for details and ls -la to include hidden files.
  • cd directory — change into a directory. cd .. goes up one level, and cd ~ returns to your home folder.

Tip: press Tab to autocomplete file and folder names, which saves time and avoids typos.

Managing Files and Directories

  • mkdir name — create a new directory.
  • touch file.txt — create an empty file or update its timestamp.
  • cp source dest — copy a file. Add -r to copy a directory and its contents.
  • mv source dest — move or rename a file.
  • rm file — delete a file. Use rm -r folder for directories.

Be careful with rm. There is no recycle bin in the terminal; deleted files are gone. Double-check before running rm -r, and never run rm -rf /.

Viewing and Searching Content

  • cat file — print a file’s contents to the screen.
  • less file — view a long file page by page; press q to quit.
  • head file and tail file — show the first or last lines. tail -f follows a log live.
  • grep "text" file — search for text inside a file.
  • find . -name "*.txt" — find files by name starting from the current directory.

System and Permission Commands

Running commands as administrator

Some actions require elevated privileges. Prefix them with sudo:

sudo apt update

You will be asked for your password. Use sudo only when necessary, as it can change critical system files.

Checking the system

  • df -h — show disk space in human-readable form.
  • free -h — show memory usage.
  • top or htop — display running processes in real time.
  • ps aux — list all running processes.

File permissions

Use chmod to change permissions and chown to change ownership. For example, chmod +x script.sh makes a script executable.

Getting Help

You never need to memorize everything. Every command documents itself:

  • man command — open the full manual for a command.
  • command --help — show a quick summary of options.
  • which command — show where a command lives on your system.

Combine commands with the pipe | to send one command’s output into another, for example ls -l | grep ".txt".

Frequently Asked Questions

Do I need to use the terminal on Linux?

For everyday desktop use, no, since modern distributions offer graphical tools for most tasks. However, learning a few commands makes you far more efficient and is essential for servers and troubleshooting.

What is the difference between sudo and root?

Root is the all-powerful administrator account. sudo lets a regular user run individual commands with root privileges temporarily, which is safer than logging in as root for everything.

How do I cancel a command that is running?

Press Ctrl + C to stop the current command. If a program has taken over the screen, like a text viewer, pressing q usually quits it.

Are these commands the same on every Linux distribution?

The core commands covered here are part of standard Linux and work everywhere. The main difference between distributions is the package manager, such as apt on Debian/Ubuntu versus dnf on Fedora.

Similar Posts