LinuxCommandLibrary

bashmarks

Bookmark and jump to directories easily

TLDR

Add the bashmark aliases to your shell

$ source /usr/share/bashmarks/bashmarks.sh
copy

List available bookmarks
$ l
copy

Save the current directory as "bookmark_name"
$ s [bookmark_name]
copy

Go to a bookmarked directory
$ g [bookmark_name]
copy

Print a bookmarked directory's contents
$ p [bookmark_name]
copy

Delete a bookmark
$ d [bookmark_name]
copy

SYNOPSIS

bashmarks is not a single executable but a collection of shell functions sourced into your environment. Its functions are typically invoked as:

s <bookmark_name>
g <bookmark_name>
p <bookmark_name>
d <bookmark_name>
l
_b
_bm

PARAMETERS

s <bookmark_name>
    Saves the current working directory with the specified <bookmark_name> as a bookmark.

g <bookmark_name>
    Changes the current directory to the location saved under <bookmark_name>.

p <bookmark_name>
    Prints the full path associated with <bookmark_name> to standard output without changing directory.

d <bookmark_name>
    Deletes the bookmark named <bookmark_name>.

l
    Lists all currently saved bookmarks along with their corresponding directory paths.

_b
    Jumps to the last used bookmark. This is an optional feature that might need to be enabled during bashmarks setup.

_bm
    Provides an interactive menu to select and jump to a bookmark. Useful when you don't remember specific names.

DESCRIPTION

bashmarks is a simple yet powerful shell script designed to enhance command-line navigation by allowing users to bookmark frequently accessed directories. Instead of typing lengthy paths or using cd ../../, users can save a directory with a short, memorable name. Once bookmarked, jumping to that directory is as simple as typing g <bookmark_name>. This utility significantly improves productivity for developers, system administrators, and anyone who spends a lot of time in the terminal.

It stores bookmarks in a persistent file, usually in the user's home directory, ensuring they are available across shell sessions. bashmarks integrates seamlessly with bash and other compatible shells, offering a lightweight and efficient way to manage directory shortcuts. It provides functions for saving, navigating, listing, and deleting bookmarks, making directory management intuitive and fast.

CAVEATS

bashmarks is not a standard Linux utility and must be installed manually, typically by sourcing its script into your shell's configuration file (e.g., .bashrc). Its functions are active only in shell sessions where bashmarks has been sourced. Conflicts might arise if bookmark names clash with existing shell aliases or functions. It primarily supports bash and compatible shells like zsh, but may not work out-of-the-box with other shells without modifications or adapters.

INSTALLATION

bashmarks is typically installed by cloning its GitHub repository and then sourcing the bashmarks.sh script in your shell's startup file (e.g., ~/.bashrc or ~/.zshrc). This ensures its functions are available in every new shell session.

BOOKMARK FILE

By default, bashmarks stores all saved directory bookmarks in a plain text file, commonly located at ~/.bashmarks. This file can be manually inspected or edited if needed, though using the s and d commands is recommended for consistency and to avoid corrupting the file format.

HISTORY

bashmarks was created by Huy Nguyen and is primarily maintained as an open-source project on GitHub. It emerged as a solution for simplifying directory navigation in bash environments, addressing the common pain point of repeatedly typing long paths. Its development has been community-driven, with contributions from various users improving its features and compatibility over time. It has gained popularity due to its simplicity, lightweight nature, and effectiveness in boosting command-line productivity. It is not part of the GNU core utilities or a standard Linux distribution package by default but is widely adopted as a personal utility.

SEE ALSO

cd(1), pwd(1), pushd(1), popd(1), autojump, z

Copied to clipboard