LinuxLow

Basic Linux Commands: Complete List for Beginners

This guide will introduce you to the most commonly used Linux commands. You'll learn navigation, file and process management, significantly boosting your terminal efficiency.

Updated at February 14, 2026
15-30 minutes
Easy
FixPedia Team
ΠŸΡ€ΠΈΠΌΠ΅Π½ΠΈΠΌΠΎ ΠΊ:Ubuntu 22.04Debian 11CentOS 7Fedora 36

Introduction

Working in Linux without knowing basic commands is like reading a book without knowing the alphabet. The terminal (command line) is the primary tool for administration, configuration, and everyday tasks in Linux. By mastering a few dozen key commands, you'll be able to navigate the file system quickly, manage files and processes, and get system information. This guide is your starting point: we've collected the most important commands with explanations and examples that will be useful for anyone starting with Linux.

Requirements

Before you begin, make sure you have:

  • Access to a Linux terminal (locally, via a virtual machine, or remotely through SSH).
  • Basic understanding of the file system structure (what directories and files are).
  • Permissions to perform operations (for some commands, like rm or sudo, administrator rights may be required).

Step 1: Navigating the File System

The first thing to learn is understanding where you are and moving between directories.

pwd β€” Where am I?

The pwd (print working directory) command shows the current full path to the directory.

pwd
# Example output: /home/username

cd β€” Change Directory

cd (change directory) switches you to the specified directory.

cd /var/log   # navigate to /var/log
cd ~          # go to the home directory
cd ..         # move up one level
cd -          # return to the previous directory

ls β€” List Contents

ls (list) outputs a list of files and subdirectories in the current directory.

ls                # simple list
ls -l             # detailed list (permissions, size, date)
ls -a             # show hidden files (starting with .)
ls -lh            # sizes in a readable format (KB, MB)

Step 2: Managing Files and Directories

Now let's learn how to create, copy, move, and delete file system objects.

Creation

  • touch filename β€” create an empty file.
  • mkdir dirname β€” create a new directory.
  • mkdir -p path/to/dir β€” create nested directories (if intermediates don't exist).
touch newfile.txt
mkdir documents
mkdir -p projects/2024/plan

Copying and Moving

  • cp source destination β€” copy a file or directory.
  • mv source destination β€” move or rename a file/directory.
cp file.txt backup/
cp -r dir1 dir2   # recursive directory copy
mv old.txt new.txt
mv file.txt /home/user/Documents/

Deletion

  • rm file β€” delete a file.
  • rm -r dir β€” delete a directory and all its contents.
  • rm -f file β€” force deletion without prompts.

⚠️ Caution! Files deleted via rm usually don't go to the trash. Make sure you specify the correct path.

rm oldfile.txt
rm -r old_dir/

::in-article-ad

::

Step 3: Viewing and Editing Files

Sometimes you need to quickly view a file's contents or make edits.

Outputting Contents

  • cat file β€” output the entire file to the terminal (suitable for small files).
  • less file β€” page-by-page viewing (scroll with arrows, exit with q).
  • head file β€” first 10 lines of a file.
  • tail file β€” last 10 lines (useful for logs).
cat /etc/os-release
less /var/log/syslog
tail -f /var/log/auth.log   # monitor changes in real time

Editing

  • nano file β€” simple text editor with prompts (ideal for beginners).
  • vim file β€” powerful modal editor (requires learning but very efficient).
nano myconfig.conf
# In nano: Ctrl+O β€” save, Ctrl+X β€” exit

Step 4: Managing Processes

Processes are running programs. Knowing how to manage them is critical for system stability.

Viewing Processes

  • ps β€” snapshot of processes (usually current user).
  • ps aux β€” all system processes (columns: USER, PID, %CPU, %MEM, COMMAND).
  • top or htop β€” interactive monitoring (real-time updates, sorting, termination).
ps aux | grep nginx   # find nginx processes
top                  # to exit β€” q

Terminating Processes

  • kill PID β€” gently terminate a process by its ID (PID).
  • kill -9 PID β€” force terminate (SIGKILL) if the process is unresponsive.
kill 1234            # graceful termination
kill -9 1234         # forceful
pkill firefox        # terminate all processes named firefox

Step 5: Searching and Filtering

When you have many files, search by name or content.

Finding Files

  • find /path -name "filename" β€” search for files by name (supports wildcards *).
  • find /path -type f β€” only files (-type d β€” directories).
  • find /path -size +1M β€” files larger than 1 MB.
find /home -name "*.txt"
find /var/log -type f -mtime -7   # modified in the last 7 days

Searching Text Inside Files

  • grep "pattern" file β€” find lines containing the pattern.
  • grep -r "pattern" /dir β€” recursive search in a directory.
  • grep -i "pattern" β€” case-insensitive.
grep "error" /var/log/syslog
grep -r "TODO" ~/projects/

Step 6: Getting Help

Don't memorize everything β€” Linux has excellent built-in documentation.

man β€” Manual Pages

man command shows the full manual page with description, options, and examples.

man ls
# Navigation: arrows, PageUp/Down, /text to search, q to exit

--help or -h

Quick help directly in the terminal.

ls --help
grep -h

whatis β€” Short Description

whatis ls
# Output: ls (1)               - list directory contents

Checking Your Results

After completing this guide, you should be able to confidently perform the following actions:

  1. Open a terminal and run pwd β€” you'll see the current path.
  2. Navigate to another directory with cd and verify with ls.
  3. Create a file touch test.txt and a directory mkdir test_dir.
  4. Copy a file cp test.txt backup/ and move it mv test.txt new.txt.
  5. Output a file's contents cat /etc/os-release and find a process ps aux | grep bash.
  6. Get help man cd and find a command whatis grep.

If all commands work without errors β€” you've mastered the basics!

Possible Issues

"Permission denied" Error

Cause: Insufficient permissions for the operation (e.g., writing to a system directory). Solution: Use sudo before the command (if you have administrator rights) or change to a directory where you have permissions (e.g., ~/).

sudo rm /etc/important.conf  # requires administrator password

"No such file or directory"

Cause: An incorrect path or filename was specified. Solution: Check the current directory (pwd) and file list (ls). Use absolute paths (/home/user/file) instead of relative ones.

"Command not found"

Cause: The command is not installed or there's a typo in the name. Solution: Check the spelling. Install the package via the package manager (e.g., sudo apt install package for Ubuntu/Debian).

Infinite Output in cat for Large Files

Cause: You're outputting a huge file (e.g., a binary or a multi-hundred MB log). Solution: Use less or limit the output (head, tail).

Unable to Terminate a Process

Cause: The process is ignoring the gentle SIGTERM signal. Solution: Use kill -9 PID (SIGKILL), but only if other methods fail β€” this is an emergency termination.

F.A.Q.

Which command is used to navigate to another directory?
How to view a file's contents without editing?
How to see which processes are currently running?
How to copy a file in Linux?

Hints

Navigating the filesystem
Managing files and directories
Viewing and editing files
Process management
Searching and filtering
Getting help
FixPedia

Free encyclopedia for fixing errors. Step-by-step guides for Windows, Linux, macOS and more.

Β© 2026 FixPedia. All materials are available for free.

Made with for the community