Skip to content

The terminal ​

The terminal is in the bottom panel. You type commands there instead of clicking: this is how developers work, and a skill to learn step by step.

The terminal after a few commands: cat, python main.py, git status

A terminal for learning

It is not a real shell (bash), but an emulator of the basic commands, with their usual syntax and messages. It acts on the files of your project, and only on them.

The basics ​

  • The workspace (main) $ prompt shows the current folder (workspace is the root of the project) and, in brackets, the Git branch.
  • Enter runs the command. ↑ and ↓ bring back the previous commands.
  • Tab completes the name of a command or a file: type cat to then Tab, and the terminal writes cat tools.py.
  • Ctrl+C stops the running command (a Python program that does not end) or clears the line.
  • help lists all the commands; clear clears the screen.
  • To leave the field with the keyboard: Esc, then Tab.

The + button of the panel opens another terminal, with its own current folder and its own history.

Moving around and looking ​

CommandEffect
pwdShows the current folder
ls, ls -la, ls -lh, ls -1Lists the files (-a: hidden files included, -l: in detail)
cd folder, cd .., cd -, cd ~Changes folder (parent, previous, root of the project)
tree, tree -aShows the tree
cat file, cat -n fileShows a file (-n: numbered lines)
head -n 5 file, tail -n 5 fileFirst or last lines (10 by default)
grep pattern files, grep -i -n …Searches for text (-i: ignore case, -n: line numbers)
wc file, wc -l, -w, -cCounts lines, words, characters
stat fileSize, type, modification date

Creating, copying, moving, deleting ​

CommandEffect
touch notes.txtCreates an empty file
mkdir folder, mkdir -p a/b/cCreates a folder (-p: with its parents)
cp source destination, cp -rCopies a file (-r: a folder)
mv source destinationMoves or renames
rm file, rm -r folderDeletes (-r: a folder and its content)
rmdir folderDeletes an empty folder

No trash can

rm deletes for good. If the file was saved in a commit, Git can bring it back (git restore file).

The explorer and the editor follow everything the terminal does: a new file appears in the tree right away.

Redirecting the output ​

SyntaxEffect
command > fileWrites what the command prints into the file (replacing it)
command >> fileAppends it to the end of the file

For example echo "# My project" > README.md, or python main.py > results.txt to keep the output of a program.

Python in the terminal ​

CommandEffect
python main.pyRuns a script, like a program started by a developer
python main.py arg1 arg2With arguments, read by the program in sys.argv
python -c "print(6 * 7)"Runs one line of code
python -m packageRuns a module or a package (__main__.py)
pythonOpens the interactive Python console of the panel
python -V, python -hVersion, help
pip install package, pip listInstalls a library, lists the installed ones

Each python … starts a fresh interpreter, with the files of the project up to date, like a real program. Its drawings and charts appear in a Graphics output console. The current folder of the terminal is the program's: after cd data, open("grades.csv") finds the file.

Git in the terminal ​

git accepts the common commands: status, add, commit, log, diff, show, branch, switch, checkout, merge, restore, reset, tag, init. git --help lists them with their options. See Git.

Other commands ​

echo text, history, whoami, date, uname.