Run Bash scripts
bash -f script.shto run (right)
To get started, create a script file ending with
.sh, for example
script.sh. Opening that file presents you an editor with syntax highlighting. Then click the
Shell button to open up a Terminal and type in
bash -f to run your script.
This helps you learning Bash by exploring its commands directly in your browser and immediately experiencing the results.
Jupyter Bash kernel
Are you looking for something beyond a terminal or editing shell scripts? CoCalc also offers Jupyter Notebooks running the bash kernel.
This is similar to working with a terminal, but it saves all the input you typed and the corresponding output in "cells". That helps you with learning Linux commands, because it makes it easier to edit the code input or compare different outcomes of similar code. Besides that, you can also take notes between code cells.
The CoCalc terminal is ideal for teaching/learning Linux, because in case you make a mistake it has your back!
Everything runs remotely on CoCalc's servers! This means you do not have to worry about messing up your own computer, deal with setup and installation issues by yourself, or fear of losing or corrupting your own files when you make a mistake.
Snapshots are consistent read-only views of all your files in a CoCalc project. Restore your file(s) by copying back the one(s) that were lost or got corrupted.
Therefore, this is ideal to learn basic shell commands or more about Linux online.
Databases (PostgreSQL, MySQL, SQLite, ...)
CoCalc supports running various databases inside a project. They run in the same protected networking environment as all other processes in a project. This is ideal for learning SQL or persistently storing data as a result of your computations.
PostgreSQL: read the PostgreSQL Setup Guide to get started.
To interact with the databases, CoCalc pre-installs suitable Python and R libraries for your convenience.
In the screenshot on the left, you can see how a PostgreSQL database was setup and started in the first terminal. In the second terminal,
psql is used to connect to it and create a table and insert data. Finally, in the Jupyter Notebook on the left connects via the psycopg2 library and issues a query to the database!