Skip to content

labarjni/bashmarks

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Bashmarks is a shell script that allows you to save and jump to commonly used directories. Now supports tab completion.

Install

  1. git clone https://github.com/huyng/bashmarks.git
  2. cd bashmarks
  3. make install
  4. Open the .bashrc file
nano ~/.bashrc

Add bashmarks autoload code

Add the following block to the end of the file:

# Load bashmarks automatically in every session
if [ -f ~/.local/bin/bashmarks.sh ]; then
    source ~/.local/bin/bashmarks.sh
    echo "bashmarks loaded successfully"
fi

Save the file

Nano: Press Ctrl + X, then Y, then Enter

Vim: Press Esc, type :wq, press Enter

Apply changes

source ~/.bashrc
  1. you can now remove the downloaded bashmarks folder which is no longer needed

Shell Commands

Basic Bookmark Commands

  • s <bookmark_name> - Saves the current directory as "bookmark_name"
  • g <bookmark_name> - Goes (cd) to the directory associated with "bookmark_name"
  • p <bookmark_name> - Prints the directory associated with "bookmark_name"
  • d <bookmark_name> - Deletes the bookmark
  • lb - Enhanced list with directory info

File Operations

  • f <bookmark> <file> - Create file in bookmarked directory
  • c <bookmark> <files...> - Copy files to bookmarked directory
  • m <bookmark> <files...> - Move files to bookmarked directory
  • e <bookmark> <file> - Edit file in bookmarked directory
  • lf <bookmark> - List files in bookmarked directory

Advanced Operations

  • b <bookmark> - Backup current directory to bookmark
  • r <old_name> <new_name> - Rename bookmark
  • t <bookmark> [name] - Create timestamped file/dir in bookmark
  • sync <bookmark> - Sync current directory to bookmarked directory

Tab Completion

  • g b[TAB] - Tab completion available for bookmarks
  • p b[TAB] - Tab completion available for bookmarks
  • d [TAB] - Tab completion available for bookmarks

Example Usage

$ cd /var/www/
$ s webfolder
$ cd /usr/local/lib/
$ s locallib
$ l
$ g web<tab>
$ g webfolder

# File operations examples
$ f webfolder index.html
$ c webfolder style.css script.js
$ sync webfolder
$ b locallib

Where Bashmarks are stored

All of your directory bookmarks are saved in a file called ".sdirs" in your HOME directory.

Creators

About

Directory bookmarks for the shell

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 97.9%
  • Makefile 2.1%