Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Summary of Unix & Linux University course study

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

When I read this book two years ago, it was a book with 812 pages. Now I have summed it up into 40 sentences. I wish it had become one sentence.

Unix & Linux University course Harley Hahn

0, the most important function of the operating system

Control the computer and initialize it when it starts or restarts

Supports the interface used to interact with the computer

Provides an interface for programs that need to use computer resources (disk space, file location, processing time, memory, etc.)

Manage the memory of the computer

Maintain and manage the file system

Dispatching work

Provide account and security services

1. The kernel provides services:

Memory management (virtual memory management, including paging)

Process management (process creation, termination, scheduling)

Interprocess communication (local, network)

Input and output

Document management

Security and access control

Network access (such as TCP/IP)

2Magna Unix = kernel + tools (including shell and gui)

3, Linus Torvalds

4. Computer system:

Computer = terminal + host

Terminal = input facilities + output facilities

5, level of abstraction

Application / user

Desktop environment

Window manager

X Window

Device drivers in the kernel

Hardware

6, process thread

In Unix systems, each object is represented either by a file or by a process. In a nutshell, a file stores data or allows access to resources, while a process is an executing program.

Processes can be divided into smaller units called threads, which are a set of instructions that run in the process environment. Therefore, the structure of the program can be described as that more than one thread is running at the same time within a process.

7, run level

0 shutdown

1 single user

2 non-standardization

3 Multi-user: CLI

4 non-standardization

5 Multi-user: GUI

6 restart

8, shortcut key

Ctrl + Alt + Left/Right Workspace switching (based on gnome Desktop)

9, terminal

Stty-a gets the current terminal line settings

Intr = ^ C (stop the running program); quit = ^\ (stop the program and save the core file); erase = ^?; kill = ^ U (delete the entire line); eof = ^ D (prompt that there is no data); start = ^ Q (start screen display); erae = ^ H (delete a character); stop = ^ S (pause screen display); susp = ^ Z (pause, fg resumes to foreground); rprnt = ^ R (search history command) Werase = ^ W (delete a word); lnext = ^ V; flush = ^ O

Infocmp print terminal information infocmp vt100 | less (ncurses is required for infocmp)

The default terminal obtained by echo $TERM is xterm

Export IGNOREEOF=5 can press ^ D prompt logout or exit to exit.

10,which type whereis

Type is shell embedded, check out the built-in commands, bash 69

Help prints some list of built-in commands

11pr cal-j 5 2014

View every day in May 2014

12,uptime,uname

131.UsersQuery whowow wow wow W (who is doing what)

14 BC-l (support +, -, *, /,%, ^, sqrt (x), s (x), c (x), a (x), ln (x), j (ndjine x))

15dint RTFM (Read the fucking manual), xman

(1)。 Command (2). System call (3). Function library (4). Special documents (5). File format (6). Game (7). Miscellaneous information (8). System management

Man-f Quick search Command usage whatis

Man-k keyword apropos

Man builtin man bash

16, environmental variables

Env

Perintenv

Set/unset (csh) set term=vt100

Setenv/unsetenv (csh) setenv TEST hello

Export (bash)

Set-/ + o display shell option control (bash)

17, citation and escape

Use a backslash to reference a single character (called escaping this character)

Use single quotation marks to reference a string of characters

Use double quotation marks to refer to a string of characters, but retain the special meaning of $, `,\

18, search path

Export PATH= "/...: /..."

Set path= (/.. /...)

PS1 shell hint

Export PS1= "\ u\ w\ @\ $"

Prompt (csh)

``command replacement

197fc-l history

20, automatic completion

File name completion

Command completion

Variable completion

User identification completion

Hostname completion (bash)

21, alias

Alias,umalias

Alias' axialias'

22, initialization file

.profile file

.rc file

Log in to shell (.bash _ profile)

Non-login shell (.bashrc)

23, input and output

)

> > append standard output (same as 1 > >)

2 > redirect standard error

2 > append standard error

2 > & 1 redirect standard error to standard output

> & or & > redirect standard output + standard error (Bash only)

| | Pipeline |

2 > & 1 | all outputs to pipes

Set-o noclobber can be disabled >, but can be used > | (force override)

24, grouping and sub-shell

(cd directory; command)

25, pipeline shunt tee (read data from standard input and send one screen and one file each)

Cat 123 | tee 123 | grep hh (tee can output and save more than one copy)

26, condition execution

Command1 & & command2 (execute Command 2 after successful execution of Command 1)

Command1 | | command2 (execute command 2 after command 1 is not successful)

27, filter

Cat | grep | sort | less

(1) analyze the problem

(2) Select tools

(3) discuss with others

(4) Select options

28, simple operation of file

Split split file

Tac reverses the order of text lines

Rev reverse character

Colrm deletes the specified data column and then writes the remaining data to standard output

29, compare and extract

Cmp compares two files byte by byte

Comm compares two ordered texts line by line

Diff compares unordered text files

Cut-f 1pr 3-5-d':'/ etc/passwd | sort (f column, d delimiter)

Cut-C1-8 (c by character)

Paste can form a large table of several files (each containing a column of data)

Paste horizontal combination data, cat vertical combination data

30, Statistics and formatting

Nl create line number

Wc statistics lines, words, and characters

Set list visualizes tabs and spaces

Expand converts tabs to spaces (unexpand)

Fold split line fold-s-w 40 file (40 character line, word unsplit)

31, selection, arrangement, combination and transformation

Grep (global re print)

Ls-F / etc | grep-c "/" (c statistics)

-in (ignore case and press line number)

-l (list file name)

-v (reverse, conversely)

-x (account for the whole line)

-r (recursive, recursive)

-s (suppress, suppression)

-E (egrep)

Look

Sort-dfnu (sort-u = sort | uniq = cat | sort | uniq)

Uniq-cdu (d only focuses on multiple rows, u only looks at unique rows, c counts rows)

Join merges ordered data

Strings searches the binary for the string strings / usr/bin/sort

Tr Amurz

< old >

New case conversion

[: upper:] [: lower:] [: digit:]

32, non-interactive text editing sed

Sed 's/h/H/g'ole > new (- I in-place can change the original file)

(1) read a line from the input stream

(2) execute the specified command and make the necessary exchange for the line.

(3) write the line to the output stream

Number [, number] | / regex/ operates on a specified line or a line containing a specific string

5Jing 10s (5 to 10 lines)

$s (last line)

/ OK/ (the line of the string OK)

[0-9] [0-9] A line containing two consecutive numbers

-e multiple changes

-f file

33, regular expression

Metacharacter

.

^

$

\

< 匹配单词的开头 \>

Match the end of a word

[abc] matches any character in abc

[^ abc] matches any characters that are not in abc

() Group: treated as a separate unit

| | one of the matching choices |

\ reference: literally interpret metacharacters

Operator

* 0 or more

+ 1 or more times

? 0 or 1 time

{n} n times (xyz) {5} match character "xyz" 5 times

{n,} at least n times

{, m} m times at most

[0-9] {3pr 5} match 3 to 5 digits between {nmenthm} nrem

Class

[: lower:] amerz

[: upper:] Amurz

[: alpha:] A-Za-z

[: alnum:] A-Za-z0-9

[: digit:] 0-9

[: punct:] punctuation mark

[: blank:] spaces or tabs

Grep-w 'cat' data

Grep'\ 'data\ is the whole number or word, no is just a string

Grep'\ bcat\ b'data

Man ascii

Locale-a

34, display file

Hexdump hexdump-C / bin/grep | less displays binary files-C files

Od od-Ax-txlz / bin/grep | less

35Powervim text editor

Command mode

H

J

K

L

W

E

B

R

R

X

X

D

Dd

U

U

Yy

Yw

Y10w

Y2)

Y5}

10yy

P

P

Xp swaps two characters

Ddp swaps two lines

Deep changes two words.

Input mode

I

A

O

I

A

O

Search mode

: / keywords

: set number

: set all

.vimrc

36, file system

Disk-based file system

Ext3, ext4,FAT32,HFS+ (hierarchical file system), ISO 9660 (CD-ROM), NTFS,UDF (rewritable CD and DVD), UFS2 (BSD,Solaris)

Network file system

NFS,SMB

Special file system

Device Interface (PTY) of devpts pseudo Terminal

Procfs proc file system

Sysfs system data file system (devices and drives)

Tmpfs temporary Storage File system

37, directory operation

.

..

~

Pushd

Popd

Dirs

Ls-CrR1F (C column, r alphabet from large to small, R all subdirectories, 1 file name on one line, F marked)

Ls-lrtu displays recently accessed files

-ordinary

D directory

L symbol

B block

C character

P pipeline

Dumpe2fs / dev/sda1 | grep "Block size"

Tree file tree

38, file operation

Setuid

Setgid

Umask

Shred-fvuz filename clears the contents of the file

Stat file

Ls-I

Ln-s

Whereis

Locate

Find

Find path... Test... Action...

Test is as follows:

-name

-iname

-type

-perm

-user

-group

-empty

-size

-atime

-ctime

-mtime

Action is as follows:

-print

-fprint file

-ls

-exec command {}\; executes the command, and {} indicates a matching file name

-ok command {}\; same as above, but confirm before running the command

-delete deletes files

-fls file

Xargs processes found files

Find ~-type f | xargs ls-s

(whoami;date) | xargs

39, process and job control

Echo $$displays the PID of the current shell

Echo $! Displays the PID of the last command moved to the background

Sleeep (sleep 20 / etc/passwd) & & vim / etc/termcap

Jobs

Ps

Fg

Bg

Suspend suspends the current shell

^ Z

Kill

Top

Prtstat

Pstree

Fuser

Nice

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report