Skip to content

Commit 2fe257a

Browse files
committed
📖spring
1 parent db37e06 commit 2fe257a

18 files changed

+170
-43
lines changed

docs/.DS_Store

0 Bytes
Binary file not shown.

docs/interview/Algorithm.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ title: 硬刚算法
33
date: 2024-05-31
44
tags:
55
- leetcode
6-
categories: interview
6+
- Interview
7+
categories: Interview
78
---
89

910
![](https://img.starfish.ink/common/faq-banner.png)

docs/interview/Collections-FAQ.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ title: 「直击面试」—— Java 集合,你肯定也会被问到这些
33
date: 2021-05-31
44
tags:
55
- Java
6-
categories: Java
6+
- Interview
7+
categories: Interview
78
---
89

910
![](https://img.starfish.ink/common/faq-banner.png)

docs/interview/Design-Pattern-FAQ.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ title: 「直击面试」—— 设计模式
33
date: 2023-05-31
44
tags:
55
- 设计模式
6-
categories: 设计模式
6+
- Interview
7+
categories: Interview
78
---
89

910
![](https://img.starfish.ink/common/faq-banner.png)

docs/interview/Elasticsearch-FAQ.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ title: 手撕 ES 面试
33
date: 2024-05-31
44
tags:
55
- Elasticsearch
6-
categories: Elasticsearch
6+
- Interview
7+
categories: Interview
78
---
89

910
![](https://img.starfish.ink/common/faq-banner.png)

docs/interview/JUC-FAQ.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ title: 手撕 JUC 面试
33
date: 2024-05-31
44
tags:
55
- JUC
6-
categories: JUC
6+
- Interview
7+
categories: Interview
78
---
89

910
![](https://img.starfish.ink/common/faq-banner.png)

docs/interview/JVM-FAQ.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ title: 手撕 JVM 面试
33
date: 2024-05-31
44
tags:
55
- JVM
6-
categories: JVM
6+
- Interview
7+
categories: Interview
78
---
89

910
![](https://img.starfish.ink/common/faq-banner.png)

docs/interview/Java-Basics-FAQ.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ title: Java 基础面试
33
date: 2024-08-31
44
tags:
55
- Java
6-
categories: Java
6+
- Interview
7+
categories: Interview
78
---
89

910
![](https://img.starfish.ink/common/faq-banner.png)

docs/interview/Kafka-FAQ.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ title: Kakfa 面试
33
date: 2022-1-9
44
tags:
55
- Kafka
6+
- Interview
67
categories: Interview
78
---
89

docs/interview/Linux-FAQ.md

Lines changed: 108 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
1-
Linux 面试题通常会考察你对操作系统的理解,尤其是在系统管理、性能调优、文件系统、进程管理、网络配置、安全性等方面的知识。以下是一些常见的 Linux 面试题知识点和常见面试题的总结。
1+
---
2+
title: Linux 面试
3+
date: 2025-04-08
4+
tags:
5+
- Linux
6+
- Interview
7+
categories: Interview
8+
---
9+
10+
![](https://img.starfish.ink/common/faq-banner.png)
11+
12+
> Linux 面试题通常会考察你对操作系统的理解,尤其是在系统管理、性能调优、文件系统、进程管理、网络配置、安全性等方面的知识。以下是一些常见的 Linux 面试题知识点和常见面试题的总结。
213
314
## 一、Linux 知识点
415

5-
1.
6-
2. **文件系统**
7-
- Linux 文件系统采用树形结构,从根目录 `/` 开始,并向下分支到各个子目录,如 `/home``/etc``/usr` 等。
8-
3. **权限管理**
9-
- 文件权限、修改权限和所有者。
10-
4. -
11-
5. **网络管理**
12-
- 查看网络配置和网络排障工具。
13-
6. **系统安全**
14-
- 如何查看系统日志、检查系统资源使用情况、配置静态 IP、创建和管理用户、查看和管理服务、设置定时任务、检测和修复文件系统错误、压缩和解压文件、查看和设置环境变量、查找文件和目录、监控系统性能等。
16+
1. **文件系统**:Linux 文件系统采用树形结构,从根目录 `/` 开始,并向下分支到各个子目录,如 `/home``/etc``/usr` 等。
17+
2. **权限管理**:文件权限、修改权限和所有者。
18+
3. **网络管理**:查看网络配置和网络排障工具。
19+
4. **系统安全**:如何查看系统日志、检查系统资源使用情况、配置静态 IP、创建和管理用户、查看和管理服务、设置定时任务、检测和修复文件系统错误、压缩和解压文件、查看和设置环境变量、查找文件和目录、监控系统性能等。
1520

1621

1722

@@ -375,3 +380,95 @@ Linux查看日志的命令有多种:tail、cat、tac、head、echo等,只介
375380

376381

377382

383+
### 如何编写一个备份日志的 Shell 脚本?
384+
385+
```shell
386+
#!/bin/bash
387+
# 备份 /var/log 目录下的 .log 文件到 /backup 目录,保留7天
388+
BACKUP_DIR="/backup"
389+
LOG_DIR="/var/log"
390+
DATE=$(date +%Y%m%d)
391+
392+
find $LOG_DIR -name "*.log" -exec cp {} $BACKUP_DIR/logs_$DATE \;
393+
find $BACKUP_DIR -name "logs_*" -mtime +7 -exec rm -f {} \;
394+
```
395+
396+
397+
398+
### 如何快速定位 CPU 100% 问题?
399+
400+
1. 定位高负载进程
401+
402+
```bash
403+
top -c # 按P排序CPU使用
404+
pidstat 1 5 # 细粒度进程统计
405+
```
406+
407+
2. 分析线程状态
408+
409+
```bash
410+
top -H -p [PID] # 查看线程
411+
printf "%x\n" [TID] # 将线程ID转为16进制
412+
```
413+
414+
3. 结合 jstack/gdb 查看堆栈
415+
416+
```bash
417+
jstack [PID] | grep -A20 [nid] # Java进程
418+
gdb -p [PID] -ex "thread apply all bt" -batch # 原生进程
419+
```
420+
421+
422+
423+
### 如何优化内存使用?
424+
425+
```bash
426+
# 清除缓存(生产环境慎用)
427+
echo 3 > /proc/sys/vm/drop_caches
428+
429+
# 调整swappiness
430+
sysctl vm.swappiness=10
431+
432+
# 透明大页禁用
433+
echo never > /sys/kernel/mm/transparent_hugepage/enabled
434+
```
435+
436+
437+
438+
### 磁盘空间满的快速处理
439+
440+
1. 定位大文件
441+
442+
```bash
443+
du -h --max-depth=1 / 2>/dev/null | sort -hr
444+
```
445+
446+
2. 清理日志文件
447+
448+
```bash
449+
find /var/log -name "*.log" -size +100M -exec truncate -s 0 {} \;
450+
```
451+
452+
3. 处理已删除但未释放空间的文件
453+
454+
```bash
455+
lsof | grep deleted # 查找被删除但未释放的文件
456+
kill -9 [PID] # 重启相关进程
457+
```
458+
459+
460+
461+
### **情景模拟题**
462+
463+
**场景**:服务器响应缓慢,SSH 连接困难,请描述排查思路
464+
465+
**排查步骤**
466+
467+
1. 快速登陆后使用 `w` 查看系统负载
468+
2. `dmesg -T | tail` 检查硬件/驱动错误
469+
3. `vmstat 1` 查看 CPU、内存、IO 综合情况
470+
4. `iostat -x 1` 定位磁盘瓶颈
471+
5. `sar -n DEV 1` 分析网络流量
472+
6. `pidstat -d 1` 找到高 IO 进程
473+
7. `strace -p [PID]` 跟踪进程系统调用
474+
8. 结合业务日志分析异常请求

0 commit comments

Comments
 (0)