Linux Fundamentals
Since its inception in 1991 by Linus Torvalds as a product of the free software philosophy, Linux has become an indispensable choice for system administrators, developers, and network engineers due to its security, flexibility, and open-source nature. Today, the vast majority of modern server systems, embedded devices, mobile operating systems (e.g., Android), and cloud-based infrastructures run on the Linux kernel. This guide provides comprehensive content introducing the Linux ecosystem to both beginners and those who wish to systematically reinforce their fundamental knowledge.
1. History and Architecture of Linux
1) The Emergence of Linux
Linux is a UNIX-like operating system. Its POSIX-compliant structure, multitasking, multi-user capabilities, virtual memory management, and robust file system support make it ideal for professional system administration.
2) Linux Architecture
- Kernel space: Directly interacts with hardware. Memory management, I/O control, and system calls occur here.
- User space: Applications, services, terminal, and command-line operations run in this layer.
2. Comparison of Distributions
Linux distributions are optimized for different needs:
| Distribution | Key Features | Use Case |
|---|---|---|
| Debian | Stable, conservative updates | Servers, critical systems |
| Ubuntu | User-friendly, LTS versions | Desktop, education |
| CentOS/AlmaLinux | Red Hat compatible | Enterprise servers |
| Arch | Rolling release, customizable | Developer systems |
| Kali | Pre-loaded security tools | Pentesting, penetration tests |
3. Command Line Fundamentals
1) Bash and Shell Logic
Bash (Bourne Again Shell) is the widely used shell in Linux. Commands are executed by the interpreter. Automation can be achieved with shell scripts.
2) Basic Commands
pwd# shows current directorycd /etc# changes directoryls -la# detailed file listingtouch file.txt# creates an empty filerm -rf /tmp/*# file/directory deletion operation
4. File System and Hierarchy
Linux places the entire structure under a single root directory, /.
| Directory | Description |
|---|---|
/etc | Configuration files |
/home | User directories |
/var | Logs and temporary files |
/usr | Applications and libraries |
/bin, /sbin | System utilities |
File types:
- Regular file (
-) - Directory (
d) - Link (
l) - Character special device (
c) - Block special device (
b)
5. File and Text Processing
1) Text Viewing
cat,less,head,tail
2) Text Editing
nano: Simple terminal editorvim: Advanced, modal text editorsed: Stream editorawk: Data processing and reporting toolgrep "error" /var/log/syslogawk '{print $1, $3}' file.txtsed 's/old/new/g' file.txt
6. Package Management
Software installation in Linux is done via package managers.
| Package Manager | Distribution |
|---|---|
| APT (dpkg) | Debian/Ubuntu |
| DNF (yum) | Fedora/RHEL/CentOS |
| pacman | Arch |
sudo apt update && sudo apt install htopsudo dnf install nginx
7. User and Permission Management
1) User Operations
adduser ahmetpasswd ahmetusermod -aG sudo ahmet
2) Permission System (chmod, chown)
-rw-r--r-- 1 root root 1042 document.txtr: readw: writex: execute
chmod 755 script.shchown ahmet:ahmet document.txt
8. Process and Service Management
1) Process Monitoring
ps auxtop / htopkill -9 PID
2) Service Management with Systemd
systemctl status nginxsystemctl restart sshdsystemctl enable mariadb
9. Network Configuration and Tests
1) IP Configuration
ip anmcli d show
2) Network Test Commands
ping google.comtraceroute 8.8.8.8netstat -tulnpss -ltnnmap localhost
3) Firewall
ufw enableufw allow 22iptables -L
10. Practical Linux Exercises
Participants in the training are also taught the following practical topics:
- Backup automation by writing shell scripts
- Scheduled tasks with Cron
- Reading log files and dump analysis
- Installation of basic services: Apache, MySQL, OpenSSH
11. Scheduled Tasks: Automation with cron
In Linux systems, cron and crontab are used to run automated tasks at specific times. For example, if you want to run a backup command every day at 03:00:
crontab -e
You can add the following line:
0 3 * * * /home/user/backup.sh
Explanation:
0 3 * * *→ Every day at 03:00backup.sh→ Command or script
crontab -l # list existing tasks
With this system, you can clean logs, monitor disk space, and get periodic updates.
12. Log Management and Monitoring
Linux systems write events to log files. Through logs, you can analyze system errors, security breaches, and service statuses.
Common Log Files:
| File | Description |
|---|---|
/var/log/syslog | System messages (Debian/Ubuntu) |
/var/log/messages | General system logs (CentOS) |
/var/log/auth.log | Authentication attempts |
/var/log/nginx/ | Web server logs |
Commands;
tail -f /var/log/sysloggrep "Failed" /var/log/auth.logjournalctl -xe# systemd log viewer
Log analyses are critically important for system administration and security awareness.
13. Basic Backup Strategies
Backup is vital in every Linux system. Tools like rsync, tar, and scp can be used to copy data to local or remote servers.
Backup with rsync:
rsync -avh /home/user/ /mnt/backup_disk/
Archiving with tar:
tar -czvf backup.tar.gz /home/user/
Remote Backup with scp:
scp backup.tar.gz user@192.168.1.5:/backups/
Backup operations are typically scheduled via cron and reported along with logs.