5 releases

0.1.13 Mar 21, 2024
0.1.12 Mar 17, 2024
0.1.11 Jan 25, 2024
0.1.10 Jan 25, 2024
0.1.9 Dec 31, 2023

#1291 in Command line utilities

Download history 10/week @ 2024-02-21 29/week @ 2024-02-28 3/week @ 2024-03-06 189/week @ 2024-03-13 134/week @ 2024-03-20 4/week @ 2024-03-27 7/week @ 2024-04-03

243 downloads per month


479 lines

shmarks - a fast, easy, robust and convenient way of handling bookmarks of directories


Create, remove, view sorted (by bookmark names of directory paths) bookmarks of your favorite directories



  1. Install binary

    > cargo +nightly install shmarks --locked
  2. Add code in your .zshrc (should work with little changes in other shells as well)

    Adding this into your directory of plugins might be a more clean option (include in .zshrc with source plugins_dir/shmarks.zsh)

    export SHMARKS_LIST_PATH="$HOME/.local/share/shmarks.toml" # place where your shell bookmarks (shmarks) stored
    export SHMARKS_AUTO_SORT="d" # sort on adding new alias: a = by aliases, d = by directories, otherwise no sorting
    export SHMARKS_DEFAULT_ALIAS="dd" # default alias to jump into if no alias name was provided
    # Jump by alias
    f() {
        if [[ $# -eq 0 ]]; then
            # jump to default dir if no arguments provided
            cd "$(shmarks -a "$SHMARKS_DEFAULT_ALIAS")"
            cd "$(shmarks -a "$@")"
    # Might be interesting to you
    alias s='shmarks' # shortcut for 'shmarks' binary
    alias p='shmarks ls -d' # colored list print with directories
    alias se="$EDITOR "$SHMARKS_LIST_PATH"" # edit shmarks
    alias pf='shmarks ls -d | rg'  # find in print of directories
    # fzf jumper
    sf() {
        local choice="$(shmarks ls -dp | fzf)"
        if [ -n "$choice" ]; then
            local dir="$(echo "$choice" | awk '{print $2}')"
            cd "$dir"
    # Autocompletion of alias
    _shmarks_compzsh() {
        reply=($(shmarks ls))
    compctl -K _shmarks_compzsh f # change 'f' to alias set for jumping (6th line)


> shmarks
Directory bookmarks for the shell.

Usage: shmarks [OPTIONS]
       shmarks <COMMAND>

  new   Create new mark. Creates mark for current directory by default [aliases: n]
  rm    Remove mark. Removes mark of current dir if no args provided [aliases: r]
  ls    List all marks [aliases: l]
  sort  Sort shmarks file [aliases: s]
  help  Print this message or the help of the given subcommand(s)

  -a, --alias <ALIAS>  Alias of the directory to jump into
  -h, --help           Print help
  -V, --version        Print version

Jump by alias 'default' into default dir

> f

Jump by alias

> f myalias

Edit marks file in $EDITOR

> se

Save current dir (pwd) to shmarks and sort shmarks file if $SHMARKS_AUTO_SORT was set

> shmarks new myalias
> s n myalias

Save specified dir to shmarks

> shmarks new myalias /my/dir

Remove current dir from shmarks

> shmarks rm

Remove alias specified by its directory path

> shmarks rm -d /my/dir

Remove alias specified by its name

> shmarks rm -a myalias

List all saved marks like plain GNU "ls" utility

> shmarks ls 

List all saved marks like "/bin/ls -l" in columns with dirs showed, colored

> shmarks ls -d
> p

Sort shmarks by directories (alphabetical order)

> shmarks sort -d


  • By default, shmarks.toml located in $XDG_DATA_HOME or $HOME/.local/share. You could override it with $SHMARKS_LIST_PATH
  • It requires nightly Rust only because of the "std::path::absolute" to resolve relative paths that might not exist

Inspired by

  • huyng/bashmarks


~165K SLoC