Shortcut commands
On this page
A shortcut is a command you name yourself that starts Claude Code as one account: ccwork --resume does what ccam work --resume does. It is a link to ccam in ~/.local/bin, so it works in bash, zsh, scripts and anything else that runs programs from PATH. Shortcuts are optional; create one for the accounts you start often.
Usage
Creating a shortcut
ccam shortcut work ccwork
ccam shortcut 2 ccside
ccam add side --shortcut ccsideccam shortcut work ccwork creates the command ccwork, which starts Claude Code as work; ccam shortcut 2 ccside does the same for the account with number 2. When you add an account, --shortcut creates its shortcut in the same step:
$ ccam shortcut work ccwork
✓ shortcut for work: ccworkAn account has at most one shortcut, stored as shortcut in ~/.config/ccam/config.toml. The ccam add wizard asks Create a shortcut command for <name>? [y/N] and then Shortcut name [cc<name>]:. Outside the wizard, ccam add creates one only with --shortcut. ccam list shows each account's shortcut, or -.
Name rules, checked in this order:
- 1 to 64 characters of
a-z,0-9,.,-and_, starting with a letter or digit; - not
ccam,claudeor a ccam command such asrunorusage; - not another account's shortcut;
- not an existing file in
~/.local/bin, unless it is a link ccam created (such as this account's own shortcut); - not the name of another executable on your
PATH.
config.toml is checked against the same rules when it loads. If you edit a shortcut by hand so that it breaks the pattern, is claude or ccam, or is used by two accounts, every command fails with a message naming the account until you fix it.
With --dry-run, ccam shortcut checks the name and prints Would set the shortcut of work to ccwork. without saving or linking anything.
Showing, renaming and removing a shortcut
ccam shortcut work
ccam shortcut work ccw
ccam shortcut work --removeccam shortcut work without a command shows the account's shortcut. Giving a new command renames the shortcut: ccam deletes the old link and creates the new one. --remove deletes the shortcut and its link. With --dry-run, the removal prints Would remove ccwork, the shortcut of work. and changes nothing.
$ ccam shortcut work ccw
✓ shortcut for work: ccw (was ccwork)
$ ccam shortcut work --remove
✓ ccw removed; work has no shortcut now
$ ccam shortcut work
work: none (add one with `ccam shortcut work ccwork`)Giving a command and --remove together stops with give a command or --remove, not both. Setting the name an account already has prints work: ccwork (unchanged) and recreates its link if it is missing.
Using a shortcut
ccwork -p "summarise" --output-format jsonA shortcut passes every argument to Claude Code, the same way ccam <name> does after the name. That includes --dry-run and --help: to preview a launch, use ccam --dry-run work.
Recreating the links
ccam shims installccam shims install creates every missing shortcut link and points outdated ones at the ccam binary you run it with, for example after you moved ccam. A file in the way of one shortcut does not stop the others. It takes no arguments and refuses --dry-run with ccam: --dry-run is not supported by `ccam shims install`; nothing was changed.
How it works
Before ccam saves a shortcut name, it checks it against the bin folder and every other folder on PATH:
The name moves down the checks in order. Beside each check is a name it refuses: Work fails the pattern, run is a ccam command, ccside belongs to another account, ccfile is an existing file in ~/.local/bin, and git would hide /usr/bin/git. Only a name that passes every check is saved and linked.
- ccam matches the name against
^[a-z0-9][a-z0-9._-]{0,63}$, then against ccam's own command names and the other accounts' shortcuts. It looks at~/.local/bin/<name>, and in every other folder onPATHit refuses an executable file of that name that is not a link to ccam. - ccam saves
config.tomlthrough a temporary file,fsyncandrename. - ccam deletes the old shortcut's link, but only if it is a link to ccam.
- ccam goes through every configured shortcut in name order and creates each missing link, a symbolic link to the real path of the ccam binary. A file in the way of one shortcut does not stop the others; the error names each.
ccam records every link it creates, and the binary each link runs, in ~/.local/state/ccam/shortcuts.json. A link counts as ccam's own when it points to the ccam path, or when the link and the ccam path resolve to the same file. A recorded link whose binary was moved or replaced since (the ccam binary moved to another folder, a reinstall) is outdated, and ccam points it at this ccam binary. A recorded link to another installed copy of ccam is left as it is. Every remove and every overwrite check goes through these tests, so ccam does not touch files it did not create, such as your own copy of ccam or a link you made yourself.
When you run a shortcut, the name you typed is the only thing ccam needs:
The shell finds ccwork on PATH, the kernel follows the link and starts the ccam binary, and the name it was started under (argv[0]) is still ccwork. Started under any name other than ccam, ccam loads config.toml once and finds the account whose shortcut is that name. It then takes the same steps as ccam <name> with the config already loaded, and passes your arguments to claude untouched.
Why a symlink and not a shell alias or a wrapper script: a symlink works in every shell and in scripts, it avoids starting an extra shell, which would cost about 1 to 2 ms, and the launch still reads one file. scripts/perf-check.sh measures a shortcut with hyperfine against the same 10 ms (p95) limit as ccam <name>.
On Windows
A shortcut is ccwork.exe in %USERPROFILE%\.local\bin, and ccam drops the .exe (case-insensitively) before the lookup, so ccwork, ccwork.exe and CCWORK.EXE all start work. ccam first creates a symbolic link, which Windows allows in Developer Mode or for an administrator. Without that right it creates a hard link: a second name for the same ccam.exe file, which needs no privilege. A hard link counts as ccam's own when it is the same file as ccam.exe.
A hard link always runs the file it was created from, so when ccam update puts a new file in place of ccam.exe, it renews every hard-linked shortcut and prints ✓ shortcut ccwork renewed. Running install.ps1 again does the same through ccam shims install (OK 2 shortcuts now run the new ccam), and so do ccam shims install and ccam doctor --fix for any shortcut that is a copy of an older version of ccam. The name check looks for <name> with each extension in PATHEXT (.exe, .cmd and so on) in the other PATH folders.
Type a shortcut in a shell (PowerShell, cmd.exe, Git Bash). A symbolic link opened from Explorer, the Run dialog or Start-Process starts as plain ccam, which opens the dashboard instead of the account.
Safety and edge cases
- A link no account claims. If a link to ccam in
~/.local/binhas a name that no account uses, for example after you editedshortcutinconfig.tomlby hand, ccam does not fall back to the default account. It stops withccam: ccold is not the shortcut of any account (see `ccam list`, `ccam shortcut`). Set the name again withccam shortcut, or delete the link. - Existing files. ccam never replaces a file it did not create.
ccam shims installreports<path> already exists and is not a ccam link, so it was left aloneand still creates the other links.ccam addandccam importthen printshortcut: ccwork (not created; see above). - A moved ccam binary. If you move the ccam binary, the links ccam created point to a path that no longer exists.
ccam shims install(orccam doctor --fix) points them at the ccam binary you run it with. - Rename and remove.
ccam renamekeeps the shortcut name, and the link keeps working, because it points to ccam and ccam looks up the name inconfig.toml.ccam removedeletes the account's link.ccam shortcut <account> <new>deletes the old link before it creates the new one. - PATH. When ccam creates a link and
~/.local/binis not on yourPATH, it printsNote: /home/me/.local/bin is not in PATH. Add it to ~/.bashrc or ~/.zshrc:followed by theexport PATH=...line to add. On Windows it prints the PowerShell line that adds the folder to your userPATHinstead. - Checking later.
ccam doctorreportsmissing shortcuts in /home/me/.local/bin: ccwork, shortcuts that run an older version of ccam, and warns when the folder is not onPATH.ccam doctor --fixcreates the missing links and renews the outdated ones, and says→ fixedonly for those it created. A shortcut that runs another ccam that is still installed works, soccam doctorlists it as information only;ccam doctor --fixpoints it at the ccam binary you run it with, andccam addandccam importshow it asshortcut: ccwork (runs another ccam, <path>; `ccam doctor --fix` points it at this one).