|$ curl https://forge-ai.dev/api/markdown?path=docs/linux
$cat docs/linux-—-getting-started.md
updated Recently·35 min read·published

Linux — Getting Started

LinuxOSBeginner to Intermediate🎯Free Tools
Introduction

Linux powers the vast majority of servers, cloud infrastructure, embedded devices, and developer workstations. Whether you are deploying a Next.js app to a VPS, debugging a Docker container, or automating workflows with shell scripts, Linux fluency is a core engineering skill.

This section covers the topics that working developers actually need: navigating the terminal, understanding the filesystem, managing permissions, installing software, controlling processes, configuring networks, writing Bash scripts, editing files in vim, and connecting to remote machines over SSH.

What Is Linux?

Linux is technically a kernel — the piece of software that manages hardware, processes, memory, and device drivers. A complete operating system built around the Linux kernel is called a distribution (or distro). Distributions bundle the kernel with a package manager, system utilities, libraries, and often a desktop environment.

DistributionPackage ManagerBest For
Ubuntuapt / snapBeginners, cloud, WSL
DebianaptStable servers
FedoradnfModern desktop, containers
Arch LinuxpacmanPower users, rolling release
AlpineapkContainers, minimal images
RHEL / Rockydnf / yumEnterprise servers

info

If you are on Windows, WSL gives you a full Linux environment without leaving Windows. If you are on macOS, the terminal behaves almost identically to Linux for most developer tasks because both are Unix-like.
Terminal Basics

The terminal is a text-based interface to the operating system. You type commands, the shell interprets them, and the kernel executes them. The default shell on most Linux systems is bash, though zsh and fish are also popular.

terminal-basics.sh
Bash
1# Print the current user and working directory
2whoami
3pwd
4
5# List files and directories
6ls -la
7
8# Change directory
9cd /var/log
10
11# Run a command with superuser privileges
12sudo apt update
CommandWhat It Does
pwdPrint working directory
lsList directory contents
cdChange directory
mkdirCreate a directory
cpCopy files or directories
mvMove or rename files
rmRemove files or directories
catPrint file contents
lessView file contents interactively
manShow manual page for a command
File System Hierarchy

Linux organizes files in a single hierarchical tree starting at the root directory /. The Filesystem Hierarchy Standard (FHS) defines the purpose of the top-level directories.

fhs-tree.txt
TEXT
1/
2├── bin # Essential user binaries (ls, cp, mv)
3├── boot # Boot loader files and kernel
4├── dev # Device files (disks, terminals, etc.)
5├── etc # System-wide configuration files
6├── home # User home directories
7├── lib # Shared libraries and kernel modules
8├── media # Mount points for removable media
9├── mnt # Temporary mount points
10├── opt # Optional third-party software
11├── proc # Virtual filesystem for process/kernel info
12├── root # Home directory for the root user
13├── run # Runtime variable data
14├── sbin # System administration binaries
15├── srv # Service data
16├── sys # Virtual filesystem for system info
17├── tmp # Temporary files
18├── usr # User programs, libraries, docs
19└── var # Variable data: logs, caches, mail

best practice

User data belongs in /home. System configuration belongs in /etc. Logs live in /var/log. Temporary files go in /tmp and are usually cleared on reboot.
Users, Groups & Permissions

Linux is a multi-user system. Every file and process is owned by a user and a group. Permissions are expressed as read (r), write (w), and execute (x) for the owner, group, and others.

permissions.sh
Bash
1# View detailed file listing with permissions
2ls -l /etc/passwd
3# -rw-r--r-- 1 root root 2875 Jan 12 08:30 /etc/passwd
4
5# Change file permissions
6chmod 755 script.sh
7chmod u+x script.sh
8
9# Change file owner and group
10sudo chown alice:developers project/
11
12# Add a user to a group
13sudo usermod -aG docker $USER
NumericSymbolicMeaning
700rwx------Owner only
755rwxr-xr-xOwner full, others read/execute
644rw-r--r--Owner read/write, others read
600rw-------Owner read/write only
Package Management

Package managers install, update, and remove software while handling dependencies. The commands differ by distribution, but the concepts are the same.

package-managers.sh
Bash
1# Debian / Ubuntu
2sudo apt update # Update package index
3sudo apt upgrade # Upgrade installed packages
4sudo apt install nginx # Install a package
5sudo apt remove nginx # Remove a package
6
7# Fedora / RHEL / Rocky
8sudo dnf update
9sudo dnf install nginx
10sudo dnf remove nginx
11
12# Arch Linux
13sudo pacman -Syu # Update system
14sudo pacman -S nginx # Install
15sudo pacman -R nginx # Remove
16
17# Alpine (common in containers)
18apk add nginx
19apk del nginx
Processes & Services

Every running program on Linux is a process. The init system (usually systemd) manages background services that start automatically and keep running.

processes.sh
Bash
1# List running processes
2ps aux
3
4# Interactive process viewer
5htop
6
7# Start, stop, and inspect services
8sudo systemctl status ssh
9sudo systemctl start ssh
10sudo systemctl enable ssh # Start on boot
11sudo systemctl restart nginx
12
13# Send signals to processes
14kill -TERM 1234 # Graceful stop
15kill -9 1234 # Force kill
16pkill node # Kill by process name
Next Steps

Now that you understand the fundamentals, dive deeper into each topic: