User Tools

Site Tools


os_cp:intro

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
os_cp:intro [2024/02/20 13:29]
jkonczak
os_cp:intro [2026/03/12 00:57] (current)
jkonczak [Glob names and wildcards]
Line 22: Line 22:
 POSIX - a standard (published by IEEE and The Open Group) for operating system interface and environment,​ predominantly built to unify Unix-like systems POSIX - a standard (published by IEEE and The Open Group) for operating system interface and environment,​ predominantly built to unify Unix-like systems
  
-<​html>​<small></​html>+<​small>​
  
-GNU/Linux+Linux, ​GNU/Linux, Linux distribution…
   * [[https://​www.gnu.org/​gnu/​gnu.html|GNU]] is a collection of free software that altogether forms an operating system supplied with a broad choice of user applications [[https://​www.gnu.org/​manual/​blurbs.html]]   * [[https://​www.gnu.org/​gnu/​gnu.html|GNU]] is a collection of free software that altogether forms an operating system supplied with a broad choice of user applications [[https://​www.gnu.org/​manual/​blurbs.html]]
   * the kernel of GNU, [[https://​www.gnu.org/​software/​hurd/​|Hurd]],​ has never been fit enough for the task   * the kernel of GNU, [[https://​www.gnu.org/​software/​hurd/​|Hurd]],​ has never been fit enough for the task
   * therefore GNU software is usually run on top of Linux kernel ​   * therefore GNU software is usually run on top of Linux kernel ​
-  * most Linux distributions,​ apart form GNU software, has also a multitude of other software (not necessarely ​free or open source)+  * most Linux distributions,​ apart form GNU software, has also a multitude of other software (not necessarily ​free or open source) 
 +  * some Linux distributions base on free and/or open source software that is neither GNU software nor uses GNU licenses
  
-<​html>​</small></​html>+</​small>​
  
 ==== Shell and vital utilities ==== ==== Shell and vital utilities ====
Line 59: Line 60:
   * Apple operating systems (e.g. MacOS) ship with modified BSD tools [[https://​opensource.apple.com/​releases/​|[1]]] [[https://​github.com/​apple-oss-distributions/​file_cmds|[2]]] [[https://​github.com/​apple-oss-distributions/​text_cmds|[3]]]   * Apple operating systems (e.g. MacOS) ship with modified BSD tools [[https://​opensource.apple.com/​releases/​|[1]]] [[https://​github.com/​apple-oss-distributions/​file_cmds|[2]]] [[https://​github.com/​apple-oss-distributions/​text_cmds|[3]]]
   * Embedded / resource restrained systems often use [[https://​www.busybox.net/​downloads/​BusyBox.html|BusyBox]]   * Embedded / resource restrained systems often use [[https://​www.busybox.net/​downloads/​BusyBox.html|BusyBox]]
-  * Android uses [[https://​www.landley.net/​toybox/​|toybox]] [[https://cs.android.com/​android/platform/superproject/​main/​+/​main:​external/toybox/​toys/​posix/​|[4]]]+  * Android uses [[https://​www.landley.net/​toybox/​|toybox]] [[https://​cs.android.com/​android/​platform/​superproject/​main/​+/​main:​external/​toybox/​toys/​posix/​|[4]]]
   * For more, see [[https://​wiki.archlinux.org/​title/​core_utilities]]   * For more, see [[https://​wiki.archlinux.org/​title/​core_utilities]]
 <​html></​small></​html>​ <​html></​small></​html>​
  
-POSIX standarizes both the [[https://​pubs.opengroup.org/​onlinepubs/​9699919799/​utilities/​V3_chap02.html|shell]] +POSIX standarizes both the [[https://​pubs.opengroup.org/​onlinepubs/​9799919799/​utilities/​V3_chap02.html|shell]] 
-and its vital [[https://​pubs.opengroup.org/​onlinepubs/​9699919799/​utilities/​contents.html|utilities]].+and its vital [[https://​pubs.opengroup.org/​onlinepubs/​9799919799/​utilities/​contents.html|utilities]].
  
 ==== Accessing the shell ==== ==== Accessing the shell ====
Line 78: Line 79:
   * terminals bundled with some Linux desktop environment:​ [[https://​docs.xfce.org/​apps/​terminal/​start|xfce4-terminal]],​ [[https://​en.wikipedia.org/​wiki/​GNOME_Terminal|GNOME Terminal]], [[https://​konsole.kde.org/​|konsole]]   * terminals bundled with some Linux desktop environment:​ [[https://​docs.xfce.org/​apps/​terminal/​start|xfce4-terminal]],​ [[https://​en.wikipedia.org/​wiki/​GNOME_Terminal|GNOME Terminal]], [[https://​konsole.kde.org/​|konsole]]
   * default MacOS [[https://​en.wikipedia.org/​wiki/​Terminal_(macOS)|Terminal]]   * default MacOS [[https://​en.wikipedia.org/​wiki/​Terminal_(macOS)|Terminal]]
-  * drop-down terminals: [[https://​apps.kde.org/​yakuake/​|yakuake]] / [[http://​guake-project.org/​|guake]](([[https://​web.archive.org/​​web/​​20230709030453/​​http://​​guake-project.org/​​|Project homepage archived by archive.org]],​​ [[https://​​github.com/​Guake/​​guake/​|github]])) / [[https://​github.com/​lanoxx/​tilda|tilda]]+  * drop-down terminals: [[https://​apps.kde.org/​yakuake/​|yakuake]] / [[https://​guake.github.io/|guake]] / [[https://​github.com/​lanoxx/​tilda|tilda]]
  
 <​html></​small></​html>​ <​html></​small></​html>​
Line 98: Line 99:
 where ''​user''​ is the user name and ''​host''​ is the name or address of the target device. where ''​user''​ is the user name and ''​host''​ is the name or address of the target device.
 \\ \\
-For instance, if used ''​john''​ would like to log into a computer named ''​polluks.cs.put.poznan.pl'',​ he would have to input \\ ''​ssh john@polluks.cs.put.poznan.pl''​.+For instance, if the user ''​john''​ would like to log into a computer named ''​polluks.cs.put.poznan.pl'',​ he would have to input \\ ''​ssh john@polluks.cs.put.poznan.pl''​
 +\\ 
 +To terminate a ssh session, one can use either ''​logout''​ or ''​exit''​ command, or use //Ctrl// + //d// key combination on empty prompt line((//​Ctrl//​ + //d// actually indicates //​end-of-file//​ condition.)).
  
 Currently all major operating systems (including Windows) provide ''​ssh''​ command by default. Currently all major operating systems (including Windows) provide ''​ssh''​ command by default.
Line 110: Line 113:
 It is vital for security to confirm the authenticity of the server – the client It is vital for security to confirm the authenticity of the server – the client
 must verify that it does not contact a rogue server that can learn the password must verify that it does not contact a rogue server that can learn the password
-([[https://docs.ssh-mitm.at/​user_guide/authentication.html#​id2|ready-to-go tool]]) +([[https://​docs.ssh-mitm.at/​user_guide/​authentication.html#​id2|ready-to-go tool]]) 
-and/​or ​hijacks ​the session.+and/​or ​hijack ​the session.
 \\ \\
 [[https://​en.wikipedia.org/​wiki/​Public-key_cryptography|Asymmetric cryptography]] [[https://​en.wikipedia.org/​wiki/​Public-key_cryptography|Asymmetric cryptography]]
Line 120: Line 123:
 Hence, upon the first connection to a new server the SSH client program requests Hence, upon the first connection to a new server the SSH client program requests
 the  user to verify the authenticity of the public key and stores the key (in the  user to verify the authenticity of the public key and stores the key (in
-OpenSSH in ''​~/.ssh/known_hosts''​) to verify it automatically upon subsequent+OpenSSH in ''​~/​.ssh/​known_hosts''​) to verify it automatically upon subsequent
 connections. connections.
  
Line 127: Line 130:
 ~~Exercise.#​~~ Run a terminal emulator. Execute command ''​date''​ and ''​echo $SHELL''​ within. ​ ~~Exercise.#​~~ Run a terminal emulator. Execute command ''​date''​ and ''​echo $SHELL''​ within. ​
  
-~~Exercise.#​~~ Execute command ''​sleep 1h''​​ and interrupt it by pressing //Ctrl + c//.+~~Exercise.#​~~ Execute command ''​sleep 1h''​ and interrupt it by pressing //Ctrl + c//.
  
 ~~Exercise.#​~~ Switch to second virtual console and log in. Execute ''​pwgen''​. Return to graphical console. ​ ~~Exercise.#​~~ Switch to second virtual console and log in. Execute ''​pwgen''​. Return to graphical console. ​
  
-~~Exercise.#​~~ Use SSH to access ''​polluks.cs.put.poznan.pl''​.+~~Exercise.#​4~~a Use SSH to access your neighbour'​s computer. 
 +\\ 
 +<​small>​~~Exercise.#​4~~b ​Use SSH to access ''​polluks.cs.put.poznan.pl''​.</​small>​
  
 ===== Getting help ===== ===== Getting help =====
Line 141: Line 146:
 ~~Exercise.#​~~ Display help for ''​cat''​ and ''​bat''​ commands by running them with help option. <​html><​small></​html>​(NB:​ ''​bat''​ is installed by default only in some Linux distros.)<​html></​small></​html>​ ~~Exercise.#​~~ Display help for ''​cat''​ and ''​bat''​ commands by running them with help option. <​html><​small></​html>​(NB:​ ''​bat''​ is installed by default only in some Linux distros.)<​html></​small></​html>​
  
-Usually ​together with a program comes with a set of system manual pages. The pages can be displayed using the **''​man //​pagename//''​** command. To leave the manual, type ''​q''​.+Usually a program comes together ​with a set of system manual pages. The pages can be displayed using the **''​man //​pagename//''​** command. To leave the manual, type ''​q''​.
  
 ~~Exercise.#​~~ Display manual page for ''​timeout''​ command. ~~Exercise.#​~~ Display manual page for ''​timeout''​ command.
Line 149: Line 154:
 Page names are unique within a section, but there may be pages with the same name in different sections. Page names are unique within a section, but there may be pages with the same name in different sections.
 \\ \\
-You may use the **''​whatis //​pagename//''​** ​command ​to learn which sections contain given page name and display the full page title.+You may type **''​whatis //​pagename//''​** ​or <​small>''​man -f //​pagename//''</​small> ​to learn which sections contain given page name and display the full page title.
  
 ~~Exercise.#​~~ List all pages that are named ''​time''​. ~~Exercise.#​~~ List all pages that are named ''​time''​.
  
-To select a page from a given section, one has to use ''​man //section// //​pagename//''​ syntax. ​+To select a page from a given section, one has to use ''​man //section// //​pagename//''​ syntax, e.g., ''​man 2 write''​.
  
 ~~Exercise.#​~~ The ''​man''​ itself is described on two manual pages. Display both. What information is contained in each one? ~~Exercise.#​~~ The ''​man''​ itself is described on two manual pages. Display both. What information is contained in each one?
Line 164: Line 169:
 <​html><​small></​html>​ <​html><​small></​html>​
  
-For searching within manual there is also the ''​apropos //​what//'' ​command ​that searches ​within page names and titles.+For searching within manual there are also the ''​apropos //​what//'' ​and ''​man -k //​what//''​ commands ​that search ​within page names and titles.
  
 Apart from ''​man'',​ there is an alternative (and less popular) documentation system called ''​info''​. To see an Info page, type ''​info //​name//''​. Some programs ship with a more detailed Info document than manual page. Apart from ''​man'',​ there is an alternative (and less popular) documentation system called ''​info''​. To see an Info page, type ''​info //​name//''​. Some programs ship with a more detailed Info document than manual page.
Line 230: Line 235:
 The command **''​ls [//​dir//​]''​** lists file in directory ''​dir''​. When run with no arguments, it lists the current working directory. The command **''​ls [//​dir//​]''​** lists file in directory ''​dir''​. When run with no arguments, it lists the current working directory.
 \\ \\
-By default ''​ls''​ does not list hidden files. The **''​-a''​** ​and ''​--all'' ​switch changes this behaviour.+By default ''​ls''​ does not list hidden files. The **''​-a''​** switch changes this behaviour.
 \\ \\
-Switch **''​-l''​** ​/ ''​--list'' ​prints list of files with details such as file owner, size, modification date, etc.+Switch **''​-l''​** prints list of files with details such as file owner, size, modification date, etc.
  
 ~~Exercise.#​~~ List files in ''/​usr/​share/​zoneinfo/''​ and ''​../​../​../​../​../​bin''​. ​ ~~Exercise.#​~~ List files in ''/​usr/​share/​zoneinfo/''​ and ''​../​../​../​../​../​bin''​. ​
Line 258: Line 263:
 To change directory the command **''​cd [//​target//​]''​** is used. If no target is provided, ''​cd''​ changes current directory to the home directory. To change directory the command **''​cd [//​target//​]''​** is used. If no target is provided, ''​cd''​ changes current directory to the home directory.
 \\ \\
-<​html><​small></​html>​If ''​-''​ is uses as the target, the directory is changed to the previously visited. <​html></​small></​html>​+<​html><​small></​html>​If ''​-''​ is used as the target, the directory is changed to the previously visited. <​html></​small></​html>​
  
 ~~Exercise.#​~~ Enter ''​.config''​ directory (located in your home directory) and list files within. ~~Exercise.#​~~ Enter ''​.config''​ directory (located in your home directory) and list files within.
Line 283: Line 288:
 \\ \\
 For instance, //lines beginning with a word followed by an equals sign// might For instance, //lines beginning with a word followed by an equals sign// might
-be written as a regular expression ''​^\w+=''​.+be written as a regular expression ''​^\w+=''​.
  
 There are countless syntaxes and implementations of such patterns/​expressions. There are countless syntaxes and implementations of such patterns/​expressions.
  
 In the shell, [[https://​en.wikipedia.org/​wiki/​Wildcard_character|wildcards]] In the shell, [[https://​en.wikipedia.org/​wiki/​Wildcard_character|wildcards]]
-and [[https://en.wikipedia.org/​wiki/Regular_expression|regular expressions]]+and [[https://​en.wikipedia.org/​wiki/​Regular_expression|regular expressions]]
 are commonplace. are commonplace.
  
Line 295: Line 300:
 \\ \\
 The shell uses syntax summarized e.g., in The shell uses syntax summarized e.g., in
-''​[[https://man7.org/linux/man-pages/man7/glob.7.html|man 7 glob]]''​ and  +''​[[https://​man7.org/​linux/​man-pages/​man7/​glob.7.html|man 7 glob]]''​ and  
-''​[[https://man7.org/linux/man-pages/man7/regex.7.html|man 7 regex]]''​+''​[[https://​man7.org/​linux/​man-pages/​man7/​regex.7.html|man 7 regex]]''​
  
 </​small>​ </​small>​
Line 318: Line 323:
 ~~Exercise.#​~~ Change directory to ''/​usr/​bin/''​ directory. List all files that end with ''​cat''​. ~~Exercise.#​~~ Change directory to ''/​usr/​bin/''​ directory. List all files that end with ''​cat''​.
  
-~~Exercise.#​~~ ​List all files that end with ''​cat''​ in ''/​usr/​bin/'' ​while being in your home directory.+~~Exercise.#​~~ ​Change directory to your home directory. From there, list all files that end with ''​cat''​ in ''/​usr/​bin/''​.
  
-~~Exercise.#​~~ List all files that are in the ''/​usr/​bin/''​ directory that have names consisting of two chatacters.+~~Exercise.#​~~ List all files that are in the ''/​usr/​bin/''​ directory that have names consisting of two characters.
  
 ~~Exercise.#​~~ List contents of ''/​usr/​share/​zoneinfo/''​ and its subdirectories using a single command. ~~Exercise.#​~~ List contents of ''/​usr/​share/​zoneinfo/''​ and its subdirectories using a single command.
os_cp/intro.1708432177.txt.gz · Last modified: 2024/02/20 13:29 by jkonczak