LinuxTeck - Linux Sysadmins Community - RHEL, CentOS, Ubuntu, Debian & Rocky Linux
92 subscribers
325 photos
2 videos
1 file
466 links
LinuxTeck is a high-quality tutorial site dedicated to beginners, system administrators, developers, and everyone interested in learning about Linux. https://www.linuxteck.com/
Download Telegram
Linux runlevels and systemd targets don't have to be confusing.

Learn:
β€’ Runlevel meanings (0–6)
β€’ Systemd target mapping
β€’ Multi-user vs graphical mode
β€’ Checking current target
β€’ Changing default boot mode

Read more:
https://www.linuxteck.com/systemd-targets-boot-modes-linux-explained/

#linuxteck #Linux #Systemd #RHEL #SysAdmin #DevOps #LinuxLearning
How do you systematically troubleshoot systemd service failures on Linux?
Post:
One of the biggest challenges for Linux admins is identifying why a systemd service fails to start. I put together a practical guide that covers a structured troubleshooting workflow using systemctl, journalctl, dependency analysis, permissions, exit codes, timeout issues, and automatic restart policies.
It also includes production-friendly examples and common mistakes to avoid.
Guide:
https://www.linuxteck.com/fix-systemd-service-errors-complete-guide/
Quick Linux Tip #1

Question:How do I change a string in all files at once?

Try:find . -type f -name '*.txt' -exec sed -i 's/old/new/g' {} +

Info:Use find with sed to search and replace text across multiple files efficiently. The -i flag edits files in place.

Examples:

$ find . -name '*.py' -exec sed -i 's/import os/import sys/g' {} +

$ grep -rl 'TODO' . | xargs sed -i 's/TODO/DONE/g'

$ find /var/www -name '*.php' -exec sed -i 's/old/new/g' {} +

Note:Always backup before bulk editing. Use grep -rl first to preview what will change.

Follow @LinuxTeck for more #LinuxTips
Quick Linux Tip #2

Question:How do I clean up old log files automatically?

Try:sudo find /var/log -name '*.log' -mtime +30 -delete

Info:Delete log files older than 30 days. The -mtime +30 finds files modified more than 30 days ago. Use sudo because /var/log files are owned by root.

Examples:
$ sudo find /var/log -name '*.log' -mtime +30 -delete
$ find ~/Downloads -type f -size +1G -delete
$ find /tmp -name '*.tmp' -mtime +7 -delete

Note:Use sudo for system directories. Use -ls first to preview what will be deleted. Deletion is permanent.

Follow @LinuxTeck for more #LinuxTips 
See less
Quick Linux Tip #3

Question:How do I backup files fast, only copying changes?

Try: rsync -avz --delete /source/ /destination/

Info: rsync only transfers changed files, making backups much faster. -a archive, -v verbose, -z compress.

Examples:

$ rsync -avz /home/user/ /mnt/backup/
$ rsync -avz --delete remote:/data/ /local/backup/
$ rsync -avz --exclude='*.tmp' /src/ /dst/

Note: Use --dry-run first. A trailing slash (/source/) copies contents; omitting it (/source) copies the folder itself.

Follow @LinuxTeck for more #LinuxTips
AI agents are transforming modern DevOps by automating Infrastructure as Code (IaC), deployments, monitoring, and self-healing workflows.

If you're curious how natural language can become working infrastructure, this guide walks through the complete process.

https://www.linuxteck.com/ai-agents-for-devops-automation-guide/

#linuxteck #DevOps #AI #Linux #Terraform
Quick Linux Tip #4

Question:How long does my script take and how much CPU does it use?

Try:time ./backup.sh

Info:time command shows execution time. real=wall clock, user=CPU for program, sys=CPU for system calls.

Examples:

$ time ./deploy.sh
$ /usr/bin/time -v ./process.py
$ time tar -czf backup.tar.gz /home/data

Note:Use /usr/bin/time -v for detailed resource usage including memory.

Follow @linuxteck for more #LinuxTips
Quick Linux Tip #5

Question:How do I schedule tasks to run automatically?

Try:crontab -e

Info:crontab -e opens editor for scheduled tasks. Format: minute hour day month weekday command.

Examples:
$ crontab -e
$ crontab -l
$ crontab -r

Note: Use journalctl -u cron to inspect active execution logs. Always use full path variables in your commands.

Follow @LinuxTeck for more #LinuxTips
Quick Linux Tip #6

Question: What files is a specific process using?

Try: lsof -p 3456

Info: lsof shows all files, sockets, and connections used by a process. Great for troubleshooting.

Examples:

$ lsof -p 3456
$ lsof -i :8080
$ lsof -u username

Note:Use -i for network connections. -i :PORT shows process using that port.

Follow @LinuxTeck for more #LinuxTips
Quick Linux Tip #7

Question: How do I speed up processing many files using all CPU cores?

Try: find /images -name '*.jpg' | parallel -j+0 'convert {} -resize 800x600 {}.resized'

Info: GNU parallel executes commands in parallel across all CPU cores. Dramatically speeds up batch processing of files, downloads, or any repeatable task.

Examples:

$ parallel -j 4 gzip ::: *.log
$ cat urls.txt | parallel -j 10 wget {}
$ find . -name '*.mp4' | parallel ffmpeg -i {} -vcodec h264 {.}.mp4

Note:Install: apt install parallel. -j+0 uses all cores, -j N uses N processes. ::: passes arguments directly. Perfect for CPU-intensive tasks.

Follow @LinuxTeck for more #LinuxTips
Quick Linux Tip #9

Question: How do I see all processes with their container and resource limits?

Try: systemd-cgls --unit=docker.service

Info: systemd-cgls shows the cgroup tree with all processes organized by their control groups. Perfect for understanding container isolation and resource allocation.

Examples:

$ systemd-cgls --unit=user.slice
$ systemd-cgtop # Real-time cgroup resource usage
$ cat /proc/1234/cgroup # Show cgroups for specific PID

Note: Understand container resource isolation. Combine with 'systemd-cgtop' for real-time CPU/memory per cgroup. Essential for container troubleshooting.

Follow @LinuxTeck for more #LinuxTips
Quick Linux Tip #10

Question: How do I capture only specific HTTP traffic to a specific host?

Try: sudo tcpdump -i eth0 -w capture.pcap 'host 192.168.1.100 and port 80 and tcp[13] & 2 != 0'

Info: tcpdump captures network packets with BPF filters. This example captures only SYN packets (TCP handshake start) to a specific host on port 80. Perfect for debugging network issues.

Examples:

$ sudo tcpdump -i any -n 'port 443 and host github.com'
$ sudo tcpdump -i eth0 -A 'tcp port 80' # Show ASCII payload
$ sudo tcpdump -r capture.pcap 'tcp[tcpflags] & (tcp-syn|tcp-ack) == tcp-syn'

Note: Use -w to save, -r to read pcap files. BPF filters: 'tcp[13] & 2' checks SYN flag. Open .pcap files in Wireshark for GUI analysis.

Follow @LinuxTeck for more #LinuxTips