The premise of the question seems inconsistent. If you can do the ipython pwd
or cd
standard magic commands, then you should also be able to access the ipython standard alias ls
. If you cannot, then it almost certainly because you've overwritten / shadowed the meaning of the ls
alias.
It's crucial to distinguish between (1) a plain Python shell (opened by typing python
at a Canopy command prompt), which does not provide pwd
nor cd
nor 'lscommands; and (2) *any* IPython shell, whether the Python panel in the Canopy GUI or an
ipython` terminal in the Canopy Command Prompt, which does provide those, and many other Ipython "magic" commands.
(For more about IPython magic commands, see http://ipython.readthedocs.io/en/stable/interactive/magics.html; these are the docs for IPython version 6, but they are mostly the same for IPython version 5 which Canopy uses in order to support both Python 2.7 and Python 3.5+.)
The two previous answers are always correct in that they will work in any Python program or shell (depending on OS). That is because they only use the Python standard library. However they are not analogous to the cd
and pwd
commands that you mention, which are specific to the IPython shell (not to programs running in an IPython shell).
IMO, there is very seldom a good reason for opening a plain Python shell. If you simply want to run a script file from a Command Prompt, then by all means python myscript.py
. But if you want an interactive shell, IPython provides so much extra capability that it has been for many years the de facto standard for Python shells (which is why it is used for the Canopy GUI's Python shell).