Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/src/packages/next/pages/features/linux.tsx
Views: 687
/*1* This file is part of CoCalc: Copyright © 2021 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45import { Layout } from "antd";67import { Icon } from "@cocalc/frontend/components/icon";8import Code from "components/landing/code";9import Content from "components/landing/content";10import Footer from "components/landing/footer";11import Head from "components/landing/head";12import Header from "components/landing/header";13import Info from "components/landing/info";14import Pitch from "components/landing/pitch";15import SignIn from "components/landing/sign-in";16import Snapshots from "components/landing/snapshots";17import A from "components/misc/A";18import { Customize } from "lib/customize";19import withCustomize from "lib/with-customize";2021import { Paragraph, Title } from "components/misc";22import jupyterBash from "public/features/cocalc-jupyter-bash.png";23import shellScript from "public/features/cocalc-shell-script-run.png";24import terminalCollab from "public/features/cocalc-terminal-collab.gif";25import logo from "public/features/linux-logo.svg";26import postgres from "public/features/terminal-jupyter-postgresql.png";2728export default function Linux({ customize }) {29return (30<Customize value={customize}>31<Head title="Online Linux Environment" />32<Layout>33<Header page="features" subPage="linux" runnableTag="term" />34<Layout.Content>35<Content36landing37startup={"Linux"}38body={logo}39title={"Online Linux Environment"}40subtitle={41"Learn Linux and Bash Scripting without messing up your own computer."42}43subtitleBelow={true}44image={shellScript}45alt={"Running a bash script to count in Linux"}46/>4748<FullLinuxTerminal />4950<SignIn startup="Linux" />5152<Info53title="Realtime collaboration"54icon="users"55image={terminalCollab}56anchor="a-real-time"57alt="Video showing using vim collaboratively with chat"58>59<Paragraph>60Terminals in CoCalc are represented by files with the extension{" "}61<code>.term</code>. The same terminal can be opened by two or more62people simultaneous. Both see the same view, which adaptively63resizes to a common size.64</Paragraph>65<Paragraph>66Additionally, you can open a{" "}67<A href="https://doc.cocalc.com/chat.html">chat</A> panel to68exchange thoughts and ideas.69</Paragraph>70<Paragraph>71This is ideal for getting advice from a colleague or{" "}72<A href="https://doc.cocalc.com/teaching-interactions.html">73helping one of your students74</A>75.76</Paragraph>77</Info>7879<Info.Heading80description={81<>82The following are some additional specific features of Linux83Terminals in CoCalc.84<br />85There is also more{" "}86<A href="https://doc.cocalc.com/terminal.html">87comprehensive documentation88</A>89.90</>91}92>93Feature Overview94</Info.Heading>9596<Info97title={98<>99Run{" "}100<A href="https://en.wikipedia.org/wiki/Bash_(Unix_shell)">101Bash102</A>{" "}103scripts104</>105}106icon="terminal"107image={shellScript}108caption={109<>110Bash <Code>script.sh</Code> file (left),{" "}111<Code>bash -f script.sh</Code> to run (right)112</>113}114anchor="a-shell-script"115alt="Running a bash script to count in Linux"116>117<Paragraph>118CoCalc's{" "}119<A href="https://doc.cocalc.com/frame-editor.html">code editor</A>{" "}120supports{" "}121<strong>122editing a{" "}123<A href="https://www.gnu.org/software/bash/">bash script</A>{" "}124side-by-side with a{" "}125<A href="https://doc.cocalc.com/terminal.html">terminal</A>126</strong>127.128</Paragraph>129<Paragraph>130To get started, create a script file ending with <Code>.sh</Code>,131for example <Code>script.sh</Code>. Opening that file presents you132an editor with <strong>syntax highlighting</strong>. Then click133the <Code>Shell</Code> button to open up a Terminal and type in{" "}134<Code>{"bash -f script.sh"}</Code> to run your script.135</Paragraph>136<Paragraph>137This helps you learning Bash by exploring its commands directly in138your browser and immediately experiencing the results.139</Paragraph>140</Info>141142<Info143title="Jupyter Bash kernel"144image={jupyterBash}145icon="ipynb"146anchor="a-jupyter"147alt="Using Bash via a Jupyter notebook"148>149<Paragraph>150Are you looking for something beyond a terminal or editing shell151scripts? CoCalc also offers{" "}152<strong>153<A href="/features/jupyter-notebook">Jupyter Notebooks</A>{" "}154running the{" "}155<A href="https://github.com/takluyver/bash_kernel">156bash kernel157</A>158</strong>159.160</Paragraph>161<Paragraph>162This is similar to working with a terminal, but it saves all the163input you typed and the corresponding output in "cells". That164helps you with learning Linux commands, because it makes it easier165to edit the code input or compare different outcomes of similar166code. Besides that, you can also take notes between code cells.167</Paragraph>168</Info>169170<Snapshots>171<Paragraph>172The CoCalc terminal is ideal for{" "}173<strong>teaching and learning Linux</strong>, because when you174make a mistake, it has your back!175</Paragraph>176<Paragraph>177Everything runs remotely on CoCalc's servers. This means you do178not have to worry about messing up your own computer, dealing with179setup and installation issues yourself, or fear losing or180corrupting files on your computer.181</Paragraph>182</Snapshots>183184<Info185title="Databases (PostgreSQL, MySQL, SQLite)"186image={postgres}187icon="database"188anchor="a-database"189wide190alt="Using a PostgreSQL database via a terminal and a Jupyter notebook"191>192<Paragraph>193<strong>194CoCalc supports running various databases inside a project.195</strong>{" "}196They run in the same protected networking environment as all other197processes in a project. This is ideal for{" "}198<strong>learning SQL</strong> or{" "}199<strong>persistently storing data</strong> as a result of your200computations.201</Paragraph>202<Paragraph>203<strong>PostgreSQL</strong>: read{" "}204<A href="https://doc.cocalc.com/howto/postgresql.html">205our guide206</A>{" "}207to get started.208</Paragraph>209<Paragraph>210Besides{" "}211<A href="https://https://www.postgresql.org/">PostgreSQL</A>,212CoCalc also supports <A href="https://www.mysql.com/">MySQL</A>{" "}213and <A href="https://sqlite.org">SQLite</A>.214</Paragraph>215<Paragraph>216To interact with the databases, CoCalc{" "}217<strong>pre-installs suitable Python and R libraries</strong> for218your convenience.219</Paragraph>220<Paragraph>221In the screenshot, you can see how a PostgreSQL database was setup222and started in the first terminal. In the second terminal,{" "}223<Code>psql</Code> is used to connect to it and create a table and224insert data. Finally, the{" "}225<A href="/features/jupyter-notebook">Jupyter Notebook</A> on the226left connects via the{" "}227<A href="http://initd.org/psycopg/docs/">psycopg2</A> library and228issues a query to the database!229</Paragraph>230</Info>231<SignIn startup="Linux" />232</Layout.Content>233<Footer />234</Layout>235</Customize>236);237}238239export async function getServerSideProps(context) {240return await withCustomize({ context });241}242243export function FullLinuxTerminal() {244return (245<>246<Pitch247col1={248<>249<Title level={2}>Full Linux Terminal</Title>250<Paragraph>251<strong>252CoCalc offers a full, collaborative, real-time synchronized{" "}253<A href="https://en.wikipedia.org/wiki/Linux">Linux</A>{" "}254<A href="https://en.wikipedia.org/wiki/Command-line_interface">255Command Line Terminal256</A>{" "}257in your browser.258</strong>259</Paragraph>260<Paragraph>261Take a look at our{" "}262<strong>263<A href="https://doc.cocalc.com/terminal.html">264terminal documentation265</A>266</strong>{" "}267to learn more about it!268</Paragraph>269<Paragraph>270Browse the{" "}271<strong>272<A href="/software/executables">installed software</A>273</strong>{" "}274in CoCalc.275</Paragraph>276<Paragraph>277CoCalc is made for{" "}278<strong>279<A href="/features/teaching">teaching a course</A>280</strong>281: students just have to sign in to get started!{" "}282</Paragraph>283</>284}285col2={286<>287<Title level={2}>Benefits of working 100% online</Title>288<Paragraph>289<ul>290<li>291You no longer have to <strong>install and maintain</strong>{" "}292any software.293</li>294<li>295It is possible for multiple people to{" "}296<strong>297collaboratively use the same terminal in realtime298</strong>299.300</li>301<li>You can also edit and run shell script files.</li>302<li>303Use{" "}304<strong>305<A href="https://doc.cocalc.com/chat.html">chat</A>306</strong>{" "}307next to the Terminal to discuss your commands with others.308</li>309<li>310<strong>Automatic backup</strong> keeps your files safe!311</li>312<li>313You can <strong>copy and paste</strong> between your local314desktop and the online terminal.315</li>316</ul>317</Paragraph>318</>319}320/>321322<Pitch323ext="sh"324col1={325<>326<Title level={2}>327<Icon name="user-check" /> What you <strong>can</strong> do ...328</Title>329<Paragraph>330<ul>331<li>Learn Bash scripting</li>332<li>Learn how to use the Linux command line</li>333<li>334Run scripts written in{" "}335<strong>Python, R, PHP, Ruby, Go, Perl, Nodejs </strong> etc.336</li>337<li>338Compile programs written in{" "}339<strong>340C/C++, Java, Rust, Assembly, Fortran, Julia, Zig, Haskell,341</strong>{" "}342etc.343</li>344<li>Process and store datafiles</li>345<li>Collaborate</li>346<li>Use graphical X11 applications</li>347</ul>348</Paragraph>349</>350}351col2={352<>353<Title level={2}>354<Icon name="user-slash" /> ... what you <strong>cannot</strong>{" "}355do.356</Title>357<Paragraph>358<ul>359<li>360<strong>361<code>Root</code>362</strong>363: due to how CoCalc works, you cannot have root rights.364However, there is a wealth of software{" "}365<A href="/software">already installed</A>, including both366system utilities and packages for specific language367environments. Regarding Python, R, Nodejs, and Julia368environments, you can{" "}369<A href="https://doc.cocalc.com/howto/index.html">370install additional packages in your project371</A>372. If something is missing,{" "}373<A href="mailto:[email protected]">please tell us</A>.374</li>375<li>376<strong>377Communicate with the Internet without buying a license378</strong>379: if you want to run code to download data from another server380or checkout a Git repository – or just want to support CoCalc381– you need a{" "}382<A href="https://doc.cocalc.com/licenses.html">license</A>{" "}383applied to your project. Learn more about the{" "}384<A href="https://doc.cocalc.com/trial.html">Trial Projects</A>{" "}385that you can use for free.386</li>387<li>388<strong>Port forwards:</strong> you cannot forward arbitrary389ports over ssh to your local computer. (You{" "}390<strong>CAN</strong>{" "}391<A href="https://doc.cocalc.com/project-settings.html#ssh-keys">392ssh into your project393</A>394.)395</li>396</ul>397</Paragraph>398</>399}400/>401</>402);403}404405406