cicd
over: 覆盖:一般表示在物体之上,当接触的时候表示全覆盖;在...正上方:不接触表示在物体正上方;越过上空:表示上空时越过上空;
under:与over相对
above:在...上方(高于平面)L: 一般只要高出就行
below: 与above相对
near: 在...附近
by: 在...旁边
beside: 在...旁边(非空间)比较
next to: 在...旁边;下一个;紧邻
across:(从表面)穿过
through:(从内部)穿过; 通过。。。方式;we succeed through hard work
past:经过,路过
in front of: 在。。。之前,与behind相对
before:在。。。之前,一般不太表示空间,
between: among
round around
along:沿着顺着
to toward(s):朝。。。的方向
onto:到。。。上面,比如兔子跳到桌子上面,the rabbit jump onto the table
into:到。。。里面,比如兔子跳到箱子里面,the rabbit jump into the box
out of: 从里面出来 get out of the car
oppsite: 在 。。。对面,my school is oppsite my house
against: 与...相反;倚;靠; the rabbit was leaning against the tree
up: 沿着。。。向上: up the river ;up the hill
down: 沿着。。。向下;walk down the road;roll down the hill
off:离。。。有一定距离 加了一些,再加一点例子
during: 持续;在...期间;during the past 2 days
for:因为。。。;因。。。而持续: i've been learning english for 2 days
since: 自从
by: 在。。。附近/旁边,不超过。。。边界,不迟于。。。前: by 2 o'clock
before
until
through: 通过。。。方式穿过
by :通过,在。。。旁边
|
介词 |
核心含义 |
物理场景 |
抽象含义 |
常见搭配 |
|
Through |
穿过/经由 |
进入内部并从另一头出来 |
强调渠道、中介、过程 |
Through the window, Through a friend, Through hard work |
|
By |
通过/经过 |
从旁边经过 |
强调手段、方式、工具 |
By bus, By email, By doing something, By chance |
with:用。。。;和。。。一起
on:在。。上面(online)
原因介词
for:因为,由于
with:和。。。一起;。。是和。。。一起分不开的原因 the rabbit is shaking with cold
because + 从句; because of + 名词
关于介词
about:在。。。外面,关于
of:(离开),此外的,附加的
on: 在。。。上面,关于
at:数值点:
by:按。。。接度量标准
for:以。。。的价钱
状态
in:在。。。里,在。。。状态中
on:在。。。之上,收到之下的。。。的支持(的状态)
at:在某处;在某个状态点,at work
under:在。。下面,在(框架,前提,共识)下:under construction;under discussion
排除
besides:除了。。。还(加法关系)
except:除了。。。
except for : 除了。。往往用来对之前的内容进行反驳,类似于美中不足的是
介词短语:
Linux Environment Variables
Environment variables are key-value pairs used by the shell and other processes to store data about your user session and system configuration.
1. Viewing Environment Variables
- View a specific variable: Use the echo command followed by the variable name prefixed with $.
- Example: echo $HOME or echo $USER.
- View all variables: Run the env command to list all currently set key-value pairs for your session.
2. The Importance of the PATH Variable
- Function: The PATH variable contains a colon-separated list of directories. When you run a command, your system searches these directories to find the corresponding executable file.
- Troubleshooting: If you receive a "command not found" error for a program you installed in a custom location, it is likely because that directory is not in your PATH.
3. Setting Environment Variables
- Temporary (Current Session Only): Use the export command.
- Example: export TEST=test
- This variable will be lost once the terminal session is closed.
- Persistent (Across Sessions): Add the export command to your shell’s startup configuration file.
- Bash: ~/.bashrc
- Zsh: ~/.zshrc
- Fish: ~/.config/fish/config.fish
Steps for Persistence:
- Open the configuration file in a text editor (e.g., nano ~/.bashrc).
- Add export TEST=test to the end of the file.
- Save and exit the editor.
- Apply changes immediately by running source ~/.bashrc (or the equivalent for your shell).
Note: Managing environment variables effectively is essential for system configuration and ensuring that your custom applications are easily accessible from the terminal.
Linux grep Command Summary
grep is an essential text-processing tool in Linux used to search for specific patterns within files or data streams.
1. Basic Usage
- Search for a pattern: grep [pattern] [filename]
- Example: grep fox sample.txt searches for the string "fox" in sample.txt.
2. Advanced Pattern Matching (-e)
- Handling special characters: The -e flag explicitly defines the pattern. This is crucial when searching for patterns that start with a hyphen (-), preventing them from being misinterpreted as command options.
- Example: grep -e "-v" config.conf
3. Useful Flags
Refine your search results using these common flags:
- -i: Perform a case-insensitive search.
- -c: Count the number of matching lines instead of displaying them.
- -o: Output only the specific matching part of the line.
- -f: Load multiple patterns from a specified file.
4. Advanced Techniques
- Piping (|): Combine grep with other commands to filter output.
- Example: env | grep -i User filters environment variables for "User".
- Regular Expressions: Use regex for complex pattern matching.
- Example: ls /somedir | grep '.txt$' filters for files ending in .txt.
Linux Process Management Summary
1. Understanding Processes
- Definition: Processes are programs currently running on a system, managed by the Linux kernel.
- PID (Process ID): A unique, sequentially assigned number used to identify each process.
2. Snapshotting with ps
The ps command provides a static snapshot of processes. There are three common syntax styles:
- Basic ps: Displays processes associated only with the current terminal session.
- BSD-style (ps aux):
- a: All processes for all users.
- u: Detailed, user-oriented format.
- x: Includes processes not attached to a terminal (e.g., system daemons).
- System V-style (ps -ef):
- -e: Selects every process on the system.
- -f: Provides a "full-format" listing, including hierarchical data like PPID (Parent Process ID) and start time. This is widely used for system administration and troubleshooting.
3. Real-Time Monitoring with top
- Function: Unlike ps, which provides a snapshot, top offers a dynamic, real-time view of system processes.
- Use Case: Ideal for identifying processes that are consuming high levels of CPU or memory, as it automatically refreshes the display.
Virtual machine directory
Ls
sysadmin@localhost:~$ ls -l /var/log/
total 844
-rw-r--r-- 1 root root 18047 Dec 20 2017 alternatives.log
drwxr-x--- 2 root adm 4096 Dec 20 2017 apache2
drwxr-xr-x 1 root root 4096 Dec 20 2017 apt
-rw-r----- 1 syslog adm 1346 Oct 2 22:17 auth.log
-rw-r--r-- 1 root root 47816 Dec 7 2017 bootstrap.log
-rw-rw---- 1 root utmp 0 Dec 7 2017 btmp
-rw-r----- 1 syslog adm 547 Oct 2 22:17 cron.log
-rw-r----- 1 root adm 85083 Dec 20 2017 dmesg
-rw-r--r-- 1 root root 325238 Dec 20 2017 dpkg.log
-rw-r--r-- 1 root root 32064 Dec 20 2017 faillog
drwxr-xr-x 2 root root 4096 Dec 7 2017 fsck
-rw-r----- 1 syslog adm 106 Oct 2 19:57 kern.log
-rw-rw-r-- 1 root utmp 292584 Oct 2 19:57 lastlog
-rw-r----- 1 syslog adm 19573 Oct 2 22:57 syslog
drwxr-xr-x 2 root root 4096 Apr 11 2014 upstart
-rw-rw-r-- 1 root utmp 384 Oct 2 19:57 wtmp
Each line corresponds to a file contained within the directory. The information can be broken down into fields separated by spaces. The fields are as follows:
- File Type
- -rw-r--r-- 1 root root 18047 Dec 20 2017 alternatives.log
- drwxr-x--- 2 root adm 4096 Dec 20 2017 apache2
The first field actually contains ten characters, where the first character indicates the type of file and the next nine specify permissions. The file types are:
|
Symbol |
File Type |
Description |
|
d |
directory |
A file used to store other files. |
|
- |
regular file |
Includes readable files, images files, binary files, and compressed files. |
|
l |
symbolic link |
Points to another file. |
|
s |
socket |
Allows for communication between processes. |
|
p |
pipe |
Allows for communication between processes. |
|
b |
block file |
Used to communicate with hardware. |
|
c |
character file |
Used to communicate with hardware. |
- Permissions
drwxr-xr-x 2 root root 4096 Apr 11 2014 upstart
Permissions indicate how certain users can access a file. Keep reading to learn more about permissions.
- Hard Link Count
-rw-r----- 1 syslog adm 1346 Oct 2 22:17 auth.log
This number indicates how many hard links point to this file. Hard links are beyond the scope of this module, but are covered in the NDG Linux Essentials course.
- User Owner
-rw-r----- 1 syslog adm 106 Oct 2 19:57 kern.log
User syslog owns this file. Every time a file is created, the ownership is automatically assigned to the user who created it.
- Group Owner
-rw-rw-r-- 1 root utmp 292584 Oct 2 19:57 lastlog
Indicates which group owns this file
- File Size
-rw-r----- 1 syslog adm 19573 Oct 2 22:57 syslog
Directories and larger files may be shown in kilobytes since displaying their size in bytes would present a very large number. Therefore, in the case of a directory, it might actually be a multiple of the block size used for the file system. Block size is the size of a series of data stored in the filesystem.
- Timestamp
drwxr-xr-x 2 root root 4096 Dec 7 2017 fsck
This indicates the time that the file's contents were last modified.
- Filename
-rw-r--r-- 1 root root 47816 Dec 7 2017 bootstrap.log
sorting
The -t option will sort the files by timestamp:
The -S option will sort the files by file size:
The -r option will reverse the order of any type of sort
Administrative Access
The su Command
su –
exit
sudo sl
Permissions
Changing File Permissions
chmod really means change the modes of access.
|
Symbol |
Meaning |
|
u |
User: The user who owns the file. |
|
g |
Group: The group who owns the file. |
|
o |
Others: Anyone other than the user owner or member of the group owner. |
|
a |
All: Refers to the user, group and others. |
Next, specify an action symbol:
chmod [<SET><ACTION><PERMISSIONS>]... FILE
|
Symbol |
Meaning |
|
+ |
Add the permission, if necessary |
|
= |
Specify the exact permission |
|
- |
Remove the permission, if necessary |
After an action symbol, specify one or more permissions to be acted upon.
chmod [<SET><ACTION><PERMISSIONS>]... FILE
|
Symbol |
Meaning |
|
r |
read |
|
w |
write |
|
x |
execute |
Changing File Ownership
To switch the owner of the hello.sh script to the root user, use root as the first argument and hello.sh as the second argument.
Viewing Files
Copying Files
Moving Files
Removing Files
Filtering Input
Regular Expressions
Basic Patterns
Anchor Characters
Match a Single Character With .
This character can be used any number of times. To find all words that have at least four characters the following pattern can be used:
Match a Single Character With []
When other regular expression characters are placed inside of square brackets, they are treated as literal characters. For example, the . normally matches any one character, but placed inside the square brackets, then it will just match itself. In the next example, only lines which contain the . character are matched.
Shutting Down
Network Configuration
Viewing Processes
Package Management
Installing Packages
Updating Packages
Removing Packages
An administrator can execute the apt-get remove command to remove a package or the apt-get purge command to purge a package completely from the system.
Updating User Passwords
If the user wants to view status information about their password, they can use the -S option:
The root user can change the password of any user. If the root user wants to change the password for sysadmin, they would execute the following command:
Nginx
Nginx 入门基础笔记
1. 核心架构
- 多进程模型:
- Master 进程:负责读取/评估配置、维护 Worker 进程。
- Worker 进程:负责处理实际的请求。Nginx 采用事件驱动模型,在 Worker 之间高效分配请求。
- 配置文件位置:通常为 nginx.conf,存放在 /usr/local/nginx/conf、/etc/nginx 或 /usr/local/etc/nginx。
2. 常用控制命令
必须在启动 Nginx 的同一用户下执行,格式为:nginx -s <signal>
- 启动:直接运行 nginx 可执行文件。
- 快速停止:nginx -s stop
- 优雅停止:nginx -s quit(等待 Worker 处理完当前请求再退出)。
- 重新加载配置:nginx -s reload(不间断服务,Master 检查语法后启动新 Worker,通知旧 Worker 优雅退出)。
- 查看进程:ps -ax | grep nginx
- 信号发送:也可以通过 Unix 工具 kill 发送信号给 Master 进程 ID(PID)。
3. 配置文件的结构
- 指令类型:
- 简单指令:名称和参数以空格分隔,以分号 ; 结尾。
- 块指令:用大括号 {} 包围的一组指令。
- 上下文 (Context):
- Main:指令不在任何块内(最高层)。
- Events & Http:在 Main 中。
- Server:在 Http 中。
- Location:在 Server 中。
- 注释:使用 #。
4. 核心功能配置
A. 静态资源服务 (Serving Static Content)
通过 location 块和 root 指令实现。
nginx
Copy Code
server {
# 匹配所有请求,根目录为 /data/www
location / {
root /data/www;
}
# 匹配以 /images/ 开头的请求
location /images/ {
root /data; # 请求 /images/a.png 会映射到 /data/images/a.png
}
}
- 匹配规则:如果有多个 location 匹配,Nginx 选择前缀最长的一个。
B. 设置反向代理 (Simple Proxy Server)
将请求转发到另一台服务器。
nginx
Copy Code
server {
# 转发所有非图片请求到本地 8080 端口
location / {
proxy_pass http://localhost:8080;
}
# 使用正则表达式匹配图片文件,~ 表示开启正则
location ~ \.(gif|jpg|png)$ {
root /data/images;
}
}
- 逻辑:Nginx 先检查前缀匹配,记录最长匹配项,然后检查正则表达式。如果正则匹配成功,则使用正则块;否则使用之前记录的前缀匹配项。
C. FastCGI 代理 (FastCGI Proxying)
常用于连接 PHP 等应用框架。
nginx
Copy Code
server {
location / {
fastcgi_pass localhost:9000; # FastCGI 服务器地址
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
}
}
5. 故障排查
如果配置未生效或报错,请检查以下日志文件:
- 路径:/usr/local/nginx/logs 或 /var/log/nginx
- 文件:access.log(访问日志)和 error.log(错误日志)。
Docker-nginx best practice
firewall_automation_ui/
├── deploy/
│ └── default.conf.template
├── docker-entrypoint.sh
├── Dockerfile
└── Dockerfile-nginx

浙公网安备 33010602011771号