Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Directory Bookmark Script

A lightweight helper to create and use directory “bookmarks” via bookmark and its alias bm.

Installation

Linux (Bash)

  1. Copy the Bash bookmark function and alias bm=bookmark into ~/.bashrc.
  2. Reload your shell:
source ~/.bashrc

macOS (zsh)

  1. Copy the zsh bookmark function and alias bm='bookmark' into ~/.zshrc.
  2. Reload your shell:
source ~/.zshrc

If you use Bash on macOS, follow the Linux (Bash) instructions instead.

Windows (PowerShell)

  1. Open your PowerShell profile:
notepad $PROFILE
  1. Paste the PowerShell bookmark function and Set-Alias bm bookmark into that file, then save.
  2. Reload the profile:
. $PROFILE

Features

  • Save any directory as a bookmark.
  • Jump to a directory using its bookmark name.
  • List all bookmark names.
  • Remove bookmarks.
  • Rejects duplicate names and names containing spaces.

Usage

Create a bookmark

bookmark --create .               # current directory
bookmark --create ./path/to/dir/  # specific directory
bookmark -c ../                   # short form

You will be prompted:

[Bookmark Title]: sample_title
[SUCCESS] - bookmark sample_title has been created

Errors:

  • Existing title:

    [ERROR] - bookmark sample_title already exists
    
  • Title with spaces:

    [ERROR] - bookmark sample title has spaces
    

Jump to a bookmark

bookmark --jump sample_title
bm -j sample_title

List all bookmarks

bookmark ls
bm ls

(Printed one title per line.)

Remove a bookmark

bookmark rm sample_title
bm rm sample_title

Output:

[SUCCESS] - sample_title removed
# or
[ERROR] - sample_title doesn't exist

Notes

  • Bookmark titles must not contain spaces.
  • Bookmarks are stored in ~/.dir_bookmarks.
  • bm is a shorthand alias for bookmark.

About

Simple bookmarking system for ~./bashrc

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages