How to Bookmark commands in Terminal
Thamaraiselvam

Thamaraiselvam @thamaraiselvam

About: I am a passionate person, who has been working as a Full Stack Developer for 4 years. I love GNU/Linux, Open Source Software

Location:
India
Joined:
Mar 31, 2017

How to Bookmark commands in Terminal

Publish Date: Aug 22 '19
93 18

Always we hate to type or search or copy and paste most often used commands in the terminal.

I found a great tool to ease the navigation in the terminal, called Apparix. It lets you bookmark a folder so that you easily can navigate to it just by typing

to nameofbookmark

To install apparix in Ubuntu, type

sudo apt-get install apparix

To install in Mac, type

brew install -v apparix or Run this Script

in a terminal window.

After installation, you need to set up the aliases bm for bookmarking and to for going to a bookmark by adding a few functions to your .bashrc file in your home folder (if you don’t have this file, you can create it yourself).

You’ll find the functions you need to add by issuing the command

apparix –shell-examples

in a terminal window. Copy everything below Bash-style functions except the CSH-style aliases. Paste this into your .bashrc file.

Open up a new terminal, cd to your directory of choice and type

bm mybookmark

to bookmark the folder. Afterward, you can go to any folder and type

to mybookmark

to go to your bookmark.

This tool is, of course, available for other Linux distributions too.

Reference: https://micans.org/apparix/

Comments 18 total

  • Mauro Porras
    Mauro PorrasAug 23, 2019

    If you use zsh with oh-my-zsh, the wd plugin may be of your interest: github.com/robbyrussell/oh-my-zsh/...

  • Thamaraiselvam
    ThamaraiselvamAug 23, 2019

    Thanks for the comment, pushd, popd is a stack, we can't bookmark a command in a userdefined name and also I am not sure how difficult to manage n number of commands in the stack

    • Liz Lam
      Liz LamSep 4, 2019

      It's possible to view an indexed version of the directory stack by using dirs -v and then pop the directory by index using popd +N. But bm and to definitely feels more intuitive.

  • Jasper Stephenson
    Jasper StephensonAug 23, 2019

    This is a bit off topic, but I absolutely love the typeface in your header image. Do you remember what it is? :)

  • Vlastimil Pospichal
    Vlastimil PospichalAug 23, 2019

    I use symlinks, CDPATH and aliases. This is enought.

  • Mark Sta Ana
    Mark Sta AnaAug 23, 2019

    This is a nice idea will give it a go. Previously in bash I’ve used the hash (comment) to tag complex commands ie ls # complex Then used CTRL-R to recall them using the tag.

    Fish shell has amazing mind reading abilities too, I know it’s mostly based on frequency of command history.

  • Vivek Soundrapandi
    Vivek SoundrapandiAug 23, 2019

    I use zsh z(github.com/agkozak/zsh-z), auto remembers all directory by their names. No need to explicitly book mark

    • Mitch Stanley
      Mitch StanleyAug 23, 2019

      Ooh I like this 😀, I've just found the Fish shell port as well - github.com/jethrokuan/z

    • Thamaraiselvam
      ThamaraiselvamAug 23, 2019

      Wow, it is good. does it work with the only directory?

      • Vivek Soundrapandi
        Vivek SoundrapandiAug 24, 2019

        No it works across any directory that we have visited at least one. Cool thing is it does partial match, most cases I just type 3-4 substring of directory names.
        Z dev takes me to /users/... /development directory

  • Michele Perrotta
    Michele PerrottaAug 23, 2019

    I use autojump, that, AFAIK, it's similar to z.

    • David Da Silva
      David Da SilvaAug 26, 2019

      +1 for autojump.
      Jumping to a folder named "MyFooBar" is as simple as j foo*.

      (*) Provided you have been at least once in this folder before.

  • Bruno Paz
    Bruno PazAug 23, 2019

    I use fzf-marks and zsh-z for folder navigation.

    For commands pet is really nice.

  • Ameen Ali
    Ameen AliAug 24, 2019

    when there's a folder I usually navigate to, I cd into it using full path once so that i can use ctrl+r name_of_folder for faster access next time. Works on files, too, and uses built-in cli tools.

Add comment