Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Linux commands are instructions you type into a terminal to navigate, inspect files, and make changes. Start by checking where you are with pwd, then use ls to inspect that location. This guide uses Ubuntu examples; most apply on other Linux distributions, but available options and behavior can vary.

What the terminal, shell, and command line mean

Ubuntu Documentation describes the command line as “a text interface to your computer.” The Ubuntu beginner tutorial uses “terminal” for the window or application where you type. The shell is the program that interprets your commands. People also use terms such as prompt, console, and command line, sometimes for different parts of the experience.

Open a terminal from your desktop environment; the exact way to do that depends on the distribution and desktop. The examples below use common Linux commands and Ubuntu’s references, not a promise that every option behaves identically everywhere.

First, learn where you are

The shell keeps a current working directory. When you provide a relative path such as notes.txt, file operations generally look for that name relative to the current directory. Check your location before creating, moving, or removing files.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • pwd prints the current working directory.
  • ls lists files and directories there. ls -a also shows hidden names beginning with a dot. ls -l displays a detailed listing, including information such as permissions, owner, size, and date.
  • cd <path> changes the current directory. cd .. goes to its parent; cd ~ goes to your home directory. In Ubuntu’s examples, entering cd with no path also returns home.

The path / is the root of Linux’s unified filesystem. It is not the same as your home directory. For more examples, see the Ubuntu command-line tutorial and its filesystem section.

Create, copy, move, and remove files

Once you know the current directory, these commands help you change its contents. You can use a path to specify a different location instead of relying on the current directory.

  • mkdir <name> creates a directory.
  • touch <file> creates an empty file if it does not exist, or updates the timestamp of an existing file.
  • cp <src> <dest> copies a file. Ubuntu’s reference shows cp -a for copying directories recursively while preserving permissions.
  • mv <src> <dest> moves a file or directory, or renames it when the destination is in the same location.
  • rm <file> removes a file. rm -r <dir> removes a directory and its contents recursively.

Unlike moving an item to a desktop trash folder, rm is a removal operation. Before using rm -r, check pwd and carefully read the target path; a mistaken location or spelling can remove the wrong files. Ubuntu’s filesystem guidance explains why the working directory matters.

Read files and search for information

Choose a viewing command based on how much of the file you need, and distinguish searching inside files from locating filenames.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • cat <file> prints the file’s contents; it is handy for short files.
  • less <file> lets you page through a longer file.
  • head -n 20 <file> prints the first 20 lines; tail -n 20 <file> prints the last 20.
  • grep <pattern> <file> finds lines matching a pattern within a file.
  • find <path> -name <pattern> searches under a path for names that match a pattern.

These are starter forms. Shell patterns, quoting, and regular expressions affect how a pattern is interpreted; learn those separately before using complex searches. The Ubuntu command reference describes these commands and examples.

Look up commands on your system

Use man <command> to open the local manual for a command—for example, man ls. It documents the version installed on your system, which is useful because options can differ between versions or distributions. Press q to leave the manual viewer in the usual setup.

GNU’s Coreutils manual identifies itself as version 9.11 and documents that project’s utilities. That is a versioned GNU reference, not a claim that every Linux system uses the same implementation.

Understand permissions and administrator access

chmod <mode> <file> changes a file’s permissions. sudo <command> runs a command with administrator privileges in Ubuntu’s command reference. These are different actions: one changes access permissions on a target; the other elevates the command being run.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Do not paste a privileged command from an unfamiliar source without understanding what it does and which files or settings it affects. Ubuntu’s beginner tutorial treats administrator powers as a topic that requires care; consult the administrator powers section before using them.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Combine commands with pipes and redirection

After you are comfortable running commands individually, operators can pass or save their output.

  • first-command | second-command sends the first command’s standard output to the second command’s standard input.
  • command > file writes output to a file, replacing its existing contents.
  • command >> file appends output to a file.
  • first-command && second-command runs the second command only if the first succeeds.

Redirection with > can overwrite data. Before running a composed command, identify the output destination and confirm whether it should replace or append to a file. Ubuntu’s command-chaining guide covers these operators.

A safe first-session routine

  1. Open a terminal and run pwd to see the current directory.
  2. Run ls to inspect its contents. Use ls -a if you need to see hidden names.
  3. Move to a location you recognize with cd <path>, or return to home with cd ~.
  4. Use mkdir practice to create a practice directory, then cd practice and run touch example.txt.
  5. Check the result with ls -l. Before trying any move or removal command, verify the current directory and the complete target path.

Ubuntu’s Linux command line for beginners tutorial assumes no prior knowledge and covers terminal access, file operations, useful commands, command chaining, and administrator powers. It is written for Ubuntu Desktop 26.04; Ubuntu says most of its content should work across Linux distributions, while some steps are Ubuntu-specific.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.