Skip to content

Transitioning to the Command-line

While the Anaconda Navigator interface is user-friendly for beginners, using the command-line is faster and more efficient. Don't panic, it's simpler than it seems. Even if you're not familiar with coding, you can learn the command-line basics in a few minutes.


Executing our first command

Let's get started with our command-line.

  • On Windows, search for and open "Anaconda Powershell Prompt" using your Start menu.
  • On Mac and Linux, search for and open the app named "Terminal"

You should see something like this:

You'll notice (base) at the start of the line. This represents our current anaconda environment. Following that, you'll see the "current working directory", which is the folder we currently have open. On Windows, this will be your user folder (e.g. C:\Users\jacksund) and for Mac/Linux, you'll see ~ which is shorthand for your user folder (e.g. home/jacksund).

Now, type in the command cd Desktop and press enter. This will open your Desktop folder. Then enter the command ls, which will list all files and folders on your Desktop.

# run these two commands
cd Desktop
ls

Tip

Think of each command as a "button". For instance, the command cd stands for "change directory". When you use it, it opens a new folder to view its contents -- similar to double-clicking a folder to open it.


Mastering new commands

Tip

For more basic commands, refer to this cheat sheet or take a comprehensive tutorial. Remembering commands will come gradually, so keep this cheat-sheet handy. We strongly suggest that you spend 30 minutes going through these links after completing this tutorial.

The challenging part with the command-line is knowing what to type. However, most programs have a single command that forms the base of more complex commands. For anaconda, the command is conda. If you're unsure about its function or usage, simply add --help to it. Type in the command conda --help and you'll see an output like this:

conda --help
usage: conda [-h] [-V] command ...

conda is a tool for managing and deploying applications, environments and packages.

Options:

positional arguments:
  command
    clean        Remove unused packages and caches.
    compare      Compare packages between conda environments.
    config       Modify configuration values in .condarc. This is modeled after the git config command. Writes to the user .
    ...

optional arguments:
  -h, --help     Show this help message and exit.
  -V, --version  Show the conda version number and exit.

conda commands available from other packages:
  build
  content-trust
  ...

Don't get overwhelmed by the amount of information displayed. Each line conveys a simple concept.

For instance, the line -h, --help Show this help message and exit. explains what the conda --help command does! It also indicates that we could have used conda -h for the same output.

This help message also reveals other "subcommands" available. One is create which creates a new environment. To learn more about that, we can run the command conda create --help.

There's a lot here... But remember, you don't need to memorize all of this. Just remember how to access this help page when you need it. Next, we'll use these commands to create our environment and install Simmate.