Your Codex Toolkit A Command-Line Cheat Sheet

G'day! While Codex is a genius at writing code, you're the director of the show. The command line (or terminal) is your control panel for managing files, running your app, and saving your work. This cheat sheet covers the essential commands you'll use on your coding adventures with Codex.

Navigating Your Project

Getting around your project folders.

Command What It Does / When to Use It
ls List files and folders. Use this to see what's in your current directory.
cd foldername Change Directory. Use this to move into a folder. (e.g., cd static).
cd .. Move up one directory level, out of the current folder.
pwd Print Working Directory. Shows your exact location if you get lost.
mkdir foldername Make a new directory (folder).
code . Opens the entire current folder in VS Code. The perfect way to start your session.

Managing Your Python World

Think of a virtual environment (venv) as a separate toolbox for each project. These commands manage the tools.

Command What It Does / When to Use It
source venv/bin/activate Activates your Python virtual environment. Do this first before installing packages or running your app.
deactivate Exits the virtual environment when you're done.
pip install package_name Installs a new Python tool (package) after Codex suggests using one, like fastapi or pandas.
pip install -r requirements.txt Installs all the project's packages at once. Use this after you `git pull` new code from a teammate.
pip freeze > requirements.txt Saves all the packages you've installed into a list. Do this before you `git push` so others can use your new tools.

Running & Testing Your Code

Let's see what Codex built!

Command What It Does / When to Use It
python file.py Runs a Python script. Perfect for testing a small file Codex just wrote for you.
uvicorn main:app --reload Starts your FastAPI web application. The `--reload` flag makes it automatically restart when you save changes.

Saving Your Work with Git

Saving your progress and sharing it with the world (or just your future self). For a full walkthrough, see the GitHub Workflow page.

Command What It Does / When to Use It
git status Shows which files have been changed since your last save. A great first step.
git pull Downloads the latest code from GitHub. Do this before you start working.
git add . Stages all your changes, getting them ready to be saved.
git commit -m "Your message" Saves your staged changes with a descriptive message.
git push Uploads your saved commits to GitHub.

Server Management (Advanced)

When your app is running on a real Linux server as a service.

Command What It Does / When to Use It
sudo systemctl restart myapp.service Restarts your application's service after you've pushed new code to the server.
sudo systemctl status myapp.service Checks if your app is running, or shows errors if it crashed.
sudo systemctl stop myapp.service Stops the running service.

Pro Tips & Shortcuts

  • Tab Completion: Type the first few letters of a file or folder name and press the `Tab` key. It will autocomplete the name for you!
  • Up Arrow: Press the `Up Arrow` key on your keyboard to cycle through your most recent commands. Saves a ton of typing.
  • CTRL + C: This is the universal "STOP" button. If a command is running and you want to quit, just press `CTRL + C`.