Unix Cli Best Practices logo

Unix Cli Best Practices

OrganizationPopular
flutter
unix-cli-best-practices

Safe, portable, and efficient command-line patterns for macOS/BSD Unix tools (grep, find, sed, awk, xargs, mdfind, pbcopy, open) and modern alternatives (ripgrep, fd). Covers common shell scripting and one-liner use cases including fast searching, text processing, codebase navigation, and parallel execution.

Overview

Publisherflutter
Repositoryagent-plugins
Skill nameunix-cli-best-practices
Stars
3K
Forks
182
Bundled files
Instructions only
LicenseBSD-3-Clause
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by flutter on GitHub. Read the source before you install it.

Installation

Install the Unix Cli Best Practices AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/flutter/agent-plugins/tree/main/.agents/agents/reidbaker-agent/skills/unix-cli-best-practices
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/flutter/agent-plugins.git /tmp/agent-plugins
mkdir -p .claude/skills
cp -r /tmp/agent-plugins/.agents/agents/reidbaker-agent/skills/unix-cli-best-practices .claude/skills/unix-cli-best-practices
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Unix Cli Best Practices in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Unix Cli Best Practices on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Unix Cli Best Practices is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Unix CLI best practices

This guide provides efficient, safe, and portable techniques for manipulating text and finding files from the command line on macOS. By default, macOS uses BSD-derived UNIX utilities (grep, find, sed, awk) which have subtle differences from their GNU/Linux counterparts.

When possible, use high-performance replacements (ripgrep and fd) which respect .gitignore rules by default and offer more ergonomic interfaces.

Modern high-performance alternatives

Use these tools instead of standard BSD utilities for local codebase operations.

ripgrep (rg)

Use ripgrep (rg) as the preferred tool for searching text. It is faster than standard grep and respects .gitignore rules by default.

Common use cases:

  • Run rg 'search_term' to recursively search the current directory.
  • Run rg -S 'term' to search case-insensitively unless the query contains uppercase letters. Use rg -i 'term' for strict case-insensitivity.
  • Run rg -g '*.ts' -g '!*.spec.ts' 'term' to search .ts files while excluding .spec.ts files.
  • Run rg -v 'ignore_me' to print lines that do not match the pattern.
  • Run rg -l 'term' to list only the names of matching files. Combine with rg -0 for null-terminated output suitable for xargs.
  • Run rg -F 'foo()' to treat the search pattern as a fixed string rather than a regular expression.
  • Run rg -w 'const' to match whole words only.
  • Run rg -C 2 'term' to show two lines of surrounding context. Use rg -B 2 for preceding context or rg -A 2 for succeeding context.

Refer to rg --help for the complete options list.

fd

Use fd as the preferred tool for traversing the filesystem and finding files. It is faster than standard find and respects .gitignore rules by default.

Common use cases:

  • Run fd 'pattern' to find files matching the regex pattern anywhere in their path.
  • Run fd -e py -e txt to filter results by file extensions.
  • Run fd -t d 'docs' to find directories. Use fd -t f for files and fd -t l for symbolic links.
  • Run fd -H to include hidden files, or fd -I to include ignored files (such as node_modules). Combine as fd -HI to search all files.
  • Run fd -p 'src/assets' to match the pattern against the full path instead of just the filename.
  • Run fd -e log -x rm to execute a command on each matching file individually. Use -X (e.g., fd -e log -X rm) to run the command once with all matching files as arguments.
  • Run fd -a 'pattern' to return absolute paths instead of relative paths.

Refer to fd --help for the complete options list.

Built-in tools for macOS and BSD

Use these built-in utilities only when rg and fd are unavailable. Apply precise filters to prevent performance degradation.

Efficient searching with grep

Do not use grep | grep -v 'unwanted_dir' to exclude directories. This approach reads all files before filtering them. Use native exclusion arguments instead to exclude directories at the filesystem level:

bash
# Slow: reads binary and ignored files
grep -R "pattern" . | grep -v "node_modules"

# Fast: skips the directory completely at the filesystem level
grep -R --exclude-dir=node_modules --exclude-dir=.git "pattern" .

Common grep flags:

  • -r or -R to search recursively. -R follows symbolic links, while -r does not.
  • -I to ignore binary files for faster execution and clean output.
  • --exclude="*.min.js" to ignore files matching a specific glob.
  • --include="*.dart" to search only files matching a specific glob.
  • -l to print only the names of files containing matches.
  • -Z to print a null character after each filename, which is useful when piping to xargs -0.

Example of safely deleting files containing a specific string:

bash
grep -rlZ -I --exclude-dir=node_modules "DEPRECATED_API" . | xargs -0 rm

High-performance traversal with find

Prevent find from traversing irrelevant directory trees by using the -prune option.

bash
# Slow: traverses node_modules entirely, then filters output
find . -name "*.ts" | grep -v "node_modules"

# Fast: skips node_modules entirely
find . -name "node_modules" -prune -o -name "*.ts" -print

The expression -name "node_modules" -prune stops traversal when encountering a node_modules directory. The -o (OR) operator specifies that for any other directory or file ending in .ts, the path is printed.

macOS portability with sed

macOS uses BSD sed, which differs from GNU sed in its handling of in-place editing.

Use the -i option with an explicit backup extension. To edit in-place without creating a backup, provide an empty string:

bash
# Edit in-place without creating a backup
sed -i '' 's/oldName/newName/g' filename.txt

# Edit in-place and create a backup named filename.txt.bak
sed -i '.bak' 's/oldName/newName/g' filename.txt

Use the -E option to enable extended regular expressions, avoiding the need to escape parentheses and plus signs:

bash
sed -E 's/(foo|bar)+/baz/g' file.txt

Codebase analysis with awk

Use awk for line-by-line data extraction and text processing.

Common use cases:

  • Print specific columns from space-separated input:
    bash
    ls -l | awk '{print $1, $3}'
  • Find and print duplicate lines in a file without sorting them first:
    bash
    awk '!seen[$0]++' filename.txt
  • Filter lines based on column values (for example, printing lines where the third column is greater than 100):
    bash
    awk '$3 > 100' data.txt
  • Find lines matching a pattern and print their line number (NR) along with the content:
    bash
    awk '/Error/ {print NR, $0}' server.log

Safe pipelines and parallelism with xargs

Use xargs to build and execute commands from standard input. Always use the -0 option (null-terminated) when processing file paths to handle filenames containing spaces or special characters safely.

bash
# Unsafe: will fail or perform unintended actions if filenames contain spaces
find . -name "*.log" | xargs rm

# Safe: handles spaces and special characters correctly
find . -name "*.log" -print0 | xargs -0 rm

Use the -P option to run tasks in parallel:

bash
# Run up to 4 curl processes in parallel
cat urls.txt | xargs -n 1 -P 4 curl -O

macOS-specific CLI tools

Use macOS-specific utilities to interact with operating system features:

  • Use mdfind to query the macOS Spotlight index for fast, global file and content searches without scanning the disk:
    bash
    # Search by filename
    mdfind -name "project_spec"
    
    # Search by text content within files
    mdfind "kMDItemTextContent == 'TODO: Refactor'"
  • Use pbcopy and pbpaste to interact with the system clipboard:
    bash
    # Copy file content to the clipboard
    cat ssh_key.pub | pbcopy
    
    # Paste clipboard content to a file
    pbpaste > new_file.txt
  • Use open to open files, directories, or URLs with their default applications:
    bash
    # Open the current directory in Finder
    open .
    
    # Open a local HTML file using a specific application
    open -a "Google Chrome" index.html

Frequently asked questions

What does the Unix Cli Best Practices AI skill do?

Safe, portable, and efficient command-line patterns for macOS/BSD Unix tools (grep, find, sed, awk, xargs, mdfind, pbcopy, open) and modern alternatives (ripgrep, fd). Covers common shell scripting and one-liner use cases including fast searching, text processing, codebase navigation, and parallel execution.

Why use Unix Cli Best Practices on TypingMind?

Because you install it once and use it with any model. Unix Cli Best Practices is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Unix Cli Best Practices in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/flutter/agent-plugins/tree/main/.agents/agents/reidbaker-agent/skills/unix-cli-best-practices. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Unix Cli Best Practices?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Unix Cli Best Practices?

As many as you like. As long as a model supports skills, you can use Unix Cli Best Practices with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Unix Cli Best Practices AI skill free?

Yes. It is published on GitHub by flutter under the BSD-3-Clause license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇