loading...
Cover image for How to Bookmark commands in Terminal

How to Bookmark commands in Terminal

thamaraiselvam profile image Thamaraiselvam Originally published at thamaraiselvam.com ・1 min read

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/

Posted on by:

thamaraiselvam profile

Thamaraiselvam

@thamaraiselvam

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

Discussion

markdown guide
 

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.

 
 

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

 

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

 

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

 

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

 

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

 
 

+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.

 

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

For commands pet is really nice.

 

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

 

Font name: Droid Sans

Conver image Created from blogcover.now.sh/

 

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

 

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.

 

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.

 

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