You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: presentation/linux_bash_metacentrum_course.tex
+27-20Lines changed: 27 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -470,7 +470,7 @@ \subsection{Choose one}
470
470
\begin{itemize}
471
471
\item If you can use whole disk, just boot from CD/USB and click \enquote{Next}\ldots
472
472
\item If you don't have whole disk, you need at least one (commonly more) disk partition(s) --- if you don't know how to manage them, ask someone skilled\ldots
473
-
\item Major updates of Windows 10 or Windows reinstall use to destroy bootloader and it is not possible to start Linux anymore (although it can be usually easily fixed)
473
+
\item Major updates of Windows 10/11 or Windows reinstall use to destroy bootloader and it is not possible to start Linux anymore (although it can be usually easily fixed)
474
474
\end{itemize}
475
475
\item Live CD/USB
476
476
\begin{itemize}
@@ -561,7 +561,7 @@ \subsection{Disks and file systems}
561
561
exFAT & 255 & ? & No limit defined & 16 EiB & 64 ZiB & Any\\
ext4 & 255 & Any, not / & No limit defined & 16 TiB & 1 EiB & Linux (UN*X)\\
564
+
ext4 & 255 & Any, not \texttt{/} & No limit defined & 16 TiB & 1 EiB & Linux (UN*X)\\
565
565
XFS & 255 & Any & No limit defined & 9 EiB & 9 EiB & Linux (UN*X)\\
566
566
Btrfs & 255 & Any & No limit defined & 16 EiB & 16 EiB & Linux (only?)\\
567
567
ZFS & 255 & Unicode & No limit defined & 16 EiB & 256 ZiB & UN*X
@@ -572,7 +572,7 @@ \subsection{Disks and file systems}
572
572
\item FAT32 (including extensions) is old-fashioned and not reliable FS, but still common in various flash disks and memory cards
573
573
\item NTFS (basic Windows FS) and FAT do not support UNIX permissions, so they can't be used as system partition in Linux; see also \href{https://en.wikipedia.org/wiki/Comparison_of_file_systems}{full comparison}
574
574
\item Btrfs, ext4, XFS and ZFS are not accessible from Windows at all (Linux mainly uses ext4)
575
-
\item Btrfs, XFS and ZFS are the most advanced FS in common use
575
+
\item Btrfs and ZFS are the most advanced FS in common use
576
576
\end{itemize}
577
577
\end{frame}
578
578
@@ -995,7 +995,7 @@ \subsection{Permissions}
995
995
\item\alert{When in use, \enquote{basic} tools listing permissions (e.g. \texttt{ls -l}, ACL in use is marked by \texttt{+} after permissions --- next slide) sometimes do not show correct result and permissions may work unexpectedly}
996
996
\item Important especially in network environment with many users
997
997
\item If intensively used, \texttt{ls -l} sometimes doesn't show correct permissions (see next slide), it can be confusing and lead into various issues
998
-
\item If not in use on server (like e.g. on CESNET data storage in Ostrava, \texttt{du4.cesnet.cz}), relatively high number of groups is required to be able to correctly setup sharing permissions
998
+
\item If not in use on a~server, relatively high number of groups is required to be able to correctly setup sharing permissions
999
999
\item MetaCentrum has storages and clusters connected via NFSv4 protocol (see also slide~\ref{netfs}) --- commands \texttt{getfacl} and \texttt{setfacl} do not work there, use \texttt{nfs4\_getfacl}, \texttt{nfs4\_setfacl} and \texttt{nfs4\_editfacl} instead (usage is very similar), see also \href{https://wiki.metacentrum.cz/wiki/Access_Control_Lists_on_NFSv4}{old MetaCentrum wiki}
1000
1000
\item Permissions (\enquote{classical} as well as ACL) require some time to practice and master it\ldots
1001
1001
\end{itemize}
@@ -1342,7 +1342,7 @@ \subsection{BASH}
1342
1342
\item\texttt{$\sim$/.bash\_profile} --- Used specifically (not in every system) when user is using remote connection (e.g. SSH) --- user can have different settings for local and remote work
1343
1343
\item\texttt{/etc/profile} --- System wide profile file --- can be overridden by user's configuration
1344
1344
\item\texttt{$\sim$/.profile} --- Settings loaded when user logs-in (mainly for language settings), sometimes used by remote connections
1345
-
\item\alert{Note:} BASH scripts are non-interactive shells --- they do not read settings above --- there are no aliases etc., but they inherit some settings (PATH, language,~\ldots) and they can read global (not local) variables
1345
+
\item\alert{Note:} BASH \textbf{scripts} are non-interactive shells --- they do not read settings above --- there are no aliases etc., but they inherit some settings (PATH, language,~\ldots) and they can read global (not local) variables
1346
1346
\end{itemize}
1347
1347
\end{frame}
1348
1348
@@ -1490,7 +1490,7 @@ \subsection{Directories}
1490
1490
\item Create other directory, see it and then remove (\texttt{rmdir}).
1491
1491
\item Can you access directories of another users? Why? If yes, what are your permissions there? Explain it.
1492
1492
\item What are some permissions in \texttt{/}? Why?
1493
-
\item Define some alias (by running \texttt{alias} command, not by edit of \texttt{$\sim$/.bashrc}) and use it.
1493
+
\item Define some alias (by running \texttt{alias} command, or edit \texttt{$\sim$/.bashrc} and reload it) and use them.
1494
1494
\item Create directory in your home directory and share it with another user so she/he can write there anything (using e.g. \texttt{touch somefile} or \texttt{mkdir somedirectory}) (work e.g. in pairs). Use everywhere as restricted permissions as possible. Can you figure out solution with or without ACL (slide~\ref{acl})?
1495
1495
\item Practice moving between \texttt{/srv/scripts\_data} and your home directory. Use \texttt{cd} and \texttt{TAB}.
1496
1496
\item Within \texttt{/srv/scripts\_data} list by single command only \texttt{jpg} and \texttt{txt} files.
@@ -1584,7 +1584,7 @@ \subsection{Searching}
1584
1584
\begin{itemize}
1585
1585
\item All following arguments are argument of the command until \enquote{\texttt{;}} is encountered
1586
1586
\item\texttt{'\{\}'} is replaced by the current file name being processed
1587
-
\item Those constructs might require protection by escape (\enquote{\textbackslash}) or quotes not to be expanded by shell
1587
+
\item Those constructs might require protection by escape (\enquote{\texttt{\textbackslash}}) or quotes not to be expanded by shell
1588
1588
\end{itemize}
1589
1589
\end{itemize}
1590
1590
\end{frame}
@@ -2230,7 +2230,7 @@ \subsection{Network}
2230
2230
\item SAMBA --- UNIX connection to Microsoft network shares (port 5445), slide~\ref{netfs}
2231
2231
\item web --- \enquote{The Internet} for most of users (port 80 or encrypted 443)
2232
2232
\item IMAP (port 143 or 993) and SMTP (port 25 or 465) to connect to e-mail server and send mails
2233
-
\item Messaging protocols like XMPP (Jabber and derived services like Google Talk or Facebook Messenger), IRC, ICQ, Skype,~\ldots
2233
+
\item Messaging protocols like XMPP (Jabber), IRC, ICQ, MS Teams, Slack, Skype,~\ldots
2234
2234
\item Databases (if accessible over the Internet), and another special services, use to be available on dedicated ports
2235
2235
\item And much more (see \texttt{/etc/services})\ldots
2236
2236
\item Port number can be changed in configuration of respective server service
@@ -2784,8 +2784,8 @@ \subsection{Extractions}
2784
2784
2785
2785
\begin{frame}[fragile]{Examples of usage of head, grep and cut with our data II}
2786
2786
\begin{bashcode}
2787
-
# Extract from FASTA only sequences (discard sequence names) into seq.txt
# Apply the patch - xxx_file_1.txt is patched according to xxx_file_2.txt
3161
3162
patch < difference.diff # or
@@ -3203,7 +3204,7 @@ \subsection{Editors}
3203
3204
\end{itemize}
3204
3205
\item The most common (but very complex and specific) is \textbf{Vim}
3205
3206
\begin{itemize}
3206
-
\item See \url{https://vim-adventures.com/} to play a~game and learn Vim
3207
+
\item See \url{https://vim-adventures.com/} to play a~game and learn Vim (and derivatives)
3207
3208
\end{itemize}
3208
3209
\item\textbf{Emacs} and \textbf{Vim} have huge number of possibilities and support for plugins and scripts, but completely different usage style --- one person can really learn only one\ldots
3209
3210
\item If regularly working in command line, master any command line editor
\item Common way for simple scripts --- check input and do something with single input file
3875
3876
\item Note lines 4 and 5 above --- common way to report success as well as handle failure
3877
+
\item Possibly add extra variables describing what to do with input data (e.g. slide~\ref{metacentrumscript})
3876
3878
\end{itemize}
3877
3879
\vfill
3878
3880
\begin{bashcode}
@@ -4088,7 +4090,7 @@ \subsection{Loops}
4088
4090
# whatever reason 'for' loop construction is impractical)
4089
4091
while read TEXTLINE; do # Run loops on every line of text file
4090
4092
commands... # TEXTLINE contains in each turn one line of the file
4091
-
done < text_file_to_process.txt
4093
+
done < text_file_to_process.txt # Commonly list of input data files
4092
4094
# Infinite loops - common when waiting for some condition to proceed
4093
4095
while :; do echo "Press CTRL+C to exit..."; done
4094
4096
for (( ; ; )) ; do echo "Press CTRL+C to exit..."; done
@@ -4327,7 +4329,7 @@ \subsection{Compilation}
4327
4329
\begin{itemize}
4328
4330
\item Available from \url{https://github.com/stamatak/standard-RAxML}
4329
4331
\item Before compilation check \href{https://github.com/stamatak/standard-RAxML/blob/master/README.md}{README}
4330
-
\item This example does not require to run \texttt{make install}, it does not have extra dependencies for compilation, it requires specifying of particular source file by \texttt{make~-f} (there are multiple \texttt{GCC} files, no one main)
4332
+
\item This example does not require to run \texttt{make install}, it does not have extra dependencies for compilation, it requires specifying of particular source file by \texttt{make~-f} (there are multiple \texttt{GCC} files, not just one main)
4331
4333
\end{itemize}
4332
4334
\begin{bashcode}
4333
4335
mkdir raxml # Create working directory
@@ -4616,6 +4618,7 @@ \subsection{Usage}
4616
4618
\subsection{Tasks}
4617
4619
4618
4620
\begin{frame}[fragile]{Basic skeleton of script running tasks I} % TODO Check usage of trap.
4621
+
\label{metacentrumscript}
4619
4622
\begin{bashcode}
4620
4623
#!/bin/bash
4621
4624
# Modify the script according to your needs!
@@ -4777,7 +4780,7 @@ \subsection{Tasks}
4777
4780
# Go to SCRATCH directory
4778
4781
cd SCRATCHDIR # e.g. /scratch/USER/job_12345678.meta-pbs.metacentrum.cz/
4779
4782
# There are working data of currently running task...
4780
-
# Check whatever you need...
4783
+
# Check whatever you need... Press Ctrl+D to logout
4781
4784
\end{bashcode}
4782
4785
\end{frame}
4783
4786
@@ -5138,9 +5141,13 @@ \subsection{Git basics} % TODO Bit reorder commands so it is more fluent.
5138
5141
5139
5142
\subsection{}
5140
5143
5141
-
\begin{frame}{Git tasks} % TODO Make clear they work from their notebooks.
.cz/restio/dadaism.git # It is one long line (no space after .cas)
5148
+
\end{bashcode}
5142
5149
\begin{enumerate}
5143
-
\item Clone over SSH repository \texttt{[email protected]:/srv/dadaism} (use your credentials on the testing server) and go to \texttt{dadaism} directory.
5150
+
\item Clone the repository using access token (see above) and go to the\texttt{dadaism} directory.
5144
5151
\item Communicate with others to avoid conflicting edits.
5145
5152
\item Add some text files, edit existing text files. Do not add images or another non-text files, do not add large files.
5146
5153
\item Push your changes back to the repository.
@@ -5273,7 +5280,7 @@ \subsection{Resources}
5273
5280
\item Very good to improve code and fixing non-working code
5274
5281
\item Can well explain existing code --- good starting point
5275
5282
\item Good for adaptation of existing code for user's needs
5276
-
\item Limited usage to generate new code --- can misunderstand request, code can be technically wrong, but not well working, can be incomplete or limited in corner-cases
5283
+
\item Limited usage to generate new code --- can misunderstand request, code can be technically correct, but not well working, can be incomplete or limited in corner-cases
5277
5284
\item Without at least basic understanding of subject it is hard to realize if ChatGPT solution is correct --- user should be at least basically able to work without AI, otherwise there is high risk of failures
5278
5285
\item\alert{One should never rely on tool with unclear functionality and problematic usage of of users' data and copyrighted content}
0 commit comments