David Yakobovitch
David Yakobovitch

Reputation: 76

Code for .zshrc or .bash_profile that sets jupyter notebook Alias to type in terminal as shortcut jn

I develop in Anaconda3 and Jupyter Notebook with Python for my coding environment on Mac OSX, with Visual Studio Code.

I typically type jupyter notebook numerous times throughout the day to launch new instances, yet this is inefficient for keystrokes.

I am looking to write a script or alias inside my .zshrc file for OhMyZsh (similar to .bash_profile) that will let me simply type jn, as desired to save time in Terminal to launch a new jupyter notebook instance.

Upvotes: 0

Views: 1130

Answers (1)

OneCricketeer
OneCricketeer

Reputation: 191844

If I understand correctly

alias jn="jupyter notebook"

Though, I would suggest using a function that you can define a notebook directory

function jn() {
    local notedir="$1"
    # Add extra logic here to give a standard directory, if no param given 
    jupyter notebook "$notedir"
}

Sidenote: Bundling a Docker container with all your needed kernels and combining that with this function allows for good portability, for example sharing notebooks with others

Upvotes: 2

Related Questions