What is Linux?

The operating system Linux is open-source and free. Though it is more popular among servers, developers, and computer aficionados, it is comparable to Windows or macOS. It was developed in 1991 by Linus Torvalds and is based on Unix.

Why Study Linux?

extensively utilized in development, cloud computing, servers, and cybersecurity. Linux powers the majority of supercomputers, Android systems, and web servers. Excellent for system administration and command-line learning.

Common Linux Distributions (Distros): Ubuntu is easy to use and suitable for novices. Fedora: advanced features. Debian is incredibly stable. Rocky Linux and CentOS are server-oriented. Kali Linux: for cybersecurity and ethical hacking.

Fundamental Linux Components Kernel: The OS’s central component. Shell: Command-interaction interface with the operating system.

File System: A hierarchical arrangement of folders and files. Terminal: A command-line interface for system management.

Basic Linux Commands

CommandDescription
pwdShow current directory/present working directory
lsList files and folders
cdChange directory
mkdirCreate a new directory/make a directory
rmdirRemove an empty directory
touchCreate a new empty file
rmRemove files or directories
cpCopy files or folders
mvMove or rename files
catShow file content
nano, vimText editors
clearClear the terminal screen
manShow manual for commands (e.g., man ls)
rm-rfRemove a content file/folder

Linux File System Structure

bashCopyEdit/      - Root directory
/home  - User home directories
/bin   - Essential binaries
/etc   - Configuration files
/var   - Logs and variable files
/usr   - User-installed software
/tmp   - Temporary files

File Permissions in Linux


file permissions control who can read, write, or execute a file or directory. Each file has three types of permissions for three categories of users.

Categories of Users
Owner (u) – The user who owns the file.

Group (g) – The group assigned to the file.

Others (o) – Everyone else.

Linux controls who can read, write, and execute files:

r = read
w = write
x = execute


Permission Format (ls -l)

Example:

bash
Copy
Edit
-rwxr-xr--  1 user group 1234 Jul 7  myfile.sh

- = Regular file (can be d for directory)
rwx = Owner has read, write, execute
r-x = Group has read, execute
r-- = Others have only read

Numeric (Octal) Notation

Each permission has a value:

Read (r) = 4
Write (w) = 2
Execute (x) = 1

Add them to get the total for each category:

Octal	Permissions	Meaning
7	rwx	Full permissions
6	rw-	Read & write
5	r-x	Read & execute
4	r--	Read only
0	---	No permissions

Use ls -l to check permissions:

Change permissions using:
  • chmod: Change permission
  • chown: Change ownership

Package Management

Install and manage software:

DistroToolExample
Ubuntu/Debianaptsudo apt install nginx
Fedora/RedHatdnfsudo dnf install nginx
Archpacmansudo pacman -S nginx