#️⃣ 1️⃣ Get Intimate with Your Shell 🐧 0️⃣ If you're doing any serious scripting, there’s a hard truth you need to accept: you can't just copy-paste your way through forever. You need to intimately know your shell. 🐚 1️⃣ I see a lot of engineers dive into writing automation without checking what environment they're actually executing in. 2️⃣ Is it bash ❓ ➡️ Probably. It’s the undisputed workhorse of the Linux world. But if you’re doing local dev on a modern Mac, you’re likely dropping into zsh. And if you're working with lightweight Docker containers (like Alpine) or legacy systems, you might find yourself face-to-face with sh—the direct lineage of the ancient, original Thompson shell. ⁉️ Why does this matter ❔ Because portability is everything. ➡️ What works effortlessly in bash (like arrays or specific parameter expansions) will often blow up your script in sh. If you're writing automation for CI/CD pipelines, cron jobs, or container entrypoints, assuming you have bash when you only have a barebones sh is a guaranteed recipe for a failed build. 3️⃣ Take the time to understand the nuances: 👉 Check your shebangs (#!/bin/bash vs #!/bin/sh). 👉 Know when to write strict, POSIX-compliant code for maximum portability across environments. 👉 Know when it’s safe to lean into the rich, modern features of zsh or bash. 4️⃣ Mastering your shell doesn't just make you a faster typist; it makes your scripts vastly more robust, your pipelines more reliable, and your debugging sessions a lot shorter. ⁉️ What’s your daily driver ❔ Are you team Bash, Zsh, or do you prefer something entirely different like Fish? ‼️ Let me know below. 👇 #Linux #DevOps #ShellScripting #Bash #Zsh #Automation #SoftwareEngineering #TechTips
Mastering Shell Scripting for Portability
More Relevant Posts
-
𝐇𝐞𝐲 𝐞𝐯𝐞𝐫𝐲𝐨𝐧𝐞! 👋 After thoroughly covering the Linux essentials over the last few months, I’ve been diving deep into the world of Bash Scripting. I recently revisited a Git repository I started a while back. While it initially only housed basic commands, I’ve shifted my focus to building functional automation scripts. 𝐓𝐡𝐢𝐬 𝐰𝐞𝐞𝐤’𝐬 𝐡𝐢𝐠𝐡𝐥𝐢𝐠𝐡𝐭: 𝐀 𝐃𝐢𝐬𝐤 𝐂𝐡𝐞𝐜𝐤𝐮𝐩 𝐀𝐮𝐭𝐨𝐦𝐚𝐭𝐢𝐨𝐧 𝐒𝐜𝐫𝐢𝐩𝐭. It monitors disk space and alerts when thresholds are met. While writing it, I realized that running a commands is only half the battle—the real magic lies in Command Chaining and Output Manipulation. 💡 𝙆𝙚𝙮 𝙏𝙖𝙠𝙚𝙖𝙬𝙖𝙮 If you want to master Bash, you have to master text manipulation. Tools like sed, grep, awk, and cut are essential. They allow you to take raw system data and mold it into exactly what your script needs to make a decision. 📢 𝐒𝐭𝐚𝐫𝐭𝐢𝐧𝐠 𝐚 𝐍𝐞𝐰 𝐒𝐞𝐫𝐢𝐞𝐬 𝐨𝐧 𝐃𝐞𝐯.𝐭𝐨! I’m excited to announce that I’m starting a series on Dev.to! I’ll be sharing: * Detailed insights into the scripts I’m writing. * The logic behind the automation. * Resources I’m using to learn. * Regular updates to my GitHub repository. If you’re also on your Bash journey or looking to dive into DevOps, let's connect! Check out my first few updates and let’s automate the world together. 🚀 Dev.to : https://lnkd.in/gKvsaKUZ Github: https://lnkd.in/dhfKuw9s #Linux #BashScripting #DevOps #Automation #LearningJourney #DevTo #OpenSource #TechCommunity
To view or add a comment, sign in
-
-
Day 17 of learning and practicing DevOps 🔁 Today I Practiced more on my shell scripting skills Worked on: • Writing for and while loops • Using command-line arguments like $1, $@, $# • Automating package installation using scripts • Adding basic error handling with set -e and || Important part: Building a script that checks and installs packages automatically — this felt like something actually used in real setups. Also made a small mistake in my script ($pkg vs $pkgs) — fixed it and learned. learning today --> It’s about making things reliable, reusable, and error-safe. Here are my notes: https://lnkd.in/gP8KEVcE 📍 #DevOps #Linux #ShellScripting #Automation #LearningInPublic #90DaysOfDevOps #TrainWithShubham
To view or add a comment, sign in
-
Day 18 of learning and practicing DevOps 🔁 Today I focused on writing clean and reusable shell scripts. Worked on: • Writing functions to organize code • Using set -euo pipefail for safer scripts • Understanding local vs global variables • Building a system info script using multiple functions Important part: Learning strict mode — scripts should fail fast instead of silently breaking. This is actually a best practice in production scripting (OneUptime). learning today == good scripts are not just working scripts. They should be clean, reusable, and safe from hidden errors. Here are my notes: https://lnkd.in/gesnUbVx 📍 #DevOps #Linux #ShellScripting #Automation #LearningInPublic #90DaysOfDevOps #TrainWithShubham
To view or add a comment, sign in
-
🚀 Getting Started with Command Line (CLI) – A Beginner’s Guide (with Examples) Today, I explored the fundamentals of the Command Line Interface (CLI) — a powerful way to interact with systems using simple text-based commands. 💻 Key Concepts I Learned: 🔹 User Interfaces GUI (Graphical User Interface) – Visual interaction CLI (Command Line Interface) – Text-based control with powerful commands 🔹 Shell & Terminal Shell acts as a command interpreter Terminal is where we execute commands Popular shells: bash, zsh, sh, ksh 🔹 Essential Commands (with examples) ls → List files & directories 👉 Example: ls whoami → Shows current user 👉 Example: whoami history → Displays command history 👉 Example: history clear → Clears terminal 👉 Example: clear alias → Create shortcut 👉 Example: alias cls='clear' unalias → Remove shortcut 👉 Example: unalias cls exit → Close terminal 👉 Example: exit 📂 Working with Files (with examples) touch → Create a file 👉 Example: touch practice.txt cat → View file content 👉 Example: cat practice.txt echo → Print or write text 👉 Example: echo "Hello World" 👉 Write to file: echo "Hello World" > practice.txt mv → Rename or move file 👉 Example: mv practice.txt exam.txt cp → Copy file 👉 Example: cp exam.txt backup.txt rm → Delete file 👉 Example: rm exam.txt ls -a → Show hidden files 👉 Example: ls -a ✨ Why CLI? Faster than GUI More control over system Essential for developers, DevOps & system admins This is just the beginning of my journey into the command line world. Excited to explore more! 🔥 NxtWave #CommandLine #Linux #Bash #Programming #LearningJourney #TechSkills #Developers#FullstackDevelopement
To view or add a comment, sign in
-
-
Building backend skill is not only about learning frameworks or writing more code. It is about developing a mindset that connects technical work to reliable delivery. ⚙️ A backend mindset means thinking beyond implementation: • How does the system behave under real input? • What happens when something fails? • Is the logic easy to reason about? • Can the service be maintained, tested, and evolved? • Can we deliver changes with confidence? That is the shift from simply “building a service” to building something stable enough to support real use. Strong backend engineering is a combination of: ✅ structure ✅ system thinking ✅ predictability ✅ operational awareness The code matters. But the mindset behind it is what creates long-term engineering value. 🚀 #SoftwareEngineering #BackendDevelopment #SystemDesign #SpringBoot #Linux
To view or add a comment, sign in
-
-
🚀 Most Used Linux Commands Every Developer Should Know If you’re working in backend, DevOps, or AI… Linux isn’t optional. It’s your daily toolkit. Here’s a quick breakdown of the commands that actually matter 👇 📂 File Handling Navigate and manage files like a pro → ls, cd, pwd, mkdir, rm 📖 File Viewing Read logs and files efficiently → cat, less, head, tail 🔍 Text Processing (Game Changer) Find and manipulate data fast → grep, awk, sort, find ⚙️ Process Management Control running applications → ps, top, kill, pkill 🌐 Networking Debug APIs & connect to servers → curl, ping, ssh, scp 💾 System Monitoring Know what’s happening inside your machine → df, du, free, uname 📦 Package Management Install tools in seconds → apt, dnf, yum 🔐 Permissions Control access and security → chmod, chown 🧰 Pro Tip: Don’t try to memorize everything. Think in actions: ◾ Search → grep ◾ Navigate → cd ◾ Debug → top Master these, and you can handle 90% of real-world tasks in Linux. 🔥 Reality check: 90% of dev work = just ~10 commands used daily. 💬 Which Linux command do you use the most? 🎯 Follow Virat Radadiya 🟢 for more..... #Linux #DevOps #BackendDevelopment #SoftwareEngineering #Programming #Developers #Coding #CloudComputing #TechSkills #LearnToCode
To view or add a comment, sign in
-
-
The day I stopped being scared of the terminal was the day my career actually started. For months I was a developer who used Linux the same way a tourist uses a foreign country. Nervous. Copying phrases from a phrasebook. Hoping nobody asked me anything complicated. sudo apt-get install — copied from chatgpt. chmod 777 — copied from chatgpt. kill -9 — copied from chatgpt and honestly had no idea what the 9 meant. I was not using Linux. I was surviving it. Then one evening I made a rule for myself. No GUI tools for one week. Everything through the terminal only. Day 1 — I spent 20 minutes figuring out how to rename a file. Day 2 — I accidentally overwrote something important and learned what backups are for. Day 3 — I discovered man pages and realized the documentation was right there the whole time. Day 4 — I wrote my first shell script. 8 lines. It automated something that was taking me 5 manual steps every single day. Day 5 — The terminal started feeling like home. By day 7 I was faster in the terminal than I had ever been with a GUI. Not because I was smart. Because I had stopped being afraid of making mistakes in it. Here is what nobody told me about Linux: The terminal does not punish curiosity. It rewards it. Every weird command you try teaches you something. Every error message is actually documentation. Every mistake is recoverable — almost always. Right now learning DevOps — Docker, CI/CD, pipelines — Linux is underneath every single thing. It is not optional. It is the foundation everything else is built on. You cannot build on a foundation you are afraid to touch. #Linux #DevOps #Terminal #LearningInPublic #JuniorDeveloper #SoftwareEngineering #TechCommunity #CodingJourney
To view or add a comment, sign in
-
-
🚀 Day 7/100 – Shell Scripting Basics Tired of running the same commands again and again? 😅 👉 That’s exactly why Shell Scripting exists. 🔍 What is Shell Scripting? Shell scripting is writing a series of Linux commands in a file that can be executed automatically. 👉 Instead of doing tasks manually, you automate them with scripts ⚡ ⚙️ Basic Example #!/bin/bash echo "Starting deployment..." git pull origin main docker build -t my-app . docker run -d -p 80:80 my-app echo "Deployment complete 🚀" 👉 Save → Run → Done ✅ 💡 Why Shell Scripting is Important in DevOps ✅ Automate repetitive tasks ✅ Reduce human errors ✅ Speed up deployments ✅ Glue different tools together 🛠️ Must-Know Concepts 🔹 Variables name="DevOps" echo "Hello $name" 🔹 Conditionals if [ -f "file.txt" ]; then echo "File exists" fi 🔹 Loops for i in 1 2 3 do echo "Run $i" done ⚠️ Common Mistakes ❌ Missing execution permission 👉 chmod +x script.sh ❌ Wrong shebang 👉 Always use #!/bin/bash ❌ Not handling errors 👉 Can break automation silently 📌 Real-World Use Case Deploying an app: Pull latest code Build Docker image Run container 👉 All in one script 📌 Key Takeaway 👉 Shell scripting = automation superpower for DevOps If you can script it… you don’t have to repeat it 🚀 💬 What’s the most useful script you’ve written so far? #DevOps #ShellScripting #Linux #Automation #100DaysOfDevOps #LearningInPublic
To view or add a comment, sign in
-
-
Hey Everyone, I built a CLI tool and published it on GitHub — here's the problem that started it. I was running multiple Kubernetes services locally through Docker Desktop + Kind in WSL2. Every `kubectl port-forward` blocks a terminal, so I ended up with a tmux session full of forwards — and no clean way to see what was running, what had crashed, or what port belonged to what service. I was looking for some tool So I built portman. 𝗪𝗵𝗮𝘁 𝗶𝘁 𝗱𝗼𝗲𝘀: → Runs kubectl, SSH, and socat port forwards in the background — no blocked terminals → Tracks every forward by name, PID, and port in a persistent state file → Shows a live status table (think htop, but for ports) → Built-in port reference: `portman info postgres` tells you port 5432, whether it's free, and if you have a forward on it → Kill by name, port number, or kill everything at once 𝗕𝘂𝗶𝗹𝘁 𝘄𝗶𝘁𝗵: → Pure bash — one script, no dependencies beyond python3 (already on every Linux system) → JSON state file for persistence across sessions → GitHub Actions CI with shellcheck + smoke tests on every push → MIT licensed and open source This started as a personal frustration fix. It ended up teaching me a lot about bash process management, background daemons, PID tracking, POSIX signal handling, and what it actually takes to ship a tool other people can install and use. If you work with Kubernetes locally or manage lots of forwarded ports, give it a try: 👉 https://lnkd.in/dvFwKw8N Install in one line: curl -fsSL https://lnkd.in/dhd6pbJP -o /usr/local/bin/portman && chmod +x /usr/local/bin/portman Feedback and contributions welcome — issues and PRs are open. #OpenSource #Kubernetes #Linux #BashScripting #DevTools #WSL #CloudNative #SoftwareEngineering
To view or add a comment, sign in
-
-
🕒 Stop Googling Cron Syntax: The Ultimate Automation Cheat Sheet Automation is the backbone of modern DevOps, but let’s be honest: How many times have you had to search "cron expression for every Tuesday at 3 AM"? Cron jobs are one of those fundamental Linux tools that everyone uses, but few people memorize. The attached infographic is a perfect visual guide to mastering the crontab and ensuring your scripts run exactly when they should. 🧩 Breaking Down the Syntax The core of a Cron job is the 5-star system. Understanding the order is key to avoiding middle-of-the-night deployment disasters: 1. Minute (0 - 59) 2. Hour (0 - 23) 3. Day of Month (1 - 31) 4. Month (1 - 12) 5. Day of Week (0 - 6, where 0 is Sunday) ⚡ Pro-Level Shortcuts While the stars are standard, don't sleep on the Special Strings. They make your crontab files much more readable: • @reboot — Runs once at startup (perfect for starting background services). • @daily or @midnight — Self-explanatory and much cleaner than 0 0 * * *. • @hourly — Replaces 0 * * * *. 🛠️ Key Operators to Remember • * (Asterisk): Every possible value. • , (Comma): A list of values (e.g., 1,3,5). • - (Hyphen): A range (e.g., 1-5 for Mon-Fri). • / (Slash): Steps/intervals (e.g., */15 for every 15 minutes). 🖥️ Essential Commands The cheat sheet also highlights the "big three" for managing your tasks: • crontab -e: Edit your jobs. • crontab -l: List your active jobs. • crontab -r: Remove all jobs (use with caution!). 💡 My Takeaway Automation is about reclaiming your time. Whether you're backing up databases, clearing logs, or triggering API calls, mastering Cron is a non-negotiable skill for any developer's toolkit. Save this post or download the image—your future self will thank you next time you're setting up a server at 2:00 AM! #Linux #DevOps #Automation #CodingTips #BackendDevelopment #SysAdmin #SoftwareEngineering #TechCheatSheet
To view or add a comment, sign in
-
Explore related topics
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development