Fundamentals 30 min read

Linux Basics: All You Need in One Guide

This guide provides a concise overview of Linux fundamentals, covering the OS history, popular distributions, essential keyboard shortcuts, and a comprehensive set of commands for file, disk, network, and system management, each illustrated with syntax and practical examples.

Linux Tech Enthusiast
Linux Tech Enthusiast
Linux Tech Enthusiast
Linux Basics: All You Need in One Guide

Linux Overview

Linux (GNU/Linux) is a free, open‑source, Unix‑like operating system whose kernel was first released by Linus Torvalds on 5 October 1991. It follows POSIX, supports multi‑user, multitasking, multithreading and multi‑CPU environments, and runs on both 32‑bit and 64‑bit hardware. Common distributions include Ubuntu, RedHat, CentOS, Debian, Fedora, SuSE and OpenSUSE.

Common Keyboard Shortcuts

[Tab] – autocomplete commands, file names, directory names or option prefixes.

[Ctrl+C] – interrupt the current command or process.

[Ctrl+Z] – suspend a running program and send it to the background.

[Ctrl+A] – move the cursor to the beginning of the line.

[Ctrl+E] – move the cursor to the end of the line.

[Ctrl+U] – delete from the cursor position to the beginning of the line.

[Ctrl+K] – delete from the cursor position to the end of the line.

[Ctrl+W] – delete the word preceding the cursor.

[Ctrl+Y] – paste text that was removed by Ctrl+U, Ctrl+W or Ctrl+K.

[Ctrl+P] – view the previous command (similar to PgUp).

[Ctrl+N] – view the next command (similar to PgDn).

[Ctrl+R] – search command history.

[Ctrl+←/→] – move the cursor word by word.

[Alt‑d] – delete the word after the cursor.

Frequently Used Linux Commands

File Management

cat – concatenate and display files.

Syntax: cat [-nbs] [--help] [--version] fileName Parameters:

-n or --number – number all output lines starting from 1.

-b or --number-nonblank – number non‑blank lines only.

-s or --squeeze-blank – compress consecutive blank lines into a single blank line.

Examples:

cat -n textfile1 > textfile2
cat -b textfile1 textfile2 >> textfile3
cat /dev/null > /etc/test.txt

more – view files page by page.

Syntax: more [-dlfpcsu] [-num] [+/pattern] [+linenum] [fileNames…] Key options:

-num – number of lines per page.

-d – display a prompt.

-l – ignore ^L pauses.

-f – count actual lines.

-p – clear screen before each page.

-c – search pattern before displaying.

-s – squeeze consecutive blank lines.

-u – suppress the "more" prompt.

Examples:

more -s testfile
more +20 testfile

rm – delete files or directories.

Syntax: rm [options] name… Options:

-i – prompt before each removal.

-f – force removal without prompting.

-r – recursively delete directories.

Examples:

rm test.txt
rm -r homework
rm -r *

cp – copy files or directories.

Syntax: cp [options] source dest or cp [options] source… directory Important options:

-a – archive mode (preserves links, attributes, copies recursively).

-d – preserve links.

-f – overwrite without prompting.

-i – prompt before overwriting.

-p – preserve timestamps and permissions.

-r – copy directories recursively.

-l – create hard links instead of copying.

Example: cp -r test/ newtest read – read a line from standard input.

Syntax:

read [-ers] [-a aname] [-d delim] [-i text] [-n nchars] [-N nchars] [-p prompt] [-t timeout] [-u fd] [name …]

Key options:

-a – store input into an array.

-d – specify a delimiter (first character is used).

-p – display a prompt before reading.

-e – enable readline editing.

-n – limit input to N characters.

-r – disable backslash escaping.

-s – silent mode (no echo).

-t – timeout in seconds.

-u – read from the given file descriptor.

Disk Management

cd – change the current working directory.

Syntax: cd [dirName] Examples:

cd /usr/bin
cd ~
cd ../..

mkdir – create a new directory.

Syntax: mkdir [-p] dirName -p creates parent directories as needed.

Examples:

mkdir runoob
mkdir -p runoob2/test

pwd – print the absolute path of the current directory.

Syntax:

pwd [--help] [--version]
pwd

rmdir – remove an empty directory.

Syntax: rmdir [-p] dirName -p also removes parent directories if they become empty.

Examples:

rmdir AAA
rmdir -p BBB/Test

ls – list directory contents.

Syntax: ls [-alrtAFR] [name…] Key options:

-a – show all files including hidden ones.

-l – long format (permissions, owner, size, etc.).

-r – reverse order.

-t – sort by modification time.

-A – like -a but omit "." and "..".

-F – append indicator ("*" for executables, "/" for directories).

-R – recursive listing.

Examples:

ls /
ls -ltr s*
ls -lR /bin
ls -AF

Network Communication

telnet – remote login client.

Syntax:

telnet [-8acdEfFKLrx] [-b<alias>] [-e<escape>] [-k<realm>] [-l<user>] [-n<record>] [-S<service>] [-X<auth>] host [port]

Key options:

-8 – allow 8‑bit data.

-a – attempt automatic login.

-b – specify host alias.

-c – ignore .telnetrc.

-d – debug mode.

-e – set escape character.

-f – same as -F.

-F – use Kerberos V5 authentication.

-k – set Kerberos realm.

-l – specify login name.

-L – output 8‑bit data.

-r – rlogin‑style UI.

-x – enable encryption if supported.

-X – specify authentication type.

Example: telnet 192.168.1.2 ping – test host reachability using ICMP.

Syntax:

ping [-dfnqrRv] [-c<count>] [-i<interval>] [-I<interface>] [-l<preload>] [-p<pattern>] [-s<size>] [-t<ttl>] host

Key options:

-c – number of echo requests to send.

-i – interval between packets.

-I – specify network interface.

-l – preload packets.

-p – fill packet with pattern.

-s – packet size.

-t – TTL value.

-v – verbose output.

-q – quiet output.

Example output (truncated):

PING example.com (93.184.216.34) 56(84) bytes of data.
64 bytes from 93.184.216.34: icmp_seq=1 ttl=56 time=12.3 ms
--- example.com ping statistics ---
10 packets transmitted, 10 received, 0% packet loss, time 9012ms
rtt min/avg/max/mdev = 12.1/12.4/12.8/0.2 ms

ifconfig – display or configure network interfaces.

Syntax: ifconfig [interface] [options] Common options:

add – add an IPv6 address.

del – delete an IPv6 address.

down – deactivate the interface.

up – activate the interface.

-broadcast – set broadcast address.

-pointopoint – set point‑to‑point address.

-promisc – enable/disable promiscuous mode.

Example:

ifconfig

System Management

exit – exit the current shell.

Syntax:

exit [status]
exit

kill – send signals to processes.

Syntax: kill [-s signal] pid or kill -l Common signals: SIGTERM (15) – graceful termination, SIGKILL (9) – forceful termination.

# kill 12345
# kill -KILL 123456

ps – report process status.

Syntax: ps [options] [--help] Common options:

-A – list all processes.

-w – wide output.

-au – detailed user‑oriented view.

-aux – all processes including other users. # ps -ef | grep php sudo – execute a command as another user (usually root).

Typical usage examples:

sudo -V        # show version
sudo -l        # list privileges
sudo command   # run command as root

Key options:

-V – version.

-h – help.

-l – list privileges.

-v – validate timestamp.

-k – reset timestamp.

-b – run command in background.

-p – custom password prompt.

-u – run as specified user.

-s – run the shell specified by $SHELL.

-H – set HOME to target user's home directory.

su – switch user identity.

Syntax:

su [-fmp] [-c command] [-s shell] [--help] [--version] [-] [USER [ARG]]

Key options:

-f – fast mode (skip startup files).

-m / -p – preserve environment.

-c – run a command as USER then return.

-s – specify shell.

-l – login shell (reset environment, change directory).

Examples:

su -c ls root
su - clsung

free – display memory usage.

Syntax: free [-bkmotV] [-s interval] Options:

-b – display in bytes.

-k – display in kilobytes.

-m – display in megabytes.

-h – human‑readable units.

-s – update every interval seconds.

# free -h
              total        used        free      shared  buff/cache   available
Mem:           7.8G        5.2G        1.0G        0.0G        1.6G        2.3G
Swap:          0.5G        0.1G        0.4G

clear – clear the terminal screen.

Syntax:

clear
clear
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Linuxshellcommand-lineUnixSystem Administrationfile managementNetwork ToolsTerminal Shortcuts
Linux Tech Enthusiast
Written by

Linux Tech Enthusiast

Focused on sharing practical Linux technology content, covering Linux fundamentals, applications, tools, as well as databases, operating systems, network security, and other technical knowledge.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.