CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
JupyterJuliaLaTeXLinuxOctavePythonR StatsSageMathSlidesTeachingTerminalWhiteboardX11ComputeAI AssistantCompareAPI
CoCalc Logo Icon
JupyterJuliaLaTeXLinuxOctavePythonR StatsSageMathSlidesTeachingTerminalWhiteboardX11ComputeAI AssistantCompareAPI
Online Linux Environment logo

Online Linux Environment

Running a bash script to count in Linux

Learn Linux and Bash Scripting without messing up your own computer.

Full Linux Terminal

CoCalc offers a full, collaborative, real-time synchronized Linux Command Line Terminal in your browser.
Take a look at our terminal documentation to learn more about it!
Browse the installed software in CoCalc.
CoCalc is made for teaching a course: students just have to sign in to get started!

Benefits of working 100% online

  • You no longer have to install and maintain any software.
  • It is possible for multiple people to collaboratively use the same terminal in realtime.
  • You can also edit and run shell script files.
  • Use chat next to the Terminal to discuss your commands with others.
  • Automatic backup keeps your files safe!
  • You can copy and paste between your local desktop and the online terminal.

What you can do ...

  • Learn Bash scripting
  • Learn how to use the Linux command line
  • Run scripts written in Python, R, PHP, Ruby, Go, Perl, Nodejs etc.
  • Compile programs written in C/C++, Java, Rust, Assembly, Fortran, Julia, Zig, Haskell, etc.
  • Process and store datafiles
  • Collaborate
  • Use graphical X11 applications

... what you cannot do.

  • Root: due to how CoCalc works, you cannot have root rights. However, there is a wealth of software already installed, including both system utilities and packages for specific language environments. Regarding Python, R, Nodejs, and Julia environments, you can install additional packages in your project. If something is missing, please tell us.
  • Communicate with the Internet without buying a license: if you want to run code to download data from another server or checkout a Git repository – or just want to support CoCalc – you need a license applied to your project. Learn more about the Trial Projects that you can use for free.
  • Port forwards: you cannot forward arbitrary ports over ssh to your local computer. (You CAN ssh into your project.)
Ready out of the box: Sign up, create a project, create or upload your *.sh file, and you're ready to go!
Start free today. Upgrade later.

Realtime collaboration

Video showing using vim collaboratively with chat
Terminals in CoCalc are represented by files with the extension .term. The same terminal can be opened by two or more people simultaneous. Both see the same view, which adaptively resizes to a common size.
Additionally, you can open a chat panel to exchange thoughts and ideas.
This is ideal for getting advice from a colleague or helping one of your students.

Feature Overview

The following are some additional specific features of Linux Terminals in CoCalc.
There is also more comprehensive documentation.

Run Bash scripts

Running a bash script to count in Linux


Bash script.sh file (left), bash -f script.sh to run (right)
CoCalc's code editor supports editing a bash script side-by-side with a terminal.
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 script.sh 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

Using Bash via a Jupyter notebook
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.

Snapshot backups

Browsing filesystem snapshots in a CoCalc project
Snapshots are consistent read-only views of all your files in a CoCalc project. You can restore your files by copying back any that you accidentally deleted or corrupted.
The CoCalc terminal is ideal for teaching and learning Linux, because when 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, dealing with setup and installation issues yourself, or fear losing or corrupting files on your computer.

Databases (PostgreSQL, MySQL, SQLite)

Using a PostgreSQL database via a terminal and a Jupyter notebook
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 our guide to get started.
Besides PostgreSQL, CoCalc also supports MySQL and SQLite.
To interact with the databases, CoCalc pre-installs suitable Python and R libraries for your convenience.
In the screenshot, 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, the Jupyter Notebook on the left connects via the psycopg2 library and issues a query to the database!
Start free today. Upgrade later.