CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/next/pages/features/linux.tsx
Views: 687
1
/*
2
* This file is part of CoCalc: Copyright © 2021 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
import { Layout } from "antd";
7
8
import { Icon } from "@cocalc/frontend/components/icon";
9
import Code from "components/landing/code";
10
import Content from "components/landing/content";
11
import Footer from "components/landing/footer";
12
import Head from "components/landing/head";
13
import Header from "components/landing/header";
14
import Info from "components/landing/info";
15
import Pitch from "components/landing/pitch";
16
import SignIn from "components/landing/sign-in";
17
import Snapshots from "components/landing/snapshots";
18
import A from "components/misc/A";
19
import { Customize } from "lib/customize";
20
import withCustomize from "lib/with-customize";
21
22
import { Paragraph, Title } from "components/misc";
23
import jupyterBash from "public/features/cocalc-jupyter-bash.png";
24
import shellScript from "public/features/cocalc-shell-script-run.png";
25
import terminalCollab from "public/features/cocalc-terminal-collab.gif";
26
import logo from "public/features/linux-logo.svg";
27
import postgres from "public/features/terminal-jupyter-postgresql.png";
28
29
export default function Linux({ customize }) {
30
return (
31
<Customize value={customize}>
32
<Head title="Online Linux Environment" />
33
<Layout>
34
<Header page="features" subPage="linux" runnableTag="term" />
35
<Layout.Content>
36
<Content
37
landing
38
startup={"Linux"}
39
body={logo}
40
title={"Online Linux Environment"}
41
subtitle={
42
"Learn Linux and Bash Scripting without messing up your own computer."
43
}
44
subtitleBelow={true}
45
image={shellScript}
46
alt={"Running a bash script to count in Linux"}
47
/>
48
49
<FullLinuxTerminal />
50
51
<SignIn startup="Linux" />
52
53
<Info
54
title="Realtime collaboration"
55
icon="users"
56
image={terminalCollab}
57
anchor="a-real-time"
58
alt="Video showing using vim collaboratively with chat"
59
>
60
<Paragraph>
61
Terminals in CoCalc are represented by files with the extension{" "}
62
<code>.term</code>. The same terminal can be opened by two or more
63
people simultaneous. Both see the same view, which adaptively
64
resizes to a common size.
65
</Paragraph>
66
<Paragraph>
67
Additionally, you can open a{" "}
68
<A href="https://doc.cocalc.com/chat.html">chat</A> panel to
69
exchange thoughts and ideas.
70
</Paragraph>
71
<Paragraph>
72
This is ideal for getting advice from a colleague or{" "}
73
<A href="https://doc.cocalc.com/teaching-interactions.html">
74
helping one of your students
75
</A>
76
.
77
</Paragraph>
78
</Info>
79
80
<Info.Heading
81
description={
82
<>
83
The following are some additional specific features of Linux
84
Terminals in CoCalc.
85
<br />
86
There is also more{" "}
87
<A href="https://doc.cocalc.com/terminal.html">
88
comprehensive documentation
89
</A>
90
.
91
</>
92
}
93
>
94
Feature Overview
95
</Info.Heading>
96
97
<Info
98
title={
99
<>
100
Run{" "}
101
<A href="https://en.wikipedia.org/wiki/Bash_(Unix_shell)">
102
Bash
103
</A>{" "}
104
scripts
105
</>
106
}
107
icon="terminal"
108
image={shellScript}
109
caption={
110
<>
111
Bash <Code>script.sh</Code> file (left),{" "}
112
<Code>bash -f script.sh</Code> to run (right)
113
</>
114
}
115
anchor="a-shell-script"
116
alt="Running a bash script to count in Linux"
117
>
118
<Paragraph>
119
CoCalc's{" "}
120
<A href="https://doc.cocalc.com/frame-editor.html">code editor</A>{" "}
121
supports{" "}
122
<strong>
123
editing a{" "}
124
<A href="https://www.gnu.org/software/bash/">bash script</A>{" "}
125
side-by-side with a{" "}
126
<A href="https://doc.cocalc.com/terminal.html">terminal</A>
127
</strong>
128
.
129
</Paragraph>
130
<Paragraph>
131
To get started, create a script file ending with <Code>.sh</Code>,
132
for example <Code>script.sh</Code>. Opening that file presents you
133
an editor with <strong>syntax highlighting</strong>. Then click
134
the <Code>Shell</Code> button to open up a Terminal and type in{" "}
135
<Code>{"bash -f script.sh"}</Code> to run your script.
136
</Paragraph>
137
<Paragraph>
138
This helps you learning Bash by exploring its commands directly in
139
your browser and immediately experiencing the results.
140
</Paragraph>
141
</Info>
142
143
<Info
144
title="Jupyter Bash kernel"
145
image={jupyterBash}
146
icon="ipynb"
147
anchor="a-jupyter"
148
alt="Using Bash via a Jupyter notebook"
149
>
150
<Paragraph>
151
Are you looking for something beyond a terminal or editing shell
152
scripts? CoCalc also offers{" "}
153
<strong>
154
<A href="/features/jupyter-notebook">Jupyter Notebooks</A>{" "}
155
running the{" "}
156
<A href="https://github.com/takluyver/bash_kernel">
157
bash kernel
158
</A>
159
</strong>
160
.
161
</Paragraph>
162
<Paragraph>
163
This is similar to working with a terminal, but it saves all the
164
input you typed and the corresponding output in "cells". That
165
helps you with learning Linux commands, because it makes it easier
166
to edit the code input or compare different outcomes of similar
167
code. Besides that, you can also take notes between code cells.
168
</Paragraph>
169
</Info>
170
171
<Snapshots>
172
<Paragraph>
173
The CoCalc terminal is ideal for{" "}
174
<strong>teaching and learning Linux</strong>, because when you
175
make a mistake, it has your back!
176
</Paragraph>
177
<Paragraph>
178
Everything runs remotely on CoCalc's servers. This means you do
179
not have to worry about messing up your own computer, dealing with
180
setup and installation issues yourself, or fear losing or
181
corrupting files on your computer.
182
</Paragraph>
183
</Snapshots>
184
185
<Info
186
title="Databases (PostgreSQL, MySQL, SQLite)"
187
image={postgres}
188
icon="database"
189
anchor="a-database"
190
wide
191
alt="Using a PostgreSQL database via a terminal and a Jupyter notebook"
192
>
193
<Paragraph>
194
<strong>
195
CoCalc supports running various databases inside a project.
196
</strong>{" "}
197
They run in the same protected networking environment as all other
198
processes in a project. This is ideal for{" "}
199
<strong>learning SQL</strong> or{" "}
200
<strong>persistently storing data</strong> as a result of your
201
computations.
202
</Paragraph>
203
<Paragraph>
204
<strong>PostgreSQL</strong>: read{" "}
205
<A href="https://doc.cocalc.com/howto/postgresql.html">
206
our guide
207
</A>{" "}
208
to get started.
209
</Paragraph>
210
<Paragraph>
211
Besides{" "}
212
<A href="https://https://www.postgresql.org/">PostgreSQL</A>,
213
CoCalc also supports <A href="https://www.mysql.com/">MySQL</A>{" "}
214
and <A href="https://sqlite.org">SQLite</A>.
215
</Paragraph>
216
<Paragraph>
217
To interact with the databases, CoCalc{" "}
218
<strong>pre-installs suitable Python and R libraries</strong> for
219
your convenience.
220
</Paragraph>
221
<Paragraph>
222
In the screenshot, you can see how a PostgreSQL database was setup
223
and started in the first terminal. In the second terminal,{" "}
224
<Code>psql</Code> is used to connect to it and create a table and
225
insert data. Finally, the{" "}
226
<A href="/features/jupyter-notebook">Jupyter Notebook</A> on the
227
left connects via the{" "}
228
<A href="http://initd.org/psycopg/docs/">psycopg2</A> library and
229
issues a query to the database!
230
</Paragraph>
231
</Info>
232
<SignIn startup="Linux" />
233
</Layout.Content>
234
<Footer />
235
</Layout>
236
</Customize>
237
);
238
}
239
240
export async function getServerSideProps(context) {
241
return await withCustomize({ context });
242
}
243
244
export function FullLinuxTerminal() {
245
return (
246
<>
247
<Pitch
248
col1={
249
<>
250
<Title level={2}>Full Linux Terminal</Title>
251
<Paragraph>
252
<strong>
253
CoCalc offers a full, collaborative, real-time synchronized{" "}
254
<A href="https://en.wikipedia.org/wiki/Linux">Linux</A>{" "}
255
<A href="https://en.wikipedia.org/wiki/Command-line_interface">
256
Command Line Terminal
257
</A>{" "}
258
in your browser.
259
</strong>
260
</Paragraph>
261
<Paragraph>
262
Take a look at our{" "}
263
<strong>
264
<A href="https://doc.cocalc.com/terminal.html">
265
terminal documentation
266
</A>
267
</strong>{" "}
268
to learn more about it!
269
</Paragraph>
270
<Paragraph>
271
Browse the{" "}
272
<strong>
273
<A href="/software/executables">installed software</A>
274
</strong>{" "}
275
in CoCalc.
276
</Paragraph>
277
<Paragraph>
278
CoCalc is made for{" "}
279
<strong>
280
<A href="/features/teaching">teaching a course</A>
281
</strong>
282
: students just have to sign in to get started!{" "}
283
</Paragraph>
284
</>
285
}
286
col2={
287
<>
288
<Title level={2}>Benefits of working 100% online</Title>
289
<Paragraph>
290
<ul>
291
<li>
292
You no longer have to <strong>install and maintain</strong>{" "}
293
any software.
294
</li>
295
<li>
296
It is possible for multiple people to{" "}
297
<strong>
298
collaboratively use the same terminal in realtime
299
</strong>
300
.
301
</li>
302
<li>You can also edit and run shell script files.</li>
303
<li>
304
Use{" "}
305
<strong>
306
<A href="https://doc.cocalc.com/chat.html">chat</A>
307
</strong>{" "}
308
next to the Terminal to discuss your commands with others.
309
</li>
310
<li>
311
<strong>Automatic backup</strong> keeps your files safe!
312
</li>
313
<li>
314
You can <strong>copy and paste</strong> between your local
315
desktop and the online terminal.
316
</li>
317
</ul>
318
</Paragraph>
319
</>
320
}
321
/>
322
323
<Pitch
324
ext="sh"
325
col1={
326
<>
327
<Title level={2}>
328
<Icon name="user-check" /> What you <strong>can</strong> do ...
329
</Title>
330
<Paragraph>
331
<ul>
332
<li>Learn Bash scripting</li>
333
<li>Learn how to use the Linux command line</li>
334
<li>
335
Run scripts written in{" "}
336
<strong>Python, R, PHP, Ruby, Go, Perl, Nodejs </strong> etc.
337
</li>
338
<li>
339
Compile programs written in{" "}
340
<strong>
341
C/C++, Java, Rust, Assembly, Fortran, Julia, Zig, Haskell,
342
</strong>{" "}
343
etc.
344
</li>
345
<li>Process and store datafiles</li>
346
<li>Collaborate</li>
347
<li>Use graphical X11 applications</li>
348
</ul>
349
</Paragraph>
350
</>
351
}
352
col2={
353
<>
354
<Title level={2}>
355
<Icon name="user-slash" /> ... what you <strong>cannot</strong>{" "}
356
do.
357
</Title>
358
<Paragraph>
359
<ul>
360
<li>
361
<strong>
362
<code>Root</code>
363
</strong>
364
: due to how CoCalc works, you cannot have root rights.
365
However, there is a wealth of software{" "}
366
<A href="/software">already installed</A>, including both
367
system utilities and packages for specific language
368
environments. Regarding Python, R, Nodejs, and Julia
369
environments, you can{" "}
370
<A href="https://doc.cocalc.com/howto/index.html">
371
install additional packages in your project
372
</A>
373
. If something is missing,{" "}
374
<A href="mailto:[email protected]">please tell us</A>.
375
</li>
376
<li>
377
<strong>
378
Communicate with the Internet without buying a license
379
</strong>
380
: if you want to run code to download data from another server
381
or checkout a Git repository – or just want to support CoCalc
382
– you need a{" "}
383
<A href="https://doc.cocalc.com/licenses.html">license</A>{" "}
384
applied to your project. Learn more about the{" "}
385
<A href="https://doc.cocalc.com/trial.html">Trial Projects</A>{" "}
386
that you can use for free.
387
</li>
388
<li>
389
<strong>Port forwards:</strong> you cannot forward arbitrary
390
ports over ssh to your local computer. (You{" "}
391
<strong>CAN</strong>{" "}
392
<A href="https://doc.cocalc.com/project-settings.html#ssh-keys">
393
ssh into your project
394
</A>
395
.)
396
</li>
397
</ul>
398
</Paragraph>
399
</>
400
}
401
/>
402
</>
403
);
404
}
405
406