Skip to content

Latest commit

 

History

History
385 lines (265 loc) · 3.39 KB

File metadata and controls

385 lines (265 loc) · 3.39 KB

---Linux for devOps maintain---

Linux for DevOps Engineers 🐧

This guide covers essential Linux commands for DevOps, including file management, permissions, networking, process control, logs, and automation. Useful for CI/CD, Cloud, Containers, and Production servers.


📁 File & Directory Management

pwd
ls
ls -la
cd /path
mkdir project
rm file.txt
rm -rf folder
cp file1 file2
mv old new
touch file.txt

📄 File Viewing Commands

cat file.txt
less file.txt
more file.txt
head file.txt
tail file.txt
tail -f app.log

🔍 Search Commands (Very Important)

Find file

find / -name file.txt

Search inside file

grep "error" file.txt

Search recursively

grep -r "error" .

Search running process

ps aux | grep nginx

🔐 Permissions & Ownership

Check permissions

ls -l

Change permission

chmod 777 file.txt
chmod +x script.sh

Change ownership

chown user:user file.txt

⚙️ Process Management

Show running processes

ps aux

Real time process monitor

top

Kill process

kill PID
kill -9 PID

Find process

pgrep nginx

🌐 Networking Commands

Check IP

ip a

Ping server

ping google.com

Check open ports

netstat -tulnp

Check port usage

lsof -i :8080

Test API

curl http://localhost:3000

Download file

wget https://example.com/file.zip

📦 Package Management

Ubuntu / Debian

apt update
apt upgrade
apt install nginx

CentOS / RHEL

yum install nginx

📊 Disk & Memory Monitoring

Check disk

df -h

Check folder size

du -sh *

Check memory

free -m

📜 Logs (DevOps Most Important)

System logs

/var/log/syslog

View logs

tail -f /var/log/syslog

Docker logs

docker logs container

Nginx logs

/var/log/nginx/access.log

👤 User Management

Create user

useradd devops

Switch user

su devops

Sudo command

sudo apt update

🔄 Service Management (Systemctl)

Start service

systemctl start nginx

Stop service

systemctl stop nginx

Restart service

systemctl restart nginx

Check status

systemctl status nginx

Enable on boot

systemctl enable nginx

📦 Archive & Compression

Zip

zip file.zip file.txt

Unzip

unzip file.zip

Tar

tar -cvf file.tar folder

Extract

tar -xvf file.tar

⚡ DevOps Automation Commands

Environment variables

export ENV=production
echo $ENV

Run script

bash deploy.sh

Make executable

chmod +x deploy.sh
./deploy.sh

⭐ Most Important Linux Commands for DevOps

ls
cd
pwd
chmod
chown
grep
find
top
kill
ps
df -h
du -sh
free -m
curl
wget
systemctl
tail -f

🧠 DevOps Use Cases

  • Server deployment
  • CI/CD pipelines
  • Log monitoring
  • Docker & Kubernetes management
  • Cloud instance setup
  • Automation scripts
  • Production debugging

🚀 DevOps Linux Workflow

Connect to Server (SSH)
        ↓
Pull Code (Git)
        ↓
Install Dependencies
        ↓
Build Application
        ↓
Restart Service
        ↓
Monitor Logs