Previous topic

Next topic

This Page

Quick search

As of the 0.11 version of IPython, most of the APIs used by the shell
profile have been changed, so the profile currently does very little
beyond changing the IPython prompt. To help restore the shell
profile to past functionality described here, the old code is found in
IPython/deathrow, which needs to be updated to use the
APIs in 0.11.

The ‘sh’ profile optimizes IPython for system shell usage. Apart from
certain job control functionality that is present in unix (ctrl+z does
“suspend”), the sh profile should provide you with most of the
functionality you use daily in system shell, and more. Invoke IPython
in ‘sh’ profile by doing ‘ipython -p sh’, or (in win32) by launching
the “pysh” shortcut in start menu.

If you want to use the features of sh profile as your defaults (which
might be a good idea if you use other profiles a lot of the time but
still want the convenience of sh profile), add importipy_profile_sh
to your $IPYTHON_DIR/ipy_user_conf.py.

The ‘sh’ profile is different from the default profile in that:

Prompt shows the current directory

Spacing between prompts and input is more compact (no padding with
empty lines). The startup banner is more compact as well.

System commands are directly available (in alias table) without
requesting %rehashx - however, if you install new programs along
your PATH, you might want to run %rehashx to update the persistent
alias table

Macros are stored in raw format by default. That is, instead of
‘_ip.system(“cat foo”), the macro will contain text ‘cat foo’)

Autocall is in full mode

Calling “up” does “cd ..”

The ‘sh’ profile is different from the now-obsolete (and unavailable)
‘pysh’ profile in that:

All of your $PATH has been loaded as IPython aliases, so you should be
able to type any normal system command and have it executed. See
%alias? and %unalias? for details on the alias facilities. See also
%rehashx? for details on the mechanism used to load $PATH.

Since each command passed by ipython to the underlying system is executed
in a subshell which exits immediately, you can NOT use !cd to navigate
the filesystem.

IPython provides its own builtin ‘%cd’ magic command to move in the
filesystem (the % is not required with automagic on). It also maintains
a list of visited directories (use %dhist to see it) and allows direct
switching to any of them. Type ‘cd?’ for more details.

Allows you to add system command aliases for commands that are not along your path. Let’s say that you just installed Putty and want to be able to invoke it without adding it to path, you can create the alias for it with rehashdir:

The ‘.s’ property returns one string where lines are separated by
single space (for convenient passing to system commands). The ‘.n’
property return one string where the lines are separated by ‘n’
(i.e. the original output of the function). If the items in string
list are file names, ‘.p’ can be used to get a list of “path” objects
for convenient file manipulation.