123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331 |
- \documentclass{report}
- \usepackage[T1] {fontenc}
- \usepackage[italian]{babel}
- % Per i link nell'indice
- \usepackage{hyperref}
- \title{OpenLab Virtual 2021}
- \author{Matteo Savatteri}
- \begin{document}
- \maketitle
- \setcounter{page}{2}
- \tableofcontents
- \chapter{GNU/Linux Intro, Tips \& Tricks}
- \section{Introduzione}
- \begin{itemize}
- \item Benvenuto e ringraziamenti ad admin e pubblico
- \item Chi sono?
- \item Cos'è LCM?
- \item Regole conferenza: come interagire
- \item Outline e obbiettivi conferenza:
- \begin{itemize}
- \item Storia di \texttt{GNU/Linux}
- \item \texttt{GNU/Linux} per un fisico
- \item \texttt{GNU/Linux}: nozioni e strumenti importanti
- \item Testimonianze ospiti + domande
- \end{itemize}
- \end{itemize}
- \section{Storia di \texttt{GNU/Linux}}
- \begin{itemize}
- \item \texttt{UNIX}
- \footnote{Video \emph{AT\&T Archives} introduzione a \texttt{UNIX} a
- \url{https://youtu.be/tc4ROCJYbm0}
- }
- (\emph{Uniplexed Information and Computing Service}, "\emph{eunuchs}"),
- '69, Ken Thompson, Dennis Ritchie, Brian Kernighan \& Co., Assembly:
- \begin{itemize}
- \item Filosofia di UNIX:
- \emph{
- "This is the Unix philosophy: Write programs that do one thing
- and do it well. Write programs to work together. Write programs
- to handle text streams, because that is a universal interface."
- }
- - Doug McIlroy
- \item AT\&T, Bell Labs
- \item '69-73, sviluppo del C, K.T. \& D.R. $\rightarrow$ Portabilità
- \item Distribuzione università (es. Berkeley, BSD) $\rightarrow$ Codice aperto
- \item '84 commercializzazione $\rightarrow$ Codice chiuso!
- \item Standard:
- \begin{itemize}
- \item '85 POSIX (Portable Operating System Interface for UNIX), IEEE
- \item '98 SUS (Single UNIX Specification), The Open Group
- \end{itemize}
- \end{itemize}
- \item GNU (\emph{GNU's Not UNIX}), '84, Richard Stallman:
- \begin{itemize}
- \item Sistema operativo Libero (cosa significa?)
- \footnote{Per approfondire vai a https://www.fsf.org/it}
- clone di \texttt{UNIX}
- \item '90 Sviluppo di tutte le componenti del sistema
- \item Esempi software GNU: \texttt{gcc}, \texttt{glibc}, \texttt{bash},
- \texttt{coreutils}, \texttt{GNOME}, etc.
- \item '90 inizia sviluppo \texttt{GNU Hurd}
- \end{itemize}
- \item Digressione su OS:
- \begin{itemize}
- \item OS = Insieme di programmi che consentono all'operatore
- di utilizzare un computer
- \item Kernel = Nucleo dell'OS deputato ad allocare le risorse
- della macchina e altri servizi agli altri programmi
- \end{itemize}
- \item \texttt{Linux}\footnote{Pronuncia del nome \texttt{Linux} a
- \url{https://mirrors.edge.kernel.org/pub/linux/kernel/SillySounds/}
- }
- , '91, Linus Torvalds:
- \begin{itemize}
- \item Progetto personale annunciato su
- \href{https://groups.google.com/g/comp.os.minix/c/dlNtH7RRrGA/m/SwRavCzVE7gJ}{com.os.minix}
- \item Kernel Libero (GNU GPLv2), Monolitico, Modulare, UNIX-like
- \item '92 \texttt{Linux} diventa kernel del sistema \texttt{GNU}
- \item Adozione in ambito commerciale
- \item Prima diffusione in supercomputer (
- \href{https://top500.org/statistics/list/}{Vedi TOP500 OS Family}
- )
- \item Poi leader in ambito server
- \footnote{Guarda ad esempio statistiche su web server a
- \url{https://w3techs.com/technologies/overview/operating_system}
- }
- (in particolare LAMP)
- \item 2000, Linux Foudation $\rightarrow$ LSB (\emph{Linux Standard Base})
- Standardizzazione OS che adottano kernel \texttt{Linux}
- (Da tempo \emph{standard de facto})
- \item Oggi diffuso in dispositivi mobili (\texttt{Android}), embedded
- (router board, wearables) e altre applicazioni (es. \emph{TESLA})
- \item Percentuale diffusione workstation, desktop, laptop e gaming
- (es. Valve Corporation, SteamOS) in crescita
- \end{itemize}
- \item Concetto ed esempi di distribuzione \texttt{GNU/Linux} (Ubuntu, Mint, Fedora, Arch, Gentoo, Debian,
- CentOS, RHEL, SUSE, LFS, OpenWRT, Raspbian); cosa distingue varie distro? $\rightarrow$
- \emph{package manager}, \emph{init system}, configuarzione kernel \texttt{Linux}, etc.
- \end{itemize}
- \section{\texttt{GNU/Linux} per un Fisico}
- Perhé un fisico dovrebbe conoscere ed utilizzare il sistema \texttt{GNU/Linux}?
- \begin{itemize}
- \item Cluster di computer e farm (es.
- \href{https://www.hpc.cineca.it/hardware/marconi}{MARCONI},
- \href{https://www.indaco.unimi.it/}{INDACO},
- \href{https://lcm.mi.infn.it/farm/}{LCM Farm}
- ) nel mondo sono quasi
- interamente costituite da reti di sistemi \texttt{GNU/Linux} (es. CentOS, RHEL, Debian)
- \item Codice libero = adattabilità, trasparenza, riproducibilità, no interessi
- \item Calcolo scientifico ha storia basata su sistemi UNIX-like da decadi
- $\rightarrow$ applicazioni vengono prevalentemente sviluppate su e per
- questa famiglia di sistemi
- \item Tutte le persone dovrebbero usare un OS Libero, per ragioni etiche
- \end{itemize}
- \section{Presentazioni ospiti}
- \begin{itemize}
- \item Ospiti: Zec, Sboz, Blue, Algebrato (?)
- \item 5 min a testa
- \item Domande
- \end{itemize}
- \section{Chiusura}
- \begin{itemize}
- \item Repo dell'\emph{OpenLab}, cosa trovate, licenza
- \item Contatti LCM: sito, gruppo community, mail
- \item Saluti
- \end{itemize}
- \chapter{CLI Essential and Shell Programming}
- \section{Nozioni e Strumenti}
- \subsection{Setup}
- \begin{itemize}
- \item Vedete il terminale?
- \item Il font è abbastanza grande?
- \item Vedete il puntatore?
- \item Non andare troppo veloce
- \item Spiega che tasti premi, se non vengono printati
- \item Non cancellare l'output del terminale
- \end{itemize}
- \subsection{Il concetto di \emph{Shell}}
- \begin{itemize}
- \item \emph{shell} è programma per computer che espone all'utente o ad
- altri programmi i servizi dell'OS
- \item Si chiama così perché è strato più esterno dell'OS
- \item Può essere GUI (es. \texttt{GNOME}, \texttt{KDE}) o \texttt{CLI}
- (es. \texttt{sh}, \texttt{ksh}, \texttt{bash}, \texttt{csh},
- \texttt{csh}, \texttt{COMMAND.COM})
- \item Nel caso di shell CLI $\rightarrow$ \emph{interprete dei comandi}
- \end{itemize}
- \subsection{\emph{Interprete dei Comandi} vs \emph{Emulatore di Terminale}}
- \begin{itemize}
- \item \emph{emulatore di terminale} = GUI che emula una \emph{telescrivente}
- \footnote{Video interessante di \emph{telescrivente} connessa a sistema
- \texttt{GNU/Linux}:
- \url{https://www.youtube.com/watch?v=9TGQ4pnVWSQ}
- }
- \begin{itemize}
- \item Programma \emph{master} che riceve e interpreta le stringhe
- digitate dall'utente alla tastiera, le mostra in una finestra
- grafica e le passa al programma \emph{slave}
- (es. \emph{interprete dei comandi})
- \item Riceve stringhe dal pogramma \emph{slave} e le mostra all'utente
- grazie ad una finestra grafica
- \item Esempi: \texttt{xterm}, \texttt{urxvt}, \texttt{st}
- \item Quando non è un GUI si chiama \emph{console virtuale}
- (es. le \texttt{Linux tty})
- \end{itemize}
- \item \emph{interprete dei comandi} = una shell di tipo CLI
- \begin{itemize}
- \item Programma \emph{slave} che riceve stringhe dal programma
- \emph{master}, le interpreta e chiede a OS di eseguire programmi
- corrispondenti
- \item Può passare stringhe al programma \emph{master} perché vengano
- mostrate a schermo
- \end{itemize}
- \end{itemize}
- \subsection{\texttt{bash}}
- \begin{itemize}
- \item Shell del progetto GNU
- \item \texttt{bash} = \emph{Bourne Again SHell} (Stephen Bourne)
- \item \`E interprete dei comandi e linguaggio di scripting
- \item Se chiamata come \texttt{sh} o con la flag \texttt{--posix}
- comportamento conforme al POSIX (\texttt{sh})
- \item Feature:
- \begin{itemize}
- \item Esecuzione di comandi $\rightarrow$ Se no slash: ricerca
- $\rightarrow$ funzioni, builtin, \texttt{PATH} (\texttt{hash})
- $\rightarrow$ Esecuzione con assegnazione argomenti
- \item Shell scripts
- \item Enviroment (\texttt{export})
- \item Simple commands $\rightarrow$ \emph{``A simple command is a sequence of optional
- variable assignments followed by blank-separated words and redirections,
- and terminated by a control operator.''}
- \item Pipeline $\rightarrow$ \texttt{|}, \texttt{|\&}, \textbf{in subshell}
- \item Liste di comandi $\rightarrow$ \texttt{;}, \texttt{\&}, \texttt{\&\&}, \texttt{||}
- \item Compound commands $\rightarrow$ \texttt{(list)}, \texttt{\{ list; \}}, \texttt{((expression))},
- \texttt{if}, \texttt{for} (due tipi), \texttt{while}, \texttt{until}, \texttt{case}
- \item Shell functions $\rightarrow$ \texttt{fname () compound-command [redirection]}
- \item Coprocesses $\rightarrow$ \texttt{coproc [NAME] command [redirections]}
- \item Commenti $\rightarrow$ \texttt{\#}
- \item Quoting
- \item Parametri $\rightarrow$ \emph{``A parameter is an entity that stores values.''},
- \emph{``A variable is a parameter denoted by a name.''},
- definizione, valutazione, parametri speciali (\texttt{*}, \texttt{@}, \texttt{\#}, \texttt{?},
- \texttt{-},\texttt{\$},\texttt{!} (job), \texttt{0})
- e variabili speciali (in particolare \texttt{PATH}), namerefs (\texttt{declare -n ref=VAR}),
- \texttt{declare} builtin
- \item Array $\rightarrow$ \texttt{name=(value1 ... valuen)}
- \item Espansione $\rightarrow$ brace expansion, tilde expansion,
- parameter and variable expansion, command substitution, arithmetic expansion,
- word splitting, and pathname expansion
- \item Redirezione $\rightarrow$ \texttt{>}, \texttt{>>}, \texttt{<}, nomi file spaciali,
- \emph{Here Documents} \texttt{[n]<<[-]word ... delim}, \emph{Here Strings}
- \texttt{[n] < < < word}, duplicating file descriptors \texttt{[n]>\&word} (analogo
- per input, moving file descriptors \texttt{[n]>\&digit-} (analogo input),
- opening file descriptors for reading and writing \texttt{[n]<>word}.
- \item \texttt{history}
- \item Tab completion
- \item Job control
- \item Builtins (Vedi man page)
- \end{itemize}
- \end{itemize}
- \subsection{Programmi Applicativi di \texttt{UNIX}}
- \subsubsection{Il Comando Più Importante dell'Universo}
- Comando \texttt{man} è più importante universo! \texttt{man man man}!
- Vedi anche \texttt{apropos} o \texttt{man -k}.
- Regole per documentarsi:
- \begin{itemize}
- \item Cercare nelle \emph{man page}, info, \texttt{--help} e solo infine sul web
- \item Cercare \emph{in lingua inglese} $\rightarrow$ \`E la lingua di internet
- e dell'informatica
- \item Cercare sempre dalla documentazione ufficiale $\rightarrow$ Meglio diffidare
- di guide e blog, se possibile.
- (\emph{Chi l'ha scritto, è chi meglio ti può consigliare})
- \item Vai a fondo finché il tempo a tua disposizione te lo permette
- \end{itemize}
- \subsubsection{File System}
- \begin{itemize}
- \item Digressione su VFS: radice, nodi, file regolari, file speciali (?)
- \item \texttt{pwd}
- \item \texttt{touch} $\rightarrow$ Puoi introdurre qui, \texttt{:}
- \item \texttt{cd} $\rightarrow$ No argomento, \texttt{-}
- \item \texttt{ls} $\rightarrow$ \texttt{-l}, \texttt{-a}, \texttt{-t}, \texttt{-r}
- \item \texttt{cat} $\rightarrow$ \texttt{-et}
- \item \texttt{cp} $\rightarrow$ \texttt{-r}, \texttt{dir/.}, \texttt{-}
- \item \texttt{mv} $\rightarrow$ \texttt{-i}
- \item \texttt{unlink}
- \item \texttt{rm} $\rightarrow$ \texttt{-r}, \texttt{-i}, \texttt{-f}
- \item \texttt{mkdir} $\rightarrow$ \texttt{-p}
- \item \texttt{file} $\rightarrow$ \texttt{-l}
- \item \texttt{df} $\rightarrow$ \texttt{-a}, \texttt{-i}, \texttt{-h}
- \item \texttt{du} $\rightarrow$ \texttt{-a}, \texttt{-h}, \texttt{s}
- \item \texttt{find} $\rightarrow$ \texttt{--name}, \texttt{--iname}, combinazione
- con \texttt{xargs}
- \item \texttt{cmp} $\rightarrow$ \texttt{diff}, \texttt{diff3}
- \item \texttt{dd}
- \item \texttt{ln} $\rightarrow$ \texttt{-s}
- \item \texttt{readlink}
- \end{itemize}
- \subsubsection{Text Processing}
- \begin{itemize}
- \item \texttt{cut} $\rightarrow$ \texttt{-f}, \texttt{-d}
- \item \texttt{paste} $\rightarrow$ \texttt{-d}
- \item \texttt{head} $\rightarrow$ \texttt{-N}
- \item \texttt{tail} $\rightarrow$ \texttt{-N}, \texttt{-f}
- \item \texttt{sort} $\rightarrow$ \texttt{-h}, (\texttt{tsort})
- \item \texttt{wc} $\rightarrow$ \texttt{-l}
- \item \texttt{join} $\rightarrow$ ?
- \item \texttt{more}
- \item \texttt{less} $\rightarrow$ keybind \texttt{v}
- \item \texttt{sed} $\rightarrow$ \emph{Stream editor}, \texttt{-i},
- \texttt{s/pat1/pat2/g},
- \texttt{\{N\}d}
- \item \texttt{tr} $\rightarrow$ \texttt{-d}
- \item \texttt{uniq}
- \item \texttt{nl} $\rightarrow$ Numera linee file argomento
- \end{itemize}
- \subsubsection{Misc}
- \begin{itemize}
- \item \texttt{uname} $\rightarrow$ \texttt{-a}
- \item \texttt{date}
- \item \texttt{cal} $\rightarrow$ \texttt{-y}
- \item \texttt{bc}
- \item \texttt{split} $\rightarrow$ \texttt{-b} (bytes)
- \item \texttt{env}
- \item \texttt{grep} $\rightarrow$ \texttt{-c}, \texttt{-v}
- \item \texttt{id}, \texttt{whoami}, \texttt{who}, \texttt{logname}
- \item \texttt{od} $\rightarrow$ \texttt{-a}, \texttt{-x}
- \item \texttt{tty}
- \end{itemize}
- \subsubsection{Shell Porgramming}
- \begin{itemize}
- \item \texttt{echo} $\rightarrow$ \texttt{-e}, \texttt{-n}
- \item \texttt{sleep}
- \item \texttt{tee} $\rightarrow$ \texttt{-a}
- \item \texttt{command}
- \item \texttt{true}
- \item \texttt{false}
- \end{itemize}
- \section{Chiusura}
- \begin{itemize}
- \item Repo dell'\emph{OpenLab}, cosa trovate, licenza
- \item Contatti LCM: sito, gruppo community, mail
- \item Saluti
- \end{itemize}
- \end{document}
|