C2110 UNIX and programming Lesson 2 / Module 2 -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 2 / Module 2 PS / 2020 Distance form of teaching: Rev2 C2110 UNIX and programming Lesson 2 / Module 2 -2- Commands ➢ Manual pages ➢ Basic detection commands C2110 UNIX and programming Lesson 2 / Module 2 -3Command Help Manuals sites (or what to do, when I get lost): man lists manual page of given command $ man [section_number] stoker Available sections: ❑ Section 1 user commands ❑ Section 2 system calls ❑ Section 3 library functions ❑ Section 4 special files ❑ Section 5 file formats name of command, function, topic, chapter etc. Number of the section must be entered for topics with the same name included in different sections. ❑ Section 6 games ❑ Section 7 conventions and miscellany ❑ Section 8 administration and privileged commands ❑ Section L math library functions ❑ Section N tcl functions $ man 1 printf $ man 3 printf man page of the printf command C page printf() man page C2110 UNIX and programming Lesson 2 / Module 2 -4Help, Searching for Commands Navigation in the help text: ● scroll through the text (up and down arrow keys or j and k) ● scroll through the text (PgDn and PgUp or keys f and b) ● search ( /search_text , key n for further search) ● close help (key q) Online manual pages in HTML format: http://linux.die.net/man/ Useful commands: whatis lists short command description (from the manual page) apropos searches for commands that contain the specified keyword in the manual info displays of info pages of a command (similar to manual pages) C2110 UNIX and programming Lesson 2 / Module 2 -5Description/Entering Commands $ command [options] [-] [arguments] short options -a -as or -a -s -f file.txt long options --file file.txt end of entering options must be used only in very special cases, it is not used commonly arguments main data or information passed to the command must be listed in a specific order [] means optional options or arguments <> means mandatory options or arguments, alternatively can be given without parentheses extend/change the behavior of the command can usually be listed in any order C2110 UNIX and programming Lesson 2 / Module 2 -6Detection Commands man manual pages of commands whatis prints a short description of the command (from the manual page) by the way searches for commands that contain the keyword specified in the label in the manual info display info command pages (similar to manual pages) whoami lists the name of the logged in user hostname lists the name of the machine you are logged in to id lists the identification data of the logged in user and his grouping w lists who is logged in to the machine and what it does who lists who is logged in to the machine ps lists running processes top monitors running processes loginctl manages environment-managed sessions systemd (statement, termination, etc.) last lists the most recently logged in users C2110 UNIX and programming Lesson 2 / Module 2 -7Exercise 1 1. Log in to the wolf02.ncbr.muni.cz node 2. Find the man pages in section 1 that contain the keyword directory or directories. Which command is used to create directories? 3. What is the full name of your computer (command hostname and selection according to the manual pages). 4. Enter your login name with the command whoami. 5. What is your identification number (uid)? 6. Find out who is logged on to the wolf02 workstation with the command w and who. 7. What is the difference between commands w and who according to manual pages or command whatis? 8. List the session using the command loginctl and last. What is the difference between them? 9. Get an overview of running processes with the command top (the command is terminated by pressing the q key).