Working with Shell Commands

Execute shell commands to interact with the system, files, and tools.

tools-only Updated 7 repo stars

File contents

Working with Shell Commands

Execute shell commands to interact with the system, files, and tools.

Best Practices

  1. Check before destructive operations: Use ls, git status, etc. before rm or git reset
  2. Use absolute paths: Relative paths can break if working directory changes
  3. Proper quoting: Use single quotes for content with special characters
  4. Chain related commands: Use && to only continue if previous command succeeds

Common Patterns

Exploring the filesystem

# List files
ls -la

# Find files
find . -name "*.py" -type f

# Check directory structure
tree -L 2

Git operations

# Check status before committing
git status

# Stage specific files
git add path/to/file.py

# Never use git add . or git add -A

File operations

# Read files
cat README.md

# Search in files
grep -r "pattern" src/

# Copy with structure
cp -r src/ backup/

Avoiding Common Mistakes

  • ❌ Don't use rm -rf without careful review
  • ❌ Avoid git commit -a - stage files explicitly
  • ✅ Use pwd to verify current directory
  • ✅ Test commands on small data first

tools-only/X-Skills/tree/main/development/testing/1190-shell_1903542d commit c844a853e5

Frequently asked questions

npx skillmds@latest add tools-only/working-with-shell-commands