Skip to content

Commit 543521e

Browse files
committed
linux primer: start of a quick intro to the linux cmdline
1 parent 7b52175 commit 543521e

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

linux/Introduction.sagews

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
17fa1ee7-9bf7-4723-a5e2-3779f4fbfbd5i︠
2+
%md
3+
Linux Primer
4+
------------
5+
6+
Underneath everything in the Sagemath Cloud sits the free open-source operating system [Linux](http://www.linux.org).
7+
It is a very powerful system which powers everything from smartphones, desktop computers, large servers and supercomputers.
8+
In order to make this power useful, software applications run under your identity and interact with Linux.
9+
For example, they can read files from a storage system, the loaded data in memory can be modified, the
10+
application reacts dynamically to input and finally produces human readable output or stores data back to files.
11+
12+
Most of the time, application interfaces like the very *Sage Worksheet* you are currently viewing is more than enough for your needs.
13+
**But**: There are cases, where you might need a specific task or feature, which you cannot reach from that high level of abstractions.
14+
15+
Hence, the following introduction goes a little bit deeper and explains a few common "*command line utilities*".
16+
They open up a new world, which is much closer to the actual operating system.
17+
This allows for much more flexibility and makes this powerful system more useful for you.
18+
19+
Last words before we start: The following is neither fancy nor new -
20+
it is rather a collection of everyday tools like in a real-world toolbox.
21+
Combined and with some experience, they allow you to accomplish a vast variety of tasks.
22+
23+
Also, don't be scared. Sagemath Cloud's unique snapshot feature can rescue all files that get damaged or dissapear during your explorations ;-)
24+
fd08ba97-b7b3-4c31-abf0-c73ffaa7055f︡{"html":"<h2>Linux Primer</h2>\n\n<p>Underneath everything in the Sagemath Cloud sits the free open-source operating system <a href=\"http://www.linux.org\">Linux</a>.\nIt is a very powerful system which powers everything from smartphones, desktop computers, large servers and supercomputers.\nIn order to make this power useful, software applications run under your identity and interact with Linux.\nFor example, they can read files from a storage system, the loaded data in memory can be modified, the\napplication reacts dynamically to input and finally produces human readable output or stores data back to files.</p>\n\n<p>Most of the time, application interfaces like the very <em>Sage Worksheet</em> you are currently viewing is more than enough for your needs.\n<strong>But</strong>: There are cases, where you might need a specific task or feature, which you cannot reach from that high level of abstractions.</p>\n\n<p>Hence, the following introduction goes a little bit deeper and explains a few common &#8220;<em>command line utilities</em>&#8221;.\nThey open up a new world, which is much closer to the actual operating system.\nThis allows for much more flexibility and makes this powerful system more useful for you.</p>\n\n<p>Last words before we start: The following is neither fancy nor new -\nit is rather a collection of everyday tools like in a real-world toolbox.\nCombined and with some experience, they allow you to accomplish a vast variety of tasks.</p>\n\n<p>Also, don&#8217;t be scared. Sagemath Cloud&#8217;s unique snapshot feature can rescue all files that get damaged or dissapear during your explorations ;-)</p>\n"}︡
25+
58de95cf-7ae9-4f1a-8fab-1af765b89899i︠
26+
%md
27+
### Note
28+
29+
The following examples are in cells that start with **`%sh`**.
30+
That "magic" annotation tells the Sage Notebook to run the content of the cell inside the most famous Linux terminal, called ***bash***.
31+
f7f285d9-dbea-48d2-96c9-81c963b9e81a︡{"html":"<h3>Note</h3>\n\n<p>The following examples are in cells that start with <strong><code>%sh</code></strong>.\nThat &#8220;magic&#8221; annotation tells the Sage Notebook to run the content of the cell inside the most famous Linux terminal, called <strong><em>bash</em></strong>.</p>\n"}︡
32+
59c2161c-0049-4aa5-95a7-71e8925c0ccfi︠
33+
%md
34+
### Your way around the filesystem
35+
36+
A single "*file*" is a stream of data (mathematican's can think of it as a vector of bytes) which has a name, a date and some other properties.
37+
The so called "*file system*" is an organization tool for all these individual files, where files are collected in "*directories*".
38+
All those directories are organized in a hierarchy, where the common topmost ancestor is the `/`.
39+
Therefore, all paths to files start with that slash and the intermediate levels are these directories.
40+
41+
Examples:
42+
43+
* /home/alice/file1
44+
* /etc/fstab
45+
* /usr/bin/bash
46+
04672af5-c988-4fde-9d36-fa51cbb4ac97︡{"html":"<h3>Your way around the filesystem</h3>\n\n<p>A single &#8220;<em>file</em>&#8221; is a stream of data (mathematican&#8217;s can think of it as a vector of bytes) which has a name, a date and some other properties.\nThe so called &#8220;<em>file system</em>&#8221; is an organization tool for all these individual files, where files are collected in &#8220;<em>directories</em>&#8221;.\nAll those directories are organized in a hierarchy, where the common topmost ancestor is the <code>/</code>.\nTherefore, all paths to files start with that slash and the intermediate levels are these directories.</p>\n\n<p>Examples:</p>\n\n<ul>\n<li>/home/alice/file1</li>\n<li>/etc/fstab</li>\n<li>/usr/bin/bash</li>\n</ul>\n"}︡
47+
42d7df3e-7a34-4910-8a84-5ebaaad4c4e1︠
48+
%sh
49+
# lines starting with # are comments, they are ignored but will explain to you what's going on!
50+
# pwd = print working directory
51+
# pwd tells you, where you are.
52+
pwd
53+
1bd3b702-5598-4a07-97c4-22b64f86678d︡{"stdout":"/mnt/home/2Qrdjpk5\n"}︡
54+
adfd0f17-d234-4ebb-bf6f-8f6fd8e5cb2a︠
55+
%md
56+
57+
58+
59+
60+
61+
62+
63+
64+
65+

0 commit comments

Comments
 (0)