Introduction to Linux and Basic Commands

1. Introduction to Linux

1.1 What is Linux?

Linux is a free and open-source Unix-like operating system kernel, first released by Linus Torvalds in 1991. When we refer to a “Linux system,” we mean an operating system distribution that is based on the Linux kernel and integrates various software and tools.

1.2 Common Linux Distributions:

Common distributions include Debian-based (such as Debian, Ubuntu, Mint), Red Hat-based (such as RHEL, CentOS, Fedora), as well as Arch Linux, SUSE Linux, and others.

1.3 Features of Linux:

Open-source and free, secure and stable, multi-user and multitasking, powerful command line, and the design philosophy of “everything is a file.”

2. Linux File System Structure

The Linux file system adopts a tree structure, with all files and directories starting from the root directory /.

Important directories and their functions:

/ – Root directory, the starting point for all paths.

/bin – Contains all basic commands available to users (such as ls, cp).

/sbin – Contains administrative commands for system administrators only (such as ifconfig).

/etc – Contains configuration files for the system and applications.

/home – Home directory for regular users.

/root – Home directory for the superuser (root).

/usr – Contains applications and files installed by users.

/var – Contains files that change frequently, such as logs (/var/log).

/tmp – Temporary file directory.

/dev – Directory for device files.

/boot – Contains files related to system boot (such as the kernel).

/proc – A virtual file system that contains kernel and process information.

3. Basic Shell Commands

The shell is a command-line interpreter that receives user input and passes it to the operating system kernel for execution. Bash is the most commonly used shell.

3.1 Directory Operation Commands:

ls: List directory contents.

Syntax: ls [options] [directory path]

Common options:

-l: Long format display, including permissions, owner, size, modification time, and other detailed information.

-a: Show all files, including hidden files that start with a dot.

-h: Human-readable file sizes (e.g., KB, MB, GB). Usually used with -l.

-t: Sort by modification time, with the newest first.

-R: Recursively list contents of subdirectories.

Leave a Comment