C2110 UNIX and programming Lesson 4 -1C2110 UNIX and programming Petr Kulhanek kulhanek@chemi.muni.cz National Center for Biomolecular Research, Faculty of Science Masaryk University, Kamenice 5, CZ-62500 Brno Lesson 4 PS / 2020 Distance form of teaching: Rev2 C2110 UNIX and programming Lesson 4 -2- Revision ➢ Processor, Process ➢ Running Programs ➢ Redirection ➢ Pipes C2110 UNIX and programming Lesson 4 -3Internal Scheme of a Computer north bridge north bridge south bridge south bridgeUSB mouse, keyboard real time clock SATA controllers hard drives BIOS graphics system memory memory controller peripherals with fast access via PCI Express Network (ethernet) sound PCI bus computational cores (CPU core) processor number of CPU cores > 1 = SMP computer Operating system ensures running of programs (processes) on the processors and optimal use of other resources (memory, disk capacity). Multitasking technique is used in management of processes. C2110 UNIX and programming Lesson 4 -4Starting processes the name of the program or script is given including the path (absolute or relative) User programs and scripts: $ ./my_script $ ~/bin/my_application Standard commands and programs: $ ls Standard commands and programs are in the path defined by the PATH variable Running applications in the foreground Running applications in the background $ gimp & at the end (after arguments and redirects) of the statement we type an ampersand $ gimp processes running in the foreground block the terminal because they use its standard input and output processes running in the background do not block the terminal usable for both standard and user programs C2110 UNIX and programming Lesson 4 -5- Redirection Input-output currents can be redirected to use files instead of the keyboard or screen. $ program < input.txt > output.txt 2> error.txt process (command, program)standard input stream (keyboard) standard output stream (terminal screen) standard error stream (terminal screen) input.txt output.txt error.txt C2110 UNIX and programming Lesson 4 -6- Pipes Pipes serve to combine the standard output of one process with the standard input of another process. process 1 process 2 input output | input output error output error output $ command_1 | command_2 Usage: Redirection and pipes can be combined. C2110 UNIX and programming Lesson 4 -7Next Subject ➢ Basic Work with Linux C2110 UNIX and programming Lesson 4 -8- Content ➢ Linux as a Desktop Environment • GNOME • Terminals • Standard and scientific-technical applications ➢ File System • Quotas • Disk device • Symbolic links ➢ Text Editors • vi, vim, nano • gedit, kwrite, kate