Guide · Tools

The terminal

A small bash with pipes and redirects, about 60 commands, framework chips, history and Ctrl-C.

How it works

iOS does not let an app start other programs, so Pythilo's terminal is a small bash built into the app. It reads a line the way bash does (quotes, variables, globs, pipes and lists) and runs each command as part of Pythilo, on the real files of your project and with the same Python that runs your code. A command or option that is not built in says so, rather than being ignored. Type help for the list, and COMMAND --help for a command's options.

The prompt shows the folder you are in. cd moves around inside the project and stays where you left it; cd on its own goes back to the project root. A non-zero exit code is shown as [exit N]. Smart punctuation from the iOS keyboard is undone before a line runs, so a long dash typed by the keyboard becomes -- again and curly quotes become straight ones.

The terminal after pytest -q reported 2 passed, with command keys for python, pip, npm, pytest, git and lsA Django development server running in the terminal, with a Django is running banner and an Open site button
pytest in the terminal, and a Django project with its command chips.

Keys, history and Ctrl-C

Above the input line is a row of keys: python, pip, npm, pytest, git and ls type the word and a space; Ctrl-C stops what is running; ↑ steps back through the commands you ran since you opened the panel. While something runs, the field reads Running. Ctrl-C stops it; you can type the next line already and it waits for Return. When a program asks for input(), the prompt changes to > and the line you type goes to the program.

Pipes, redirects and variables

WriteMeans
ls | grep pyA pipe: the first command's output is the second one's input.
pytest && git commit -m ok, a || b, a ; bRun the next command if this one succeeded, if it failed, or either way.
> file, >> file, < fileWrite output to a file, append to it, or read input from it.
2> file, 2>&1, &> fileSend errors to a file, together with the output, or both to a file.
$NAME, ~, *.pyVariables, the home folder and globs expand. export, unset and NAME=value command set variables; $? is the last exit code.

Background jobs (&) and programs that are not built in are not available.

File commands

CommandsNotes
ls, cd, pwd, treels -a shows hidden files, -l sizes and dates.
cat, less, head, tailhead and tail take -n N.
find, stat, du, filefind . -name "*.py", sizes, and what kind of file something is.
touch, mkdir, rm, rmdir, mv, cp, ln, chmodmkdir -p, rm -r, cp -r. rm refuses to delete the project itself.
basename, dirname, realpathParts of paths.
zip, unzip, tar, gzip, gunzipPack and unpack archives.

Text tools

echo, printf, grep, sed, awk, sort, uniq, cut, tr, wc, diff, tee, seq, rev, nl, xargs, base64, sha256sum and md5sum work on files and in pipes, for example:

grep -rn "TODO" . | sort | uniq -c
cut -d, -f1 people.csv | sort | uniq
ls *.py | xargs wc -l

Also there: env, printenv, date, sleep, time, whoami, uname, which, clear and help.

curl and wget

curl URL prints a response and wget URL saves it to a file, so you can try your API or download data. They also reach your own server while it runs, for example curl http://127.0.0.1:8000/api/tasks.

python

python and python3 are the same interpreter, the one inside the app.

Django, Flask and Uvicorn

When a server starts, Pythilo shows it and offers Open site. See Web servers and the preview.

Framework chips

Pythilo looks at the project and puts its framework's commands one tap away, above the terminal and below the output after a run:

Project hasChips
manage.pyDjango: runserver, migrate, makemigrations, createsuperuser, test, check. Commands that need an argument, such as startapp, fill in the line instead of running. After python manage.py lists its commands once, All N commands opens every one, grouped by app.
Flask( in app, main, hello, wsgi, asgi or server.pyFlask: run, routes
FastAPI( or Starlette(Uvicorn: uvicorn main:app
test_*.py or tests/pytest -q
package.jsonNPM: install, and build, dev or start when the project defines them

pip, pytest, sqlite3, git and npm

While a server runs

A server keeps Python busy. If you type a command while a server you started from the terminal is running, Pythilo stops the server, runs the command and starts the server again; the field says Command (restarts the server). If some other program is running, the terminal asks you to stop it first.