Linux Tutorial

This Linux tutorial covers the command line, files and directories, permissions, archives, users, and other everyday Linux operations. It is organized so that beginners can start with terminal navigation and then move to file management and system administration tasks.

Linux commands are generally entered in a terminal. Most commands follow a simple pattern: a command name, optional options, and optional arguments such as a file or directory name.

</>
Copy
command [options] [arguments]

For example, ls -l /home runs the ls command with the -l option and /home as its argument.

Linux Command Line Basics for Beginners

The Linux command line is a text interface for interacting with the operating system. A shell reads the commands entered in a terminal and starts the requested programs. Bash is one commonly used shell on Linux systems.

A useful first set of commands includes pwd for finding the current directory, ls for viewing directory contents, and cd for moving between directories.

</>
Copy
pwd
ls
cd /tmp
pwd

Linux commands and file names are generally case-sensitive. For example, Documents and documents can refer to two different names.

Linux Terminal Basics

These terminal topics cover the shell prompt and other basic command-line interactions.

  • Linux – Change prompt that appears in terminal

Linux Directory Structure and Paths

Linux organizes files in a single directory tree beginning at the root directory, written as /. An absolute path starts from /, while a relative path is interpreted from the current working directory.

PathMeaning
/Root of the Linux file system
.Current directory
..Parent directory
~Current user’s home directory in shell expansion
/tmpCommon location for temporary files

You can use pwd to confirm your current location before copying, moving, or deleting files.

Linux File System Commands

Linux Directory Commands

  • Linux – Create directory
  • Linux – Copy directory – cp -r
  • Linux – Rename directory – mv
  • Linux – Remove empty directory – rmdir
  • Linux – Remove directory recursively – rm -r
  • Linux – Print current working directory – pwd

Linux File Commands

  • Linux – Create file
  • Linux – Create empty file – touch
  • Linux – Copy file – cp
  • Linux – Rename file – mv
  • Linux – Remove file – rm
  • Linux – Change file permission – chmod

Linux File System Utilities

Linux Commands for Creating, Copying, Moving, and Removing Files

Several Linux file-management commands are used repeatedly. touch can create an empty file, cp copies files, mv moves or renames them, and rm removes them.

</>
Copy
touch notes.txt
cp notes.txt notes-copy.txt
mv notes-copy.txt archive.txt
rm archive.txt

Commands that remove files or directories should be used carefully. Unlike moving a file to a desktop trash folder, command-line deletion with rm normally removes the named file directly.

Linux ls Command for Listing Files and Directories

The ls command lists directory contents. With no path, it lists the current directory. You can provide another path to inspect a different directory.

</>
Copy
ls
ls /tmp
ls /
ls -l

The -l option requests a long listing that includes information such as permissions, ownership, size, and modification time.

Linux ls Command Tutorials

  • List the files and directories inside current directory
  • List the files and directories inside specific directory
  • List the files and directories inside root directory

Linux File Permissions with chmod

Linux permissions determine who can read, write, or execute a file or directory. The three basic permission letters are r for read, w for write, and x for execute.

The chmod command changes permissions. For example, the following command adds execute permission for the file owner:

</>
Copy
chmod u+x script.sh

Before changing permissions, use ls -l to inspect the current permission bits and make sure you are modifying the intended file.

Linux tar, zip, and unzip Commands for Archives

Archive tools are used to collect files together and, depending on the format and options, compress them. tar is commonly used for tar archives, while zip creates ZIP archives and unzip extracts or inspects ZIP files.

Linux Archive and ZIP File Tutorials

tar commands

  • Create a tar archive from files or directories
  • List files stored in a tar archive
  • Extract files from a tar archive

zip commands

  • Create a ZIP archive from one or more files
  • Add directories recursively to a ZIP archive
  • List or verify files intended for a ZIP archive

unzip commands

  • Extract files from a ZIP archive
  • List files in a ZIP archive without extracting them
  • Extract an archive into a specific directory

For example, these commands demonstrate basic tar archive creation, listing, and extraction:

</>
Copy
tar -cf files.tar documents/
tar -tf files.tar
tar -xf files.tar

Linux User Accounts and User Management Commands

Linux is a multi-user operating system. Files and processes can be associated with users and groups, and permissions control what those accounts may access.

The whoami command prints the effective user name for the current shell, while id reports user and group identifiers.

</>
Copy
whoami
id

Linux User Management Tutorials

  • Linux – Create User
  • Linux – Change User Name
  • Linux – Change Password
  • Linux – Change User Permissions
  • Linux – Delete User

Linux Date, Calendar, User, and Directory Commands

The following tutorials cover several small but useful Linux commands for checking the date, displaying a calendar, identifying the current user, and changing directories.

Linux Command Help with man and –help

You do not need to memorize every command option. Linux systems commonly provide manual pages that can be opened with man, and many commands support a --help option.

</>
Copy
man ls
ls --help

The exact options available depend on the command and the software installed on the system. Checking the command’s own documentation is useful when an option is unfamiliar.

Linux Command Options, Arguments, and Shell Expansion

A Linux command can include short options such as -l, long options such as --help, and arguments such as file names. The shell may also process characters such as *, ~, variables, and quotes before starting a command.

</>
Copy
ls -l *.txt
echo "$HOME"

Quoting matters when a file name or variable value contains spaces or shell-special characters. For example, cat "My Notes.txt" treats the text inside the quotes as one file name.

Linux Standard Input, Output, and Redirection

Linux command-line programs commonly read standard input and write standard output. The shell can redirect output to files or connect the output of one command to the input of another.

</>
Copy
echo "Linux notes" > notes.txt
cat notes.txt
printf "one\ntwo\n" | wc -l

The > operator writes standard output to a file and normally replaces the previous contents. The pipe operator | connects the standard output of the command on its left to the standard input of the command on its right.

Linux sudo and Administrative Commands

Some Linux operations require administrative privileges. On systems configured for it, sudo can run an authorized command with elevated privileges.

Do not add sudo automatically to a command that fails. First determine why the command failed and whether administrative access is actually required. Commands run with elevated privileges can modify system-wide files and settings.

A Practical Order for Learning Linux Commands

  1. Learn where you are with pwd and inspect directories with ls.
  2. Practice moving between directories with cd and understand absolute and relative paths.
  3. Create test files and directories with touch and mkdir.
  4. Practice copying and moving with cp and mv.
  5. Learn deletion commands such as rm and rmdir in a temporary practice directory.
  6. Inspect and modify file permissions after understanding owners, groups, and read/write/execute permissions.
  7. Learn archive commands such as tar, zip, and unzip.
  8. Use man and --help to learn additional command options as needed.

Linux Practice Commands for Beginners

A temporary directory provides a simple place to practice common commands without working on important files.

</>
Copy
mkdir linux-practice
cd linux-practice
pwd
touch file1.txt
mkdir documents
cp file1.txt documents/file2.txt
ls -l
ls -l documents

After running each command, inspect the directory with ls so that the effect of the command is visible. This makes it easier to learn what each operation changes.

Linux Tutorial Editorial QA Checklist

  • Verify that Linux command examples distinguish commands, options, and path arguments correctly.
  • Check that examples involving rm or recursive directory deletion do not imply that deleted files are automatically recoverable from a desktop trash folder.
  • Confirm that absolute paths, relative paths, ., .., and ~ are described with their correct shell and file-system meanings.
  • Verify that permission examples correctly distinguish read, write, and execute permissions.
  • Check that tar, zip, and unzip are not described as interchangeable commands or archive formats.
  • Confirm that whoami and id descriptions match the information those commands report.
  • Verify that newly added terminal examples use Bash-compatible syntax and the language-bash PrismJS class.
  • Check that shell redirection examples distinguish > from the pipe operator |.
  • Confirm that administrative-command guidance does not recommend adding sudo indiscriminately.
  • Review each existing Linux tutorial link to ensure its original URL remains unchanged.

Linux Tutorial Learning Path

Start with terminal navigation and Linux paths, then practice creating and managing files and directories. After those basics are familiar, continue with permissions, archives, user-related commands, redirection, and administrative tasks. Use the individual Linux tutorials above when you need a focused example for a specific command or operation.