# Working with Shell Commands

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

- Skill: `tools-only/working-with-shell-commands` (Agent Skill, multi-file: 3 files)
- Install (CLI): `npx skillmds@latest add tools-only/working-with-shell-commands`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tools-only/working-with-shell-commands/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: tools-only (https://skillmd.com/u/tools-only)
- Updated: 2026-09-29
- Page: https://skillmd.com/skills/tools-only/working-with-shell-commands

---


# 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
```shell
# List files
ls -la

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

# Check directory structure
tree -L 2
```

### Git operations
```shell
# 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
```shell
# 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

