Linux 101: Johan Montelius
Linux 101: Johan Montelius
Johan Montelius
KTH
2017
1 / 24
The Unix Family
2 / 24
Even more
You can, but few do, download and compile exactly the components that you
want . . . few people do that.
Supported by Canonical
Based on Debian packages.
Two regular releases a year :04 and
:10
LTS - five year support, released
every second year
Things work and are easy to
maintain.
5 / 24
Ubuntu, Kubuntu, Lubuntu,....
Which version of Ubuntu to choose is very much a choice of desktop
environment.
6 / 24
the elephant in the room
7 / 24
Some basic stuff
the shell
files and directories
some tools: grep, wc, sed . . .
write a thesis: gcc, latex, gnuplot, make
environment variables
8 / 24
the shell
9 / 24
the directory
10 / 24
shell expansions
The shell will expand any input before issuing command.
Some more or less simple ways to explore the content of a text file:
12 / 24
pipes and redirect
The shell can set a file as the standard input of a command or redirect the
standard output and/or standard error.
< as in wc < foo.txt will set standard input.
> as in ls > out.txt will set standard output.
2> as in grep foo bar.txt 2> err.txt will set standard error.
The power of the UNIX shell is the concept of pipes.
Standard output of one command becomes standard input of the next command
13 / 24
an example
Den bok jag nu sätter mig ner att skriva måste verka meningslös på många -
om jag alls vågar tänka mig, att "många" får läsa den - eftersom jag alldeles
självmant, utan någons order, börjar ett sådant arbete och åndå inte själv är
riktigt på det klara med vad avsikten är.
2019 jag
1818 och
1505 att
1429 det
1045 i
979 en
:
14 / 24
from text to frequency list
15 / 24
to write a thesis
16 / 24
gnuplot
gnuplot
17 / 24
LATEX
pdflatex
18 / 24
make
make
19 / 24
shell variables
The shell maintains a set of variables that can be accessed from the shell,
but not immediately from child processes.
20 / 24
the environment
The environment is a set variables that can be accessed by programs using the
standard library function call getenv().
The shell will set up a set of exported variables that will be visible as
environment variables when a child process is created.
Functions from standard library.
export <variable> - make
variable accessible from child getenv() - get the value of
process variable
printenv - list all environment putenv() - set the value of variable
variables execle() - execute command in
env - run command in specified new environment
environment : - there are more
21 / 24
package-configure-make-execute
22 / 24
Summary
23 / 24
Finally
Usage of the shell will be on the exam; best way to study is to use it!
24 / 24