Use of Linux Command Line Not Only for CESNET's Metacentrum
Total Page:16
File Type:pdf, Size:1020Kb
Introduction Linux UN*X Command line Text Scripting Software MetaCentrum Git Administration The End Linux, command line & MetaCentrum Use of Linux command line not only for CESNET’s MetaCentrum Vojtěch Zeisek Department of Botany, Faculty of Science, Charles University, Prague Institute of Botany, Czech Academy of Sciences, Průhonice https://trapa.cz/, [email protected] January 29 to 31, 2019 . Vojtěch Zeisek (https://trapa.cz/) Linux, command line & MetaCentrum January 29 to 31, 2019 1 / 260 Introduction Linux UN*X Command line Text Scripting Software MetaCentrum Git Administration The End Outline I 1 Introduction Learning machine What it is a “UNIX” Licenses and money 2 Linux Choose one Differences 3 UN*X Disks and file systems Types of users Files and directories Permissions Text 4 Command line . SSH — secure shell and screen . Vojtěch Zeisek (https://trapa.cz/) Linux, command line & MetaCentrum January 29 to 31, 2019 2 / 260 Introduction Linux UN*X Command line Text Scripting Software MetaCentrum Git Administration The End Outline II BASH and others Directories Archives Searching Variables Input, output and their redirecting Information and processes Network Parallelisation Timing 5 Text Reading Extractions AWK Manipulations . Vojtěch Zeisek (https://trapa.cz/) Linux, command line & MetaCentrum January 29 to 31, 2019 3 / 260 Introduction Linux UN*X Command line Text Scripting Software MetaCentrum Git Administration The End Outline III Comparisons Editors Regular expressions 6 Scripting Basic skeleton BASH variables Functions Reading variables Branching the code Loops 7 Software Packages Compilation Java Windows applications . Vojtěch Zeisek (https://trapa.cz/) Linux, command line & MetaCentrum January 29 to 31, 2019 4 / 260 Introduction Linux UN*X Command line Text Scripting Software MetaCentrum Git Administration The End Outline IV 8 MetaCentrum Information Usage Tasks Graphical connection Data storage 9 Git 10 Administration System services 11 The End Resources The very end . Vojtěch Zeisek (https://trapa.cz/) Linux, command line & MetaCentrum January 29 to 31, 2019 5 / 260 Introduction Linux UN*X Command line Text Scripting Software MetaCentrum Git Administration The End Learning machine What it is a “UNIX” Licenses and money Introduction First steps in the world of Linux and open-source software 1 Introduction Learning machine What it is a “UNIX” Licenses and money . Vojtěch Zeisek (https://trapa.cz/) Linux, command line & MetaCentrum January 29 to 31, 2019 6 / 260 Introduction Linux UN*X Command line Text Scripting Software MetaCentrum Git Administration The End Learning machine What it is a “UNIX” Licenses and money The course information • The course page: https://trapa.cz/en/course-linux-command-line-2019 • Česky: https://trapa.cz/cs/kurz-prikazove-radky-linuxu-2019 • Subject in SIS: https://is.cuni.cz/studium/eng/predmety/ index.php?do=predmet&kod=MB120C17 • Česky: https://is.cuni.cz/studium/predmety/index.php?do= predmet&kod=MB120C17 • For students having subscribed the subject, requirements are on next slide • Working version is available at https://github.com/V-Z/ course-linux-command-line-bash-scripting-metacentrum — feel free to contribute, request new parts or report bugs . Vojtěch Zeisek (https://trapa.cz/) Linux, command line & MetaCentrum January 29 to 31, 2019 7 / 260 Introduction Linux UN*X Command line Text Scripting Software MetaCentrum Git Administration The End Learning machine What it is a “UNIX” Licenses and money Requirements to exam (“zápočet”) 1 Be present whole course. 2 Be active — ask and answer questions. 3 Write short script solving any task the student is (going to be) solving. E.g. prepare script to process student’s data on MetaCentrum. Or short script to do anything the student needs to do. This will be very individual. According to topics and interests of every student. Students can of course discuss with anyone, use Internet, manuals, etc. The aim is learn how to solve real problem the student has/is going to have. 4 Write at least one page (can be split into multiple articles) on Wikipedia about any topic discussed during the course. Again, this is very open, students can write about any topic they like. I prefer native language of the student (typically to make larger non-English Wikipedia). Vojtěch Zeisek (https://trapa.cz/) Linux, command line & MetaCentrum January 29 to 31, 2019 8 / 260 Introduction Linux UN*X Command line Text Scripting Software MetaCentrum Git Administration The End Learning machine What it is a “UNIX” Licenses and money Materials to help you… • Download the presentation from https://soubory.trapa.cz/ linuxcourse/linux_bash_metacentrum_course.pdf • Download the scripts and toy data from https://soubory.trapa.cz/linuxcourse/scripts_data.zip • Note: Open the scripts in some good text editor (slide 71) — showing syntax highlight, line numbers, etc. (NO Windows notepad); the files are in UTF-8 encoding and with UNIX end of lines (so that too silly programs like Windows notepad won’t be able to open them correctly) • Never ever open any script file in software like MS Word — they destroy quotation marks and other things by “typographical enhancements” making the script unusable . Vojtěch Zeisek (https://trapa.cz/) Linux, command line & MetaCentrum January 29 to 31, 2019 9 / 260 Introduction Linux UN*X Command line Text Scripting Software MetaCentrum Git Administration The End Learning machine What it is a “UNIX” Licenses and money Virtual machine for learning • If you do not have Linux installed, download and install VirtualBox from https: //www.virtualbox.org/ • Download openSUSE Leap 15.0 Linux distribution for this course from ftp: //botany.natur.cuni.cz/ openSUSE_Leap_courses.ova (∼4 GB) • Launch VirtualBox and go to menu File | Import appliance… to import it. When done, launch it (Start) . Vojtěch Zeisek (https://trapa.cz/) Linux, command line & MetaCentrum January 29 to 31, 2019 10 / 260 Introduction Linux UN*X Command line Text Scripting Software MetaCentrum Git Administration The End Learning machine What it is a “UNIX” Licenses and money Enjoy learning virtual machine for the course . Vojtěch Zeisek (https://trapa.cz/) Linux, command line & MetaCentrum January 29 to 31, 2019 11 / 260 Introduction Linux UN*X Command line Text Scripting Software MetaCentrum Git Administration The End Learning machine What it is a “UNIX” Licenses and money VirtualBox shared folder I VirtualBox can be configured to share folder with host operating system . Vojtěch Zeisek (https://trapa.cz/) Linux, command line & MetaCentrum January 29 to 31, 2019 12 / 260 Introduction Linux UN*X Command line Text Scripting Software MetaCentrum Git Administration The End Learning machine What it is a “UNIX” Licenses and money VirtualBox shared folder II Go to menu “Devices | Shared Folders” and set pair of folders 1 sudo mount -t vboxsf -o uid=$UID,gid=$(id -g) shared /mnt . Vojtěch Zeisek (https://trapa.cz/) Linux, command line & MetaCentrum January 29 to 31, 2019 13 / 260 Introduction Linux UN*X Command line Text Scripting Software MetaCentrum Git Administration The End Learning machine What it is a “UNIX” Licenses and money What it is UNIX, Linux and GNU I • UNIX • Originally developed in Bell labs of AT&T in 1696, written in C, since then huge radiation, hybridization, HGT, … • Trademark — only systems passing certain conditions (paid certification) can be called “UNIX” — Solaris, HP-UX, AIX, etc. (commercial systems for big servers) • Main principles: simple, multitasking, hierarchical, network, for more users (takes cares about permissions etc.), configuration written in plain text files, important relationships among applications (generally one application = one task — they are chained), work primarily with text, has kernel and API (interface to communicate with the rest of the system) • UNIX-like (UN*X, *nix) • Systems compatible with UNIX (Linux, BSD and its variants, macOS, …) • Mainly open-source (UNIX is commonly commercial — source code is not available for public, but its specification is) . Vojtěch Zeisek (https://trapa.cz/) Linux, command line & MetaCentrum January 29 to 31, 2019 14 / 260 Introduction Linux UN*X Command line Text Scripting Software MetaCentrum Git Administration The End Learning machine What it is a “UNIX” Licenses and money What it is UNIX, Linux and GNU II • Nowadays prevailing over “old” UNIX systems, used in many devices from tiny embedded toys to huge data centers • Try to provide same quality as paid systems, but (mostly) for free • Many courts about copyrights, parts of code, patents — USA allow software patents, EU not — GNU, Linux, BSD, etc. try to ensure to have only code not covered by any patents to avoid possible courts • GNU • “GNU’s Not Unix!” — but it is compatible, respects its principles • Since 1984 Richard Stallman (founder of Free Software Foundation) tried to make new kernel (Hurd — not finished yet…) • Generally set of basic system tools — working with many kernels (Linux, BSD*, macOS, …), also present in many commercial paid UNIX systems • Source code is free and open — anyone can study it (Security!), report bugs, contribute, modify, share it, … • GNU General Public License (GPL) — free spirit of open-source — license, idea, how to share software . Vojtěch Zeisek (https://trapa.cz/) Linux, command line & MetaCentrum January 29 to 31, 2019 15 / 260 Introduction Linux UN*X Command line Text Scripting Software MetaCentrum Git Administration The End Learning machine What it is a “UNIX” Licenses and money What it is UNIX, Linux and