Linux Server Administration – Complete Notes (CIITM Dhanbad)
Source: Dev.to
UNIT – I : Linux Introduction, File System & Basic Commands
1. Introduction to Linux
- Linux is a free, open-source, secure and stable operating system.
- Based on UNIX, widely used in:
- Servers
- Cloud systems
- Networking
- Cybersecurity
- Development
- Known for:
- High security
- Fast performance
- Virus resistance
- Multi‑user environment
2. Basic Features of Linux
- Multiuser & multitasking
- Portable & open‑source
- Strong networking support
- Highly customizable
- Powerful shell & scripting
3. Flavors (Distributions) of Linux
Common Linux distros:
- Ubuntu
- Debian
- RedHat (RHEL)
- Fedora
- CentOS
- Kali Linux
- Linux Mint
4. Advantages of Linux
- Free & open source
- Highly stable
- Virus free
- Powerful command line
- Supports programming & servers
- Community support
5. How Linux Accesses Files
Linux uses an inode‑based file system, where every file has:
- inode number
- file type
- file permissions
- owner & group
- size
- storage location
Linux treats everything as a file, including:
- devices
- directories
- processes
- sockets
6. Linux Standard Directories
| Directory | Purpose |
|---|---|
/ | Root directory |
/home | User home directories |
/root | Root user home |
/bin | Basic user commands |
/sbin | System admin commands |
/etc | Configuration files |
/dev | Device files |
/var | Logs & variable data |
/usr | Installed software |
/tmp | Temporary files |
7. Basic File & Directory Commands
| Command | Description |
|---|---|
pwd | Show current directory |
cd | Change directory |
ls | List files |
cp | Copy files |
mv | Move / rename |
rm | Remove files |
mkdir | Create directory |
rmdir | Delete directory |
file | Show file type |
more, less | View long files |
8. Creating & Viewing Files using cat
cat > file.txt # create
cat file.txt # view
9. File Comparison Commands
cmp file1 file2– compare byte‑by‑bytecomm file1 file2– compare line‑by‑line
10. Disk Related Commands
df -h– show disk free spacedu -sh folder– folder sizemount– mount diskumount– unmount disk
UNIT – II : Shells, Processes, Pipes, Filters, Scheduling & VI Editor
1. Understanding Shells
A shell is a command interpreter. Popular shells:
- Bash (default)
- Zsh
- Ksh
- Tcsh
2. Processes in Linux
A process = program in execution. Common commands:
ps # show processes
top # live monitoring
kill PID # terminate
jobs # show background jobs
3. Connecting Processes with Pipes
ls | wc -l
Pipes send output of one command to input of another.
4. Input / Output Redirection
| Operator | Meaning |
|---|---|
> | output to file |
>> | append output |
2> | redirect error |
&> | output + error |
5. Help Commands
man commandhelp commandinfo command
6. Background Processing
command &
jobs
bg %1
fg %1
7. Managing Multiple Processes
pspgrephtopkill
8. Changing Process Priority
nice -n 10 program
renice 5 PID
9. Scheduling Commands
Using cron
crontab -e
Using at
at 5pm
10. File & Utility Commands
| Command | Description |
|---|---|
touch | create empty file |
wc | count lines/words/chars |
cut | extract columns |
dd | copy/convert data |
expr | math command |
bc | calculator tool |
11. VI / VIM Editor
Modes
- Command mode
- Insert mode
- Last‑line mode
Useful commands
i " insert
x " delete char
:w " save
:q " quit
:wq " save & quit
/text " search text
12. Simple Filter Commands
prheadtailcutpastesortuniqtr
13. Regular Expression Filters
grep– search patternsegrep– extended grepsed– search & replace
Example:
sed 's/old/new/g' file.txt
UNIT – III : Shell Programming & System Administration Basics
1. Introduction to Shell Programming
A shell script is a text file containing Linux commands.
Example:
#!/bin/bash
echo "Hello Linux"
Run:
chmod +x script.sh
./script.sh
2. Shell Programming Concepts
Variables
name="Abhishek"
echo $name
Conditions
if [ $a -gt 10 ]; then
echo "OK"
fi
Loops
for i in 1 2 3; do echo $i; done
Functions
hello(){ echo "Hello"; }
3. System Administration Tasks
- User management
- Disk management
- Network setup
- Package installation
- Backup & restore
- System monitoring
4. Configuration & Log Files
Logs are stored in:
/var/log/
Important files:
/etc/passwd/etc/shadow/etc/fstab/etc/hosts
5. Linux Installation Process
- Boot from USB/DVD
- Create partitions
- Install base system
- Install bootloader
- Reboot
6. System Startup / Shutdown
shutdown -h now
reboot
systemctl reboot
UNIT – IV : User Management, File System, Permissions & Networking
1. Managing User Accounts
Add user
useradd username
passwd username
Delete user
userdel username
2. Permissions & Ownership
Permission types
- Read (r)
- Write (w)
- Execute (x)
Change permissions
chmod 755 file
Change owner / group
chown user file
chgrp group file
3. Managing Groups
groupadd group
groupdel group
4. Disable User Account
usermod -L user
5. Creating & Mounting File System
mkfs.ext4 /dev/sdb1
mount /dev/sdb1 /mnt
6. Super User (su / sudo)
su
sudo command
7. Backup & Restore
cprsynctarscp
8. Installing & Removing Packages
Ubuntu/Debian
apt install package
apt remove package
RHEL/CentOS
yum install package
yum remove package