Linux系统-基本指令(4)

article/2025/6/17 4:35:18

文章目录

  • touch 指令(2-2.25.00)
  • 知识点(普通文件和文本文件)
  • mkdir 指令
  • 知识点(tree指令)
  • rm 指令
  • man 指令(3-0.00.00)
  • 知识点(Linux下,一切皆为文件)
  • cp 指令(3-1.15.00)
  • 知识点(指令是什么?)

touch 指令(2-2.25.00)

1. touch指令常用的功能有两个,一个是创建文件,一个是修改时间,目前就只需要关注创建文件

[root@hcss-ecs-28ce ~]# ls
dir  hello  test.c  txt.c[root@hcss-ecs-28ce ~]# touch log.txt[root@hcss-ecs-28ce ~]# ls 
dir  hello  log.txt  test.c  txt.c

2. 更新已经存在文件的时间,命令stat log.txt查看该文件更加详细的属性信息
在这里插入图片描述

知识点(普通文件和文本文件)

1. 以-开头的文件类型称作普通文件,而文本文件包括二进制可执行程序,动静态库,视频,音频,图片等
2. 在Linux系统中,文件类型与文件后缀无关!命令mv a.out a.txt,将文件名a.out改为a.txt,指令mv有剪切的作用(后面介绍)

[root@hcss-ecs-28ce ~]# ls
a.out  dir  hello  log.txt  test.c  txt.c[root@hcss-ecs-28ce ~]# ./a.out
hello world[root@hcss-ecs-28ce ~]# mv a.out a.txt[root@hcss-ecs-28ce ~]# ls
a.txt  dir  hello  log.txt  test.c  txt.c[root@hcss-ecs-28ce ~]# ./a.txt
hello world[root@hcss-ecs-28ce ~]# mv a.txt a.jpg[root@hcss-ecs-28ce ~]# ls
a.jpg  dir  hello  log.txt  test.c  txt.c[root@hcss-ecs-28ce ~]# ./a.jpg
hello world

3. 在Linux系统中,文件类型与文件后缀无关,但不代表Linux系统中的软件对文件后缀没有要求,建议带上后缀

[root@hcss-ecs-28ce ~]# ls
dir  hello  test.c
[root@hcss-ecs-28ce ~]# mv test.c test.txt
[root@hcss-ecs-28ce ~]# ls
dir  hello  test.txt
[root@hcss-ecs-28ce ~]# cat test.txt
#include<stdio.h>
int main()
{printf("hello world\n");return 0;
}
[root@hcss-ecs-28ce ~]# gcc test.txt
test.txt: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status

mkdir 指令

1. 命令mkdir mydir创建一个目录,该目录的名字是mydir

[root@hcss-ecs-28ce ~]# ls
dir  hello  test.txt
[root@hcss-ecs-28ce ~]# mkdir mydir
[root@hcss-ecs-28ce ~]# ls
dir  hello  mydir  test.tx

2. 如果想在当前路径下去创建一连串目录,是直接输入命令mkdir a/b/c/d吗?这样行不通,必须得带上选项p,即mkdir -p a/b/c/d

[root@hcss-ecs-28ce ~]# ls 
dir  hello  mydir  test.txt[root@hcss-ecs-28ce ~]# mkdir a/b/c/d
mkdir: cannot create directory ‘a/b/c/d’: No such file or directory[root@hcss-ecs-28ce ~]# mkdir -p a/b/c/d[root@hcss-ecs-28ce ~]# ls
a  dir  hello  mydir  test.txt[root@hcss-ecs-28ce ~]# tree a
a
└── b└── c└── d3 directories, 0 files

知识点(tree指令)

1.tree + 指定目录,以树形结构,展示文件和目录结构

[root@hcss-ecs-28ce ~]# tree .
.
├── a
│   └── b
│       └── c
│           └── d
├── dir
│   ├── a.out
│   └── code.c
├── hello
│   └── file.c
├── mydir
└── test.txt7 directories, 4 files

2. 如果出现信息tree: command not found,则代表你没安装tree指令,输入以下命令安装:yum install -y tree
3.如果指定的目录非常庞大,比如tree /可能就会出现刷屏操作,所以在命令行中,如果出现非法或者刷屏操作,直接ctrl + c

│   │   │       ├── projid_map
│   │   │       ├── root -> /
│   │   │       ├── sched
│   │   │       ├── schedstat
│   │   │       ├── sessionid
│   │   │       ├── setgroups
│   │   │       ├── smaps
^C[root@hcss-ecs-28ce ~]# 

rm 指令

1.rmdir指令只能去删除一个空目录,不能删除一连串目录,rm指令也是如此,如果想递归的去删除目录,必须带上选项r

[root@hcss-ecs-28ce ~]# ls
a  dir  hello  mydir  test.txt
[root@hcss-ecs-28ce ~]# rmdir mydir[root@hcss-ecs-28ce ~]# rmdir a
rmdir: failed to remove ‘a’: Directory not empty[root@hcss-ecs-28ce ~]# rm a
rm: cannot remove ‘a’: Is a directory[root@hcss-ecs-28ce ~]# tree a
a
└── b└── c└── d3 directories, 0 files[root@hcss-ecs-28ce ~]# rm -r a
rm: descend into directory ‘a’? y
rm: descend into directory ‘a/b’? y
rm: descend into directory ‘a/b/c’? y
rm: remove directory ‘a/b/c/d’? y
rm: remove directory ‘a/b/c’? y
rm: remove directory ‘a/b’? y
rm: remove directory ‘a’? y
[root@hcss-ecs-28ce ~]# ls
dir  hello  test.txt

2. 咱们发现要删除一连串目录时每次都会询问,那有时就是不想让它询问,直接进行递归强制删除,则需要带上选项f,即rm -rf a。强制删除普通文件也需带上选项-f,即rm -f test.txt

[root@hcss-ecs-28ce ~]# ls
dir  hello  test.txt[root@hcss-ecs-28ce ~]# mkdir -p a/b/c/d
[root@hcss-ecs-28ce ~]# tree a
a
└── b└── c└── d3 directories, 0 files[root@hcss-ecs-28ce ~]# rm -rf a
[root@hcss-ecs-28ce ~]# ls
dir  hello  test.txt

3. 要特别注意这个递归强制删除指令可别随便乱用。比如rm -rf /,如果递归删除了根目录,那基本上把大部分文件给删除了(有些文件就算是管理员也删除不了),这个系统基本上也就崩溃了,就算没崩溃那基本上也是个大坑,因为你也不知道未来的坑会出现在哪个地方

man 指令(3-0.00.00)

1. man它是一个在线查找手册,可以用它来查找对应的指令和选项,或者去查系统调用的接口(man 2 fork),退出的话直接输入q,回车键(方向键)向下滑动

[root@hcss-ecs-28ce ~]# man pwd
[root@hcss-ecs-28ce ~]# man ls
[root@hcss-ecs-28ce ~]# man touch
[root@hcss-ecs-28ce ~]# man rm

在这里插入图片描述

2. 如果你也不知道man能查找什么,那就查找它自己man man,还可以用来查C语言的函数(不过咱们一般也不会在上面查,一般会通过相应的网站和离线手册)。查找的顺序是依次从上至下去查找,这也是为啥man printf(在1部分)查出来的是指令而不是C语言函数接口(3)

[root@hcss-ecs-28ce ~]# man man
[root@hcss-ecs-28ce ~]# man 3 printf

在这里插入图片描述
3. 前面三个常用选项的粗略阐述,另外如果你查找不到,可能存在两个问题,第一个是你要查找的指令输错了。第二可能是你man手册需要更新,重新安装一次就OK

  • 1 是普通的命令
  • 2 是系统调⽤,如 open,write 之类的(通过这个⾄少可以很⽅便的查到调⽤这个函数,需要加什么头⽂件)
  • 3 是库函数,如printf,fread4是特殊⽂件,也就是 /dev 下的各种设备⽂件

4. 可能会没有安装man手册,直接输入指令yum install -y man-pages(仅限于超级用户root),如果是普通用户则需要提权才能去安装

知识点(Linux下,一切皆为文件)

1.Linux下,一切皆为文件。打印到显示器上→显示器也是文件→写入到显示器文件中。从键盘读取数据→键盘也是文件→从键盘文件读取数据

2. 往显示器文件中写入指定的内容,显示器文件的内容会打印到显示器(屏幕)上

[root@hcss-ecs-28ce ~]# echo hello world
hello world

3. echo可以向显示器文件中写入,也可以向指定文件中写入,这种操作被称作重定向操作中的输出重定向

  • 如果指定文件不存在的话,就新建文件
  • 如果指定文件存在的话,就清空文件内容再写入要输入的内容
[root@hcss-ecs-28ce ~]# ls 
dir  hello
[root@hcss-ecs-28ce ~]# echo hello world > log.txt
[root@hcss-ecs-28ce ~]# ls
dir  hello  log.txt[root@hcss-ecs-28ce ~]# cat log.txt
hello world[root@hcss-ecs-28ce ~]# echo This is my world > log.txt
[root@hcss-ecs-28ce ~]# cat log.txt
This is my world

4. 那如果echo向指定文件中写入,不想让它将文件内容清空,咋办?这里就需要用到追加重定向

[root@hcss-ecs-28ce ~]# cat log.txt
This is my world
[root@hcss-ecs-28ce ~]# echo hello world >> log.txt
[root@hcss-ecs-28ce ~]# cat log.txt
This is my world
hello world

5. 可以往指定文件中写入,也可以从指定文件中读取数据,cat < log.txt(cat log.txt)就是读取log.txt中的文件并写入到显示器文件中,这就是输入重定向

[root@hcss-ecs-28ce ~]# ls
dir  hello  log.txt[root@hcss-ecs-28ce ~]# cat log.txt
This is my world
hello world[root@hcss-ecs-28ce ~]# cat < log.txt
This is my world
hello world

6. cat指令后面什么都不跟,默认从键盘文件读,再写入到显示器文件中,ctrl + c 或 ctrl + z停止写入

[root@hcss-ecs-28ce ~]# cat 
abcdef
abcdef
This is my world
This is my world
hello world
hello world
^C

7. 若log.txt文件不存在,>log.txt则新建文件log.txt,若文件存在,则清空文件内容。ls -l > log.txt,将原本写入到显示器中的文件写入到log.txt文件中

[root@hcss-ecs-28ce ~]# ls
dir  hello  log.txt  text.txt
[root@hcss-ecs-28ce ~]# cat log.txt
This is my world
hello world[root@hcss-ecs-28ce ~]# > log.txt
[root@hcss-ecs-28ce ~]# cat log.txt[root@hcss-ecs-28ce ~]# > code.c
[root@hcss-ecs-28ce ~]# ls
code.c  dir  hello  log.txt  text.txt[root@hcss-ecs-28ce ~]# ls -l >  code.c
[root@hcss-ecs-28ce ~]# cat code.c
total 8
-rw-r--r-- 1 root root    0 May 31 12:04 code.c
drwxr-xr-x 2 root root 4096 May 27 21:09 dir
drwxr-xr-x 2 root root 4096 May 27 18:06 hello
-rw-r--r-- 1 root root    0 May 31 12:03 log.txt
-rw-r--r-- 1 root root    0 May 31 11:58 text.txt

8. 下面的图片中的命令操作是为了验证Linux下,一切皆为文件。看不懂没关系

在这里插入图片描述

// oper_tty.c
int main()
{FILE *fp = fopen("/dev/pts/1", "w");if (fp == NULL){perror("fopen");return 1;}char buffer[1024];while (1){printf("Enter# ");scanf("%s", buffer);fputs(buffer, fp);fflush(fp);}fclose(fp);return 0;
}

在这里插入图片描述

cp 指令(3-1.15.00)

1. 拷贝普通文件,cp + 普通文件 + 指定路径

[root@hcss-ecs-28ce ~]# ls
dir  hello[root@hcss-ecs-28ce ~]# cd hello
[root@hcss-ecs-28ce hello]# pwd
/root/hello[root@hcss-ecs-28ce hello]# ls
file.c[root@hcss-ecs-28ce hello]# cp file.c ../
[root@hcss-ecs-28ce hello]# cd ..
[root@hcss-ecs-28ce ~]# ls
dir  file.c  hello

2. 拷贝目录需要带上选项r,进行递归拷贝。指定路径下可能已经存在该目录(复制过去会覆盖该目录),可能会询问你是否进行覆盖,可带上选项f进行强制拷贝

[root@hcss-ecs-28ce hello]# ls
file.c[root@hcss-ecs-28ce hello]# mkdir -p a/b/c/d
[root@hcss-ecs-28ce hello]# ls
a  file.c[root@hcss-ecs-28ce hello]# cp -rf a ../
[root@hcss-ecs-28ce hello]# cd ..[root@hcss-ecs-28ce ~]# ls
a  dir  hello
[root@hcss-ecs-28ce ~]# tree a
a
└── b└── c└── d3 directories, 0 files

3. 可以以指定名称进行拷贝(拷过去 + 改名称),若该指定名称与指定路径下的其中一个文件名称相同则会覆盖该文件

[root@hcss-ecs-28ce hello]# ls
file.c[root@hcss-ecs-28ce hello]# ls ..
a  dir  hello[root@hcss-ecs-28ce hello]# cp file.c ../log.txt
[root@hcss-ecs-28ce hello]# ls ..
a  dir  hello  log.txt

知识点(指令是什么?)

1. 指令是什么?指令就是一个文本文件,它就是一个可执行程序

在这里插入图片描述

2. 通过which指令就可以快速找到指定的命令文件所处的路径

[root@hcss-ecs-28ce /]# which mkdir
/usr/bin/mkdir

在这里插入图片描述

3. 指令它就是特定系统路径下的程序,只不过这个程序不是咱们写的,而是参与这个开源项目的工程师写的,再预装到这个系统中,所以可以直接执行这个程序

4. 咱们是不建议将自己写的程序或指令放到/usr/bin路径下,会污染系统的指令池。因为系统那么多的指令,时间一久就忘记了,哎这里怎么还有这个命令?

[root@hcss-ecs-28ce ~]# gcc code.c
[root@hcss-ecs-28ce ~]# ll
total 28
drwxr-xr-x 3 root root 4096 May 31 13:51 a
-rwxr-xr-x 1 root root 8360 May 31 14:40 a.out
-rw-r--r-- 1 root root   76 May 31 14:40 code.c
drwxr-xr-x 2 root root 4096 May 27 21:09 dir
drwxr-xr-x 2 root root 4096 May 31 14:06 hello[root@hcss-ecs-28ce ~]# a.out
-bash: /usr/bin/a.out: No such file or directory[root@hcss-ecs-28ce ~]# cp a.out /usr/bin/
[root@hcss-ecs-28ce ~]# a.out
hello world[root@hcss-ecs-28ce ~]# rm -f /usr/bin/a.out
[root@hcss-ecs-28ce ~]# a.out
-bash: /usr/bin/a.out: No such file or directory

5. 上面指令中,咱们用到了命令ll,而它的作用既然和命令ls -l的效果是一致的,这是咋个回事呢?可以理解为命令ll为命令ls -l的别名

[root@hcss-ecs-28ce ~]# ll
total 28
drwxr-xr-x 3 root root 4096 May 31 13:51 a
-rwxr-xr-x 1 root root 8360 May 31 14:40 a.out
-rw-r--r-- 1 root root   76 May 31 14:40 code.c
drwxr-xr-x 2 root root 4096 May 27 21:09 dir
drwxr-xr-x 2 root root 4096 May 31 14:06 hello[root@hcss-ecs-28ce ~]# ls -l
total 28
drwxr-xr-x 3 root root 4096 May 31 13:51 a
-rwxr-xr-x 1 root root 8360 May 31 14:40 a.out
-rw-r--r-- 1 root root   76 May 31 14:40 code.c
drwxr-xr-x 2 root root 4096 May 27 21:09 dir
drwxr-xr-x 2 root root 4096 May 31 14:06 hello[root@hcss-ecs-28ce dir]# which ll
alias ll='ls -l --color=auto'/usr/bin/ls

6. 这是因为在Linux系统中,可以对指定的命令和选项组合起别名。不建议自己随便对命令起别名,alias译为别名,化名。当你自己对命令起别名后,退出xshell,你起的别名就自动清除

在这里插入图片描述

[root@hcss-ecs-28ce dir]# ls
a.out  code.c
[root@hcss-ecs-28ce dir]# alias zhangsan='ls -a -l'(等号和单引号之间不要有空格)
[root@hcss-ecs-28ce dir]# zhangsan
total 36
drwxr-xr-x  2 root root  4096 May 27 21:09 .
dr-xr-x---. 8 root root  4096 May 31 14:40 ..
-rwxr-xr-x  1 root root  8360 May 27 21:09 a.out
-rw-r--r--  1 root root    76 May 27 21:08 code.c
-rw-r--r--  1 root root 12288 May 27 21:19 .code.c.swp[root@hcss-ecs-28ce dir]# which zhangsan
alias zhangsan='ls -a -l'/usr/bin/ls

在这里插入图片描述


http://www.hkcw.cn/article/pbXClfwuTH.shtml

相关文章

光电设计大赛智能车激光对抗方案分享:低成本高效备赛攻略

一、赛题核心难点与备赛痛点解析 全国大学生光电设计竞赛的 “智能车激光对抗” 赛题&#xff0c;要求参赛队伍设计具备激光对抗功能的智能小车&#xff0c;需实现光电避障、目标识别、轨迹规划及激光精准打击等核心功能。从历年参赛情况看&#xff0c;选手普遍面临三大挑战&a…

力扣 208.实现Trie(前缀树)

文章目录 题目介绍题解 题目介绍 题解 解析&#xff1a; 初始化&#xff1a;创建一棵 26 叉树&#xff0c;一开始只有一个根节点 root。26 叉树的每个节点包含一个长为 26 的儿子节点列表 son&#xff0c;以及一个布尔值 end&#xff0c;表示是否为终止节点。 insert&#xf…

WiFi万能钥匙鲲鹏服务器部署 TiDB 集群实战指南

作者&#xff1a; TiDBer_yangxi 原文来源&#xff1a; https://tidb.net/blog/15a234d0 一、环境准备 1. 硬件要求 服务器架构 &#xff1a;鲲鹏服务器&#xff08;ARM架构&#xff09;&#xff0c;TiDB 官方明确支持 ARM 架构服务器部署 推荐配置 &#xff08;生产环…

Java多线程并发常见问题与解决方案

1. 使用不当:竞争与死锁 synchronized保证了同一时刻只有一个线程访问同步块,但过度使用会导致线程争用、性能瓶颈,甚至死锁。当多个线程在不同顺序上请求多个锁时,容易产生循环等待而死锁。 下面示例演示了两个线程互相持有对方需要的锁导致的死锁情况: Object lockA…

Vue 核心技术与实战day06

1. 路由进阶 1.1 路由的封装抽离 1.21 声明式导航 - 导航链接 1.22 声明式导航 - 两个类名 1.23 声明式导航 - 两个类名 import Find from /views/Find import My from /views/My import Friend from /views/Friendimport Vue from vue import VueRouter from vue-router Vue.…

通信接口 之 串口通信

文章目录 通信接口串口通信硬件电路电平标准串口参数及时序串口时序 通信接口 通信协议及特征 通信目的&#xff1a;将一个设备数据传送到另一个设备&#xff0c;扩展硬件系统&#xff0c;如 STM32 外挂芯片需通信实现数据交换和控制。通信协议作用&#xff1a;制定通信规则&…

2020区块链大作业:基于区块链的供应链金融平台

2020区块链大作业&#xff1a;基于区块链的供应链金融平台 【下载地址】2020区块链大作业基于区块链的供应链金融平台 探索区块链在供应链金融的创新应用&#xff0c;本项目基于区块链技术构建了一个功能丰富的供应链金融平台。不仅实现了基础的金融功能&#xff0c;更通过优化…

以太坊是真正的健全货币吗?驳斥比特币极端主义者的误解

比特币极端主义者通常声称&#xff0c;以太坊&#xff08;ETH&#xff09;没有价值&#xff0c;也不是健全货币。他们认为以太坊的基本面不如比特币&#xff08;BTC&#xff09;。然而&#xff0c;以太坊支持者通过强有力的论据反驳这些观点&#xff0c;强调以太坊不断发展的经…

股指期货交割日对股市有哪些影响?

股指期货交割日可能影响股市&#xff0c;因为这时资金流动增加、对冲交易集中&#xff0c;且期货市场的套利行为和市场情绪的变化都可能导致股市短期内的波动。 股指期货交割日效应 我们先说&#xff0c;股指期货的交割日的效应主要是指股指期货的交割日常常会伴随着市场的波动…

Java 大视界 -- Java 大数据在智能家居能源区块链交易与管理中的应用探索(252)

💖亲爱的朋友们,热烈欢迎来到 青云交的博客!能与诸位在此相逢,我倍感荣幸。在这飞速更迭的时代,我们都渴望一方心灵净土,而 我的博客 正是这样温暖的所在。这里为你呈上趣味与实用兼具的知识,也期待你毫无保留地分享独特见解,愿我们于此携手成长,共赴新程!💖 全网…

资产是什么,有那些,普通人可以获得什么?

资产是什么&#xff1f; 资产是指能够带来经济利益的资源&#xff0c;这些资源被企业或个人所拥有或控制&#xff0c;预期在未来能够带来经济利益流入。简单来说&#xff0c;资产就是能够帮助你增加财富、产生收入或减少支出的东西。 资产有哪些类型&#xff1f; 资产可以分为…

跨链代币开发:架起区块链未来的桥梁

跨链代币开发&#xff1a;架起区块链未来的桥梁 ——多链互操作时代的价值流通革命 一、技术突破&#xff1a;构建跨链代币的四大基石 1️⃣ 跨链桥&#xff1a;资产流通的“超级渡轮” 跨链桥通过锁仓与铸造机制实现资产跨链转移&#xff0c;例如Wrapped Bitcoin&#xff08;W…

poet3 Alpha积分总差一口气?3分钟学会高效刷分技巧!

今天给大家说一套刷积分简单快速有效的刷分流程&#xff1a; 首先刷积分最快捷的方法就是选择&#xff1a;PORT3高效、低损耗刷 为什要选择PORT3了&#xff0c;有何优势值得选择PORT3&#xff01; 方法1&#xff1a; 推荐方式&#xff1a;使用 Binance Wallet 无私钥地址参与…

AI炼丹日志-25 - OpenAI 开源的编码助手 Codex 上手指南

点一下关注吧&#xff01;&#xff01;&#xff01;非常感谢&#xff01;&#xff01;持续更新&#xff01;&#xff01;&#xff01; Java篇&#xff1a; MyBatis 更新完毕目前开始更新 Spring&#xff0c;一起深入浅出&#xff01; 大数据篇 300&#xff1a; Hadoop&…

11.springCloud AlibabaNacos服务注册和配置中心

总体介绍&#xff1a; Nacos简介 Nacos 是 Dynamic Naming and Configuration Service的首字母简称&#xff0c;一个更易于构建云原生应用的动态服务发现、配置管理和服务管理平台。 Nacos 致力于帮助您发现、配置和管理微服务。Nacos 提供了一组简单易用的特性集&#xff0c;帮…

32所新大学来了 有何深意 职业本科加速扩容

职业本科高校正在加速扩容。近日,教育部发布公示,拟同意设置安徽职业技术大学、宁夏职业技术大学、苏州职业技术大学等32所学校。此次拟同意设置的本科高校中,23所为职业本科高校,均由高职专科升级而来,均为公办。自2019年以来,教育部已批准设立了60所本科层次职业学校。…

《碟中谍8》成端午档首日票房冠军 单日票房1.45亿

根据猫眼专业版数据,截至2025年5月31日21时,端午节单日票房达到1.45亿元,观影人次为366.1万,放映场次达43.2万。《碟中谍8:最终清算》成为当天的票房冠军。端午档首日票房前五名依次为: - 《碟中谍8:最终清算》 - 《哆啦A梦:大雄的绘画奇遇记》 - 《时间之子》 - 《星际…

团中央书记处书记王艺有新职 当选全国少工委常务副主任

5月28日上午,中国少年先锋队第九届全国工作委员会第一次全体会议在京举行。会议选举教育部副部长王嘉毅、共青团中央书记处书记王艺为全国少工委常务副主任。王艺出生于1980年5月,河南许昌人,研究生学历,哲学博士。她现任共青团中央书记处书记、全国青联副主席、全国少工委…

66条预警齐发!浙江将迎暴雨 多地需防次生灾害

今天雨水持续,截至早上6:45分,浙江共有66条气象预警,其中暴雨预警43条。大家出门需提高警惕。昨天下午,浙西北地区开始下雨。预计雨量最大的时段为5月31日后半夜至6月2日上午,浙中北有大雨暴雨,杭嘉湖大部、宁绍北部、衢州西北部局部有大暴雨。强对流天气以短时暴雨为主,…

Redisson学习专栏(四):实战应用(分布式会话管理,延迟队列)

文章目录 前言一、为什么需要分布式会话管理&#xff1f;1.1 使用 Redisson 实现 Session 共享 二、订单超时未支付&#xff1f;用延迟队列精准处理2.1 RDelayedQueue 核心机制2.2 订单超时处理实战 总结 前言 在现代分布式系统中&#xff0c;会话管理和延迟任务处理是两个核心…