Get the App
SLTechnology News&Howtos  ›  Servers  › 

Learning Notes on the principles and applications of Unix-Chapter 2 the Architecture and Command usage of unix

Shulou Source: shulou.com Published: 2022-06-03 06:36:00 09月21日 Update

Chapter 2 unix architecture and command usage

Unix system structure: Note that it is divided into three aspects: 1. Division of tasks === Kernel and shell, the kernel is responsible for dealing with the machine hardware, and the shell is responsible for dealing with the user. 2. File and process---file is space, process is life;3. system call

The concept of system calls: user programs request kernel services through a set of function calls called system calls

Unix system components: kernel, shell, applications, are written in C language.

Note: Unix kernel programs correspond to/stand/unix files, or/unix files, or/kernel/genunix/(for solaris systems) depending on the type of system installed on the user machine.

Shell programs are represented by sh (bourne shell),csh (c shell),ksh (korn shell), or bash (bash shell).

To see which shell is running, you can do this with the command echo$SHELL.

The main features of Unix systems: a multi-user, multitasking, building blocks, toolkits, pattern-matching, programming tools, help documentation.

Regular expressions: are expressions composed of characters from metacharacters.

Question: What is the concept of metacharacters? Script?

Experience: Must have a deep understanding of shell script programming techniques.

POSIX and single unix specification: POSIX (portable operating system interface), single unix specification proposes "write once, run everywhere"

Path variable: Sets the search path of the command file; separated by ":",". "Indicates the current directory

Note: unix's most important commands are placed in/bin and/usr/bin directories.

Internal commands: Internal: The program file they want cannot be found in the entire directory tree;

Foreign: can thoughtful corresponding program file. (/bin or/usr/bin)

Note: A shell is an external command, but it contains a set of internal commands. When a command is both internal and external to the shell, the shell gives higher priority to the internal command (e.g. echo).

Note: dd and find commands, parameters are more complex.

The relationship between options and parameters: adding "-" before parameters is optional; parameters that can represent file names are added to distinguish. Optional options are also parameters of commands, so it is given another name because these parameters are given in advance by the system.

File parameters: usually placed at the end of the command, after all parameters.

Command Parameters and Options à Command Line

Other names for command parameters: expression (grep command), set of instructions (sed), program (awk, perl)

Flexible use of commands: unix allows users to enter multiple commands on a command line, separated by semicolons. When you master command output redirection, you tend to enclose a set of commands in parentheses. For example (wc note;ls -s note>list)";" is a metacharacter.

Note: unix allows commands to be entered before the end of the previous command!

Tags: Commands parameters systems files programs kernels users metacharacters directories expressions structures tasks functions shells tools machines concepts scripts processes programming Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Huawei OPPO Reno Shulou Tech Info Docker