bash-linux

Write reliable Bash scripts with set -euo pipefail and traps.

Updated Feb 2, 2026
One-click install
npx skills add https://github.com/nishchaydev/emitra --skill bash-linux-nishchaydev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bash-linux
Source: https://github.com/nishchaydev/emitra/tree/main/.agent/skills/bash-linux
Command: npx skills add https://github.com/nishchaydev/emitra --skill bash-linux-nishchaydev

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It solves the problem of writing reliable, maintainable shell commands and scripts by providing proven Bash/Linux terminal patterns for chaining, safety, and day-to-day troubleshooting.

Core Features & Use Cases

  • Operator syntax: Use ;, &&, ||, and | to control execution flow and compose pipelines (e.g., run install only if it succeeds, pipe results to filters).
  • File and process management: Quickly list, search, inspect, and troubleshoot files and running processes (e.g., find files, follow logs, identify and kill services by port).
  • Text and environment handling: Perform common transformations with grep, sed, awk, cut, sort, uniq, and wc, while safely working with environment variables using env, export, and quoting.
  • Network requests and scripting templates: Use curl for API calls and apply a production-style script template with set -euo pipefail and cleanup traps.

Quick Start

Use this guidance to build a safe Bash script that exits on errors and reliably processes files by looping over matching filenames and logging progress while using set -euo pipefail for robust failure handling.

Frequently Asked Questions about bash-linux

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a bash script that exits on errors and cleans up properly?

To write a robust bash script that exits on errors, use a production-style template with `set -euo pipefail` and implement cleanup traps to handle unexpected failures and safely terminate background jobs.

What is the best way to chain shell commands conditionally in a Linux terminal?

The best way to chain shell commands conditionally is by using shell operators like `&&` to execute the next command only if the previous one succeeds, and `||` to execute a fallback command if the previous one fails.

How do I find and kill a process running on a specific port using bash?

You can manage running processes by using bash process management commands to identify the process ID occupying a specific port and then issuing a kill command to safely terminate that service.

Can I parse and transform text output using standard Linux terminal commands?

Yes, you can perform common text transformations by piping output through standard Linux commands like `grep` for searching, `sed` for editing, `awk` for pattern scanning, and `cut`, `sort`, `uniq`, `wc` for data extraction and counting.

Does the bash scripting template work on macOS as well as Linux?

Yes, the bash and Linux terminal patterns apply to scripting on both macOS and Linux, providing reliable workflows for file, process, and text operations using standard shell operators and environment variables.

Why should I use `set -euo pipefail` in my shell scripts?

Using `set -euo pipefail` in your shell scripts enforces deterministic shell usage by ensuring the script exits immediately on errors, treats unset variables as errors, and catches failures within chained pipelines.