%bookmark: Manage IPython's bookmark system.
Setting bookmarks is very handy if you find yourself changing directories within a project, or even outside a project and would like to be have faster access to often-used directories.
%bookmark <name> - set bookmark to current dir %bookmark <name> <dir> - set bookmark to <dir> %bookmark -l - list all bookmarks %bookmark -d <name> - remove bookmark %bookmark -r - remove all bookmarks
Here’s an example that shows setting a bookmark to the current directory, navigating to the user’s home directory, then coming back to the project:
In : %pwd Out: '/Users/eric/projects/ipython-book' In : %bookmark book In : %bookmark -l Current bookmarks: book -> /Users/eric/projects/ipython-book In : %cd ~ /Users/eric In : %pwd Out: '/Users/eric' In : %cd -b book (bookmark:book) -> /Users/eric/projects/ipython-book /Users/eric/projects/ipython-book In : %pwd Out: '/Users/eric/projects/ipython-book'
You can also omit the
-b after the
%cd command if there’s no directory with the name of your bookmark. The bookmarks are associated with each profile and persist through IPython sessions.