Skip to main content

Command Palette

Search for a command to run...

πŸš€ Day 5 of My DevSecOps Journey

Published
β€’3 min read
πŸš€ Day 5 of My DevSecOps Journey

CURL vs WGET, Process Priority, nohup, /proc, AWK, GREP & SED (Beginner-Friendly Guide)

Today was packed with extremely practical Linux concepts used daily in API testing, automation, monitoring, and log analysis.
Here’s a detailed breakdown of everything I learned, explained simply with clear examples and visuals πŸ‘‡


🌐 1️⃣ CURL vs WGETβ€” Understanding the Difference

Today I learned the real purpose of these two powerful commands:

🟦 wget

  • Download files from the internet

  • Simple and reliable

  • Great for grabbing large binaries, tar files, etc.

🟧 curl

  • Can download AND upload

  • Supports POST/PUT requests

  • Supports FTP/SFTP

  • Highly used in API testing

πŸ”€ Handling Redirect URLs

When using shortened links like bit.ly, they redirect to another site.

  • curl:

      curl -L <url>
    
  • wget:

      wget --max-redirect=10 <url>
    

πŸ“‘ API Testing with cURL

curl -X POST <url>

This allows interacting with APIs directly from Linux β€” extremely useful for DevOps/DevSecOps pipelines.


βš™οΈ 2️⃣ Process Priority, nohup & The /proc Directory

πŸ“Š Setting Process Priority

I learned how to control how much CPU a process should get:

nice -n 10 ./longjob.sh

Higher numbers = lower priority.


πŸ”„ nohup β€” Keep Processes Running Even After Logout

nohup ./script.sh &
  • Makes the process immune to disconnections

  • Perfect for long-running background tasks


πŸ“ Understanding /proc Directory

  • /proc contains virtual files representing system and process information.

  • Shows live data: memory, CPU usage, process status, etc.

  • Great for debugging & monitoring performance.


πŸ“ 3️⃣ Text Processing Tools β€” AWK, GREP & SED

These three tools are the backbone of log analysis and data filtering in Linux.


🟑 AWK β€” The Text Processing Powerhouse

AWK works with columns and delimiters.
Example text:

Max Rodriguez
  • Max β†’ Column 1 ($1)

  • Rodriguez β†’ Column 2 ($2)

πŸ“Œ Common AWK Commands

  • print $0 β†’ entire line

  • print $1 β†’ first word

  • print $2 β†’ second word

πŸ“ General Format

awk 'pattern { action }' file.txt

πŸ§ͺ Example

Print rows where the 4th column is greater than 5000:

awk '$4 > 5000 {print $1, $4}' 1.txt

πŸ”΅ GREP β€” Searching & Filtering Text

Grep helps find specific patterns in huge logs or datasets.

πŸ” Common Flags

  • -i β†’ ignore case

  • -v β†’ inverse match

  • -n β†’ show line numbers

  • -c β†’ count matches

  • -E β†’ extended regex

  • -r β†’ recursive search

  • -w β†’ exact word

πŸ“Œ Useful Patterns

  • ^A β†’ lines starting with β€œA”

  • New York$ β†’ lines ending with β€œNew York”

Perfect for filtering logs, API responses, and system messages.


πŸ”΄ SED β€” Stream Editor for Editing Text

SED helps modify files without opening them.

πŸ“„ Common Commands

1️⃣ Suppress output

sed -n

2️⃣ Print the 3rd line

sed -n '3p' 1.txt

3️⃣ Print lines 2 to 4

sed -n '2,4p' 1.txt

4️⃣ Append after a line

sed '3a\This is a new line' 1.txt

5️⃣ Insert before a line

sed '1i\This is a new line' 1.txt

SED becomes extremely useful during automation, CI/CD scripts, and configuration changes.


🎯 Day 5 Takeaway

Today strengthened my understanding of:
βœ”οΈ API testing using cURL
βœ”οΈ Priority management using nice
βœ”οΈ Persistent background processing with nohup
βœ”οΈ Understanding Linux internals via /proc
βœ”οΈ Text processing (AWK, GREP, SED) β€” crucial for handling logs and automation

Each day, the Linux foundation becomes clearer β€” helping me build the strong fundamentals needed for DevSecOps.

See you on Day 6! πŸš€

More from this blog

D

DevSecOps - Zero To Hero

19 posts