Custom Slash Command Not Working on Ubuntu Linux
Bug Description
custom-slash-commands don't work on Ubuntu Linux but it seems to work on my Mac.
I have followed this guide:
Create a project command
mkdir -p .claude/commands
echo "Analyze this code for performance issues and suggest optimizations:" > .claude/commands/optimize.md
On my Mac /optimize shows up as a command. On linux neither /project:optimize nor /optimize shows up. If I type the command fully it still does not work evidenced by this session where I created a greeting command, see the cat at the end:
╭────────────────────────────────────────────────────────────╮
│ ✻ Welcome to Claude Code! │
│ │
│ /help for help, /status for your current setup │
│ │
│ cwd: /home/sebestjcg/PycharmProjects/github/claude-code │
╰────────────────────────────────────────────────────────────╯
※ Tip: Want Claude to remember something? Hit # to add preferences, tools, and instructions to Claude's memory
/greeting
● Hello! I'm Claude Code, ready to help you with your software engineering tasks.
I can assist with:
- Code analysis and debugging
- Feature implementation
- Refactoring and optimization
- Testing and verification
- Git operations
- And much more
What would you like to work on today?
/project:greeting
● I'll help you understand this project. Let me explore the codebase structure and key files to give you an overview.
● List(.)
⎿ Listed 13 paths (ctrl+r to expand)
● Read(README.md)
⎿ Read 42 lines (ctrl+r to expand)
● Read(package.json)
⎿ Error: File does not exist.
● Search(pattern: "*.json")
⎿ Found 1 file (ctrl+r to expand)
● Search(pattern: "src/**/*")
⎿ Found 0 files
● Read(settings.json)
⎿ Read 49 lines (ctrl+r to expand)
● Read(CHANGELOG.md)
⎿ Read 50 lines (ctrl+r to expand)
● Project: Claude Code
Claude Code is Anthropic's official agentic coding tool - a CLI that lives in your terminal and helps developers code faster through natural language commands.
Key Features:
- Agentic coding assistance - Executes routine tasks, explains complex code, handles git workflows
- Terminal-based interface - Works directly in your terminal or IDE
- Natural language commands - Interact through conversational instructions
- GitHub integration - Can be used with @claude mentions on GitHub
Project Structure:
- Core files: README.md, CHANGELOG.md, LICENSE.md, SECURITY.md
- Configuration: settings.json with permissions, MCP servers, and hooks
- Examples: Hook examples in examples/hooks/
- Scripts: PowerShell setup script for Windows DevContainer
Current Setup:
- Version: 1.0.41 (latest based on changelog)
- Installation: npm install -g @anthropic-ai/claude-code
- MCP Integration: Task Master AI server enabled
- Hooks: Sound notification on completion
Key Capabilities:
- Code analysis and debugging
- Feature implementation
- Git workflow management
- File operations and refactoring
- Testing and verification
This appears to be the official Claude Code repository with configuration for development and testing purposes.
! cat .claude/commands/greeting.md
⎿ Say this and do nothing else: Hello World!
Environment Info
- Platform: linux
- Terminal: tmux
- Version: 1.0.41
- Feedback ID: 01cc059c-b23b-4c1e-b29d-532167f97582
Errors
[{"error":"Error: Command failed: /usr/bin/snap --files --hidden /home/user/PycharmProjects/github/claude-code\nerror: unknown flag `files'\n\n at genericNodeError (node:internal/errors:983:15)\n at wrappedFn (node:internal/errors:537:14)\n at ChildProcess.exithandler (node:child_process:414:12)\n at ChildProcess.emit (node:events:518:28)\n at ChildProcess.emit (node:domain:489:12)\n at maybeClose (node:i
Note: Error logs were truncated.
I've just tested this on my Mac and it's working there so this only affects Linux (haven't tested Windows).
5 Comments
Yeah I had the same issue, custom slash commands not working in neither
./.claude/commands,~/.claude/commandsnor~/.config/claude/commands.Removing an old rg package and installing the latest rg version made them show up.
thanks for the pointer @runekaagaard!
turns out I had the wrong home brew (intel instead of arm) which installed the wrong rg. reinstalling homebrew and then reinstalling rg fixed this for me
we made some changes to rg in 1.0.84, including switching to our built-in version. See https://docs.anthropic.com/en/docs/claude-code/troubleshooting#search-and-discovery-issues if you're still having issues
Hello, I moved to use to mac for this, but now it's working. Thank you for fixing it
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.