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:

DistributionKey FeaturesUse Case
DebianStable, conservative updatesServers, critical systems
UbuntuUser-friendly, LTS versionsDesktop, education
CentOS/AlmaLinuxRed Hat compatibleEnterprise servers
ArchRolling release, customizableDeveloper systems
KaliPre-loaded security toolsPentesting, 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 directory
  • cd /etc # changes directory
  • ls -la # detailed file listing
  • touch file.txt # creates an empty file
  • rm -rf /tmp/* # file/directory deletion operation

4. File System and Hierarchy

Linux places the entire structure under a single root directory, /.

DirectoryDescription
/etcConfiguration files
/homeUser directories
/varLogs and temporary files
/usrApplications and libraries
/bin, /sbinSystem 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 editor
  • vim: Advanced, modal text editor
  • sed: Stream editor
  • awk: Data processing and reporting tool
  • grep "error" /var/log/syslog
  • awk '{print $1, $3}' file.txt
  • sed 's/old/new/g' file.txt

6. Package Management

Software installation in Linux is done via package managers.

Package ManagerDistribution
APT (dpkg)Debian/Ubuntu
DNF (yum)Fedora/RHEL/CentOS
pacmanArch
  • sudo apt update && sudo apt install htop
  • sudo dnf install nginx

7. User and Permission Management

1) User Operations

  • adduser ahmet
  • passwd ahmet
  • usermod -aG sudo ahmet

2) Permission System (chmod, chown)

  • -rw-r--r-- 1 root root 1042 document.txt
    • r: read
    • w: write
    • x: execute
  • chmod 755 script.sh
  • chown ahmet:ahmet document.txt

8. Process and Service Management

1) Process Monitoring

  • ps aux
  • top / htop
  • kill -9 PID

2) Service Management with Systemd

  • systemctl status nginx
  • systemctl restart sshd
  • systemctl enable mariadb

9. Network Configuration and Tests

1) IP Configuration

  • ip a
  • nmcli d show

2) Network Test Commands

  • ping google.com
  • traceroute 8.8.8.8
  • netstat -tulnp
  • ss -ltn
  • nmap localhost

3) Firewall

  • ufw enable
  • ufw allow 22
  • iptables -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:00
  • backup.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:

FileDescription
/var/log/syslogSystem messages (Debian/Ubuntu)
/var/log/messagesGeneral system logs (CentOS)
/var/log/auth.logAuthentication attempts
/var/log/nginx/Web server logs

Commands;

  • tail -f /var/log/syslog
  • grep "Failed" /var/log/auth.log
  • journalctl -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.