Linux Bash 中使用重定向运算符的 5 种方法
注:机翻,未校。
Five ways to use redirect operators in Bash
Posted: January 22, 2021 | by Damon Garn
Redirect operators are a basic but essential part of working at the Bash command line. See how to safely redirect input and output to make your Linux sysadmin life easier.
重定向操作符是在 Bash 命令行中工作的一个基本但重要的部分。了解如何安全地重定向输入和输出,从而简化 Linux 系统管理员的工作。
Photo by Kind and Curious on Unsplash
Data is entered into the computer via stdin (usually the keyboard), and the resulting output goes to stdout (usually the shell). These pathways are called streams. However, it’s possible to alter these input and output locations, causing the computer to get information from somewhere other than stdin or send the results somewhere other than stdout. This functionality is referred to as redirection.
数据通过 stdin(通常是键盘)输入到计算机中,生成的输出进入 stdout(通常是 shell)。这些路径称为流。但是,可能会更改这些输入和输出位置,从而导致计算机从 stdin 以外的位置获取信息,或者将结果发送到 stdout 以外的位置。此功能称为重定向。
In this article, you’ll learn five redirect operators, including one for stderr. I’ve provided examples of each and presented the material in a way that you can duplicate on your own Linux system.
在本文中,您将学习 5 个重定向运算符,包括一个用于 stderr 的运算符。我提供了每个示例,并以您可以在自己的 Linux 系统上复制的方式呈现这些材料。
Regular output > operator 常规输出>运算符
The output redirector is probably the most recognized of the operators. The standard output (stdout) is usually to the terminal window. For example, when you type the date
command, the resulting time and date output is displayed on the screen.
输出重定向器可能是运算符中最受认可的。标准输出 (stdout) 通常发送到终端窗口。例如,当您键入 date
命令时,生成的时间和日期输出将显示在屏幕上。
[damon@localhost ~]$ date
Tue Dec 29 04:07:37 PM MST 2020
[damon@localhost ~]$
It is possible, however, to redirect this output from stdout to somewhere else. In this case, I’m going to redirect the results to a file named specifications.txt
. I’ll confirm it worked by using the cat
command to view the file contents.
但是,可以将此输出从 stdout 重定向到其他位置。在本例中,我要将结果重定向到名为 specifications.txt
的文件。我将通过使用 cat
命令查看文件内容来确认它是否正常工作。
[damon@localhost ~]$ date > specifications.txt
[damon@localhost ~]$ cat specifications.txt
Tue Dec 29 04:08:44 PM MST 2020
[damon@localhost ~]$
The problem with the >
redirector is that it overwrites any existing data in the file. At this stage, you now have date
information in the specifications.txt
file, right? If you type hostname > specifications.txt
, the output will be sent to the text file, but it will overwrite the existing time and date information from the earlier steps.
>
重定向器的问题在于它会覆盖文件中的所有现有数据。在此阶段,您现在在 specifications.txt
文件中有 date
信息,对吧?如果键入 hostname > specifications.txt
,输出将发送到文本文件,但会覆盖先前步骤中的现有时间和日期信息。
[damon@localhost ~]$ hostname > specifications.txt
[damon@localhost ~]$ cat specifications.txt
localhost.localdomain
[damon@localhost ~]$
It is easy to get in trouble with the >
redirector by accidentally overwriting existing information.
由于意外覆盖现有信息,很容易在使用 >
重定向器时遇到麻烦。
Regular output append >> operator 常规输出追加>>运算符
The append >>
operator adds the output to the existing content instead of overwriting it. This allows you to redirect the output from multiple commands to a single file. For example, I could redirect the output of date
by using the >
operator and then redirect hostname
and uname -r
to the specifications.txt
file by using >>
operator.
追加 >>
运算符将输出添加到现有内容中,而不是覆盖它。这使您可以将多个命令的输出重定向到单个文件。例如,我可以使用 >
运算符重定向 date
的输出,然后使用 >>
运算符将 hostname
和 uname -r
重定向到 specifications.txt
文件。
[damon@localhost ~]$ date > specifications.txt
[damon@localhost ~]$ hostname >> specifications.txt
[damon@localhost ~]$ uname -r >> specifications.txt
[damon@localhost ~]$ cat specifications.txt
Tue Dec 29 04:11:51 PM MST 2020
localhost.localdomain
5.9.16-200.fc33.x86_64
[damon@localhost ~]$
Note: The >>
redirector even works on an empty file. That means that you could conceivably
注意:>>
重定向器甚至可以处理空文件。
ignore the regular >
redirector to alleviate the potential to overwrite data, and always rely on the >>
redirector instead. It’s not a bad habit to get into.
忽略常规 >
重定向器以减轻覆盖数据的可能性,并始终依赖 >>
重定向器。养成这不是一个坏习惯。
Regular input < operator 常规输入<运算符
The input redirector pulls data in a stream from a given source. Usually, programs receive their input from the keyboard. However, data can be pulled in from another source, such as a file.
输入重定向器从给定源拉取流中的数据。通常,程序从键盘接收输入。但是,可以从其他源(例如文件)拉取数据。
It’s time to build an example by using the sort
command. First, create a text file named mylist.txt
that contains the following lines:
现在是使用 sort
命令构建示例的时候了。首先,创建一个名为 mylist.txt
的文本文件,其中包含以下行:
cat
dog
horse
cow
Observe that the animals are not listed in alphabetical order.
请注意,这些动物不是按字母顺序列出的。
What if you need to list them in order? You can pull the contents of the file into the sort
command by using the <
operator.
如果您需要按顺序列出它们怎么办?您可以使用 <
运算符将文件的内容拉入 sort
命令。
[damon@localhost ~]$ sort < mylist.txt
cat
cow
dog
horse
[damon@localhost ~]$
You could even get a little fancier and redirect the sorted results to a new file:
您甚至可以更花哨一点,并将排序结果重定向到新文件:
[damon@localhost ~]$ sort < mylist.txt > alphabetical-file.txt
[damon@localhost ~]$ cat alphabetical-file.txt
cat
cow
dog
horse
[damon@localhost ~]$
Regular error 2> operator 常规错误 2> 运算符
The stdout displays expected results. If errors appear, they are managed differently. Errors are labeled as file descriptor 2 (standard output is file descriptor 1). When a program or script does not generate the expected results, it throws an error. The error is usually sent to the stdout, but it can be redirected elsewhere. The stderr operator is 2>
(for file descriptor 2).
stdout 显示预期结果。如果出现错误,将以不同的方式进行管理。错误被标记为文件描述符 2(标准输出为文件描述符 1)。当程序或脚本未生成预期结果时,它会引发错误。错误通常会发送到 stdout,但可以将其重定向到其他地方。stderr 运算符为 2>
(用于文件描述符 2)。
Here is a simple example, using the misspelled ping
command:
下面是一个简单的示例,使用拼写错误的 ping
命令:
[damon@localhost ~]$ png
bash: png: command not found...
[damon@localhost ~]$
Here is the same misspelled command with the error output redirected to /dev/null
:
这是相同的拼写错误命令,错误输出重定向到 /dev/null
:
[damon@localhost ~]$ png 2> /dev/null
[damon@localhost ~]$
Skip to the bottom of list
Automation advice 自动化建议
Ansible Automation Platform beginner’s guide Ansible 自动化平台初学者指南
A system administrator’s guide to IT automation IT 自动化系统管理员指南
Ansible Automation Platform trial subscription Ansible 自动化平台试用订阅
Automate Red Hat Enterprise Linux with Ansible and Satellite 使用 Ansible 和 Satellite 实现红帽企业 Linux 的自动化
The resulting error message is redirected to /dev/null
instead of the stdout, so no result or error message is displayed on the screen.
生成的错误消息将重定向到 /dev/null
而不是 stdout,因此屏幕上不会显示任何结果或错误消息。
Note: /dev/null
, or the bit bucket, is used as a garbage can for the command line. Unwanted output can be redirected to this location to simply make it disappear. For example, perhaps you’re writing a script, and you want to test some of its functionality, but you know it will throw errors that you don’t care about at this stage of development. You can run the script and tell it to redirect errors to /dev/null
for convenience.
注意:/dev/null
,即位桶,用作命令行的垃圾桶。不需要的输出可以重定向到此位置,以使其消失。例如,也许您正在编写一个脚本,并且想要测试其中的一些功能,但您知道它会抛出您在此开发阶段不关心的错误。为方便起见,您可以运行脚本并告诉它将错误重定向到 /dev/null
。
Pipe | operator 管道 | 运算符
Ken Hess already has a solid article on using the pipe |
operator, so I’m only going to show a very quick demonstration here.
Ken Hess 已经有一篇关于使用 pipe |
运算符的扎实文章,所以我在这里只打算展示一个非常快速的演示。
The pipe takes the output of the first command and makes it the input of the second command. You might want to see a list of all directories and files in the /etc
directory. You know that’s going to be a long list and that most of the output will scroll off the top of the screen. The less
command will break the output into pages, and you can then scroll upward or downward through the pages to display the results. The syntax is to issue the ls
command to list the contents of /etc
, and then use pipe to send that list into less
so that it can be broken into pages.
管道接收第一个命令的输出,并使其成为第二个命令的输入。您可能希望查看 /etc
目录中所有目录和文件的列表。你知道这将是一个很长的列表,大部分输出将从屏幕顶部滚动。less
命令会将输出分解为多个页面,然后您可以向上或向下滚动页面以显示结果。语法是发出 ls
命令列出 /etc
的内容,然后使用管道将该列表发送到 less
中,以便可以将其分解为多个页面。
[damon@localhost ~]$ ls /etc | less
Ken’s article has many more great examples. Personally, I find myself using *command* | less
and *command* | grep *string*
the most often.
Ken 的文章还有很多很好的例子。就我个人而言,我发现自己最常使用 *command* | less
和 *command* | grep *string*
。
Download now: A sysadmin’s guide to Bash scripting.
Wrap up 总结
Redirect operators are very handy, and I hope this brief summary has provided you with some tricks for manipulating input and output. The key is to remember that the >
operator will overwrite existing data.
重定向运算符非常方便,我希望这个简短的摘要为您提供了一些操作输入和输出的技巧。关键是要记住 >
运算符将覆盖现有数据。
Bash Redirections Cheat Sheet
Redirection | Description |
---|---|
cmd > file | Redirect the standard output (stdout) of cmd to a file. |
cmd 1> file | Same as cmd > file. 1 is the default file descriptor (fd) for stdout. |
cmd 2> file | Redirect the standard error (stderr) of cmd to a file. 2 is the default fd for stderr. |
cmd >> file | Append stdout of cmd to a file. |
cmd 2>> file | Append stderr of cmd to a file. |
cmd &> file | Redirect stdout and stderr of cmd to a file. |
cmd > file 2>&1 | Another way to redirect both stdout and stderr of cmd to a file. This is not the same as cmd 2>&1 > file. Redirection order matters! |
cmd > /dev/null | Discard stdout of cmd. |
cmd 2> /dev/null | Discard stderr of cmd. |
cmd &> /dev/null | Discard stdout and stderr of cmd. |
cmd < file | Redirect the contents of the file to the standard input (stdin) of cmd. |
cmd << EOL line1 line2 EOL | Redirect a bunch of lines to the stdin. If ‘EOL’ is quoted, text is treated literally. This is called a here-document. |
cmd <<-EOL <tab>foo <tab><tab>bar EOL | Redirect a bunch of lines to the stdin and strip the leading tabs. |
cmd <<< “string” | Redirect a single line of text to the stdin of cmd. This is called a here-string. |
exec 2> file | Redirect stderr of all commands to a file forever. |
exec 3< file | Open a file for reading using a custom file descriptor. |
exec 3> file | Open a file for writing using a custom file descriptor. |
exec 3< > file | Open a file for reading and writing using a custom file descriptor. |
exec 3>&- | Close a file descriptor. |
exec 4>&3 | Make file descriptor 4 to be a copy of file descriptor 3. (Copy fd 3 to 4.) |
exec 4>&3- | Copy file descriptor 3 to 4 and close file descriptor 3. |
echo “foo” >&3 | Write to a custom file descriptor. |
cat <&3 | Read from a custom file descriptor. |
(cmd1; cmd2) > file | Redirect stdout from multiple commands to a file (using a sub-shell). |
{ cmd1; cmd2; } > file | Redirect stdout from multiple commands to a file (faster; not using a sub-shell). |
exec 3< > /dev/tcp/host/port | Open a TCP connection to host:port. (This is a bash feature, not Linux feature). |
exec 3< > /dev/udp/host/port | Open a UDP connection to host:port. (This is a bash feature, not Linux feature). |
cmd <(cmd1) | Redirect stdout of cmd1 to an anonymous fifo, then pass the fifo to cmd as an argument. Useful when cmd doesn’t read from stdin directly. |
cmd < <(cmd1) | Redirect stdout of cmd1 to an anonymous fifo, then redirect the fifo to stdin of cmd. Best example: diff <(find /path1 | sort) <(find /path2 | sort). |
cmd <(cmd1) <(cmd2) | Redirect stdout of cmd1 and cmd2 to two anonymous fifos, then pass both fifos as arguments to cmd. |
cmd1 >(cmd2) | Run cmd2 with its stdin connected to an anonymous fifo, and pass the filename of the pipe as an argument to cmd1. |
cmd1 > >(cmd2) | Run cmd2 with its stdin connected to an anonymous fifo, then redirect stdout of cmd to this anonymous pipe. |
cmd1 | cmd2 | Redirect stdout of cmd1 to stdin of cmd2. Pro-tip: This is the same as cmd1 > >(cmd2), same as cmd2 < <(cmd1), same as > >(cmd2) cmd1, same as < <(cmd1) cmd2. |
cmd1 |& cmd2 | Redirect stdout and stderr of cmd1 to stdin of cmd2 (bash 4.0+ only). Use cmd1 2>&1 | cmd2 for older bashes. |
cmd | tee file | Redirect stdout of cmd to a file and print it to screen. |
exec {filew}> file | Open a file for writing using a named file descriptor called {filew} (bash 4.1+). |
cmd 3>&1 1>&2 2>&3 | Swap stdout and stderr of cmd. |
cmd > >(cmd1) 2> >(cmd2) | Send stdout of cmd to cmd1 and stderr of cmd to cmd2. |
cmd1 | cmd2 | cmd3 | cmd4 echo ${PIPESTATUS[@]} | Find out the exit codes of all piped commands. |
via:
- Five ways to use redirect operators in Bash | Enable Sysadmin Posted: January 22, 2021 | by Damon Garn
https://www.redhat.com/sysadmin/redirect-operators-bash
相关文章:
Linux Bash 中使用重定向运算符的 5 种方法
注:机翻,未校。 Five ways to use redirect operators in Bash Posted: January 22, 2021 | by Damon Garn Redirect operators are a basic but essential part of working at the Bash command line. See how to safely redirect input and output t…...
opengrok_windows_环境搭建
目录 软件列表 软件安装 工程索引 编辑 工程部署 问题列表 软件列表 软件名下载地址用途JDKhttps://download.java.net/openjdk/jdk16/ri/openjdk-1636_windows-x64_bin.zipindex 使用java工具tomcathttps://dlcdn.apache.org/tomcat/tomcat-9/v9.0.98/bin/apache-tom…...
【无法下载github文件】虚拟机下ubuntu无法拉取github文件
修改hosts来进行解决。 步骤一:打开hosts文件 sudo vim /etc/hosts步骤二:查询 github.com的ip地址 https://sites.ipaddress.com/github.com/#ipinfo将github.com的ip地址添加到hosts文件末尾,如下所示。 140.82.114.3 github.com步骤三…...
python——句柄
一、概念 句柄指的是操作系统为了标识和访问对象而提供的一个标识符,在操作系统中,每个对象都有一个唯一的句柄,通过句柄可以访问对象的属性和方法。例如文件、进程、窗口等都有句柄。在编程中,可以通过句柄来操作这些对象&#x…...
.Net Core微服务入门系列(一)——项目搭建
系列文章目录 1、.Net Core微服务入门系列(一)——项目搭建 2、.Net Core微服务入门全纪录(二)——Consul-服务注册与发现(上) 3、.Net Core微服务入门全纪录(三)——Consul-服务注…...
Net Core微服务入门全纪录(三)——Consul-服务注册与发现(下)
系列文章目录 1、.Net Core微服务入门系列(一)——项目搭建 2、.Net Core微服务入门全纪录(二)——Consul-服务注册与发现(上) 3、.Net Core微服务入门全纪录(三)——Consul-服务注…...
[苍穹外卖] 1-项目介绍及环境搭建
项目介绍 定位:专门为餐饮企业(餐厅、饭店)定制的一款软件产品 功能架构: 管理端 - 外卖商家使用 用户端 - 点餐用户使用 技术栈: 开发环境的搭建 整体结构: 前端环境 前端工程基于 nginx 运行 - Ngi…...
【PCIe 总线及设备入门学习专栏 2 -- PCIe 的 LTSSM 和 Enumeration】
文章目录 OverviewLTSSM StatesDetect StatesDETECT_QUIETDETECT_ACTDETECT_WAITPolling StatesPOLL_ACTIVEPOLL_CONFIGPOLL_COMPLIANCEConfiguration StatesCONFIG_LINKWD_STARTCONFIG_LINKWD_ACCEPTCONFIG_LANENUM_WAITCONFIG_LANENUM_ACCEPTCONFIG_COMPLETECONFIG_IDLERecov…...
Redis 性能优化:多维度技术解析与实战策略
文章目录 1 基准性能2 使用 slowlog 优化耗时命令3 big key 优化4 使用 lazy free 特性5 缩短键值对的存储长度6 设置键值的过期时间7 禁用耗时长的查询命令8 使用 Pipeline 批量操作数据9 避免大量数据同时失效10 客户端使用优化11 限制 Redis 内存大小12 使用物理机而非虚拟机…...
QT开发技术 【基于TinyXml2的对类进行序列化和反序列化】一
一、对TinyXml2 进行封装 使用宏 实现序列化和反序列化 思路: 利用宏增加一个类函数,使用序列化器调用函数进行序列化 封装宏示例 #define XML_SERIALIZER_BEGIN(ClassName) \ public: \virtual void ToXml(XMLElement* parentElem, bool bSerialize …...
麦田物语学习笔记:创建TransitionManager控制人物场景切换
基本流程 制作场景之间的切换 1.代码思路 (1)为了实现不同场景切换,并且保持当前的persistentScene一直存在,则需要一个Manager去控制场景的加载和卸载,并且在加载每一个场景之后,都要将当前的场景Set Active Scene,保证其为激活的场景,在卸载的时候也可以方便调用当前激活的场…...
2025年最新汽车零部件企业销售项目管理解决方案
在汽车零部件企业,销售项目管理的不规范和销售预测的不准确性常导致生产计划无法及时调整,因此客户关系常常中断,导致企业业务机会的丧失。为解决该问题,企业需要投入更多资源以优化销售流程与销售预测。 1、360多维立体客户视图…...
创建基于Prism框架的WPF应用(NET Framework)项目
创建基于Prism框架的WPF应用(NET Framework)项目 1、创建WPF(NET Framework)项目并整理结构 (1)、创建WPF(NET Framework)项目; (2)、添加Views和…...
AIGC视频生成模型:Meta的Emu Video模型
大家好,这里是好评笔记,公主号:Goodnote,专栏文章私信限时Free。本文详细介绍Meta的视频生成模型Emu Video,作为Meta发布的第二款视频生成模型,在视频生成领域发挥关键作用。 🌺优质专栏回顾&am…...
【PowerQuery专栏】PowerQuery提取XML数据
XML数据和Json 数据类型都是比较典型的层次数据类型,XML的数据格式非常的对称。所有的数据均是由标签对组成,图为典型的XML文件类型的数据。 在PowerQuery中进行XML数据类型解析采用的是Xml.Document 函数来进行文件内容的解析,Xml.Document 目前有三个可用参数。 参数1为数…...
流行的开源高性能数据同步工具 - Apache SeaTunnel 整体架构运行原理
概述 背景 数据集成在现代企业的数据治理和决策支持中扮演着至关重要的角色。随着数据源的多样化和数据量的迅速增长,企业需要具备强大的数据集成能力来高效地处理和分析数据。SeaTunnel通过其高度可扩展和灵活的架构,帮助企业快速实现多源数据的采集、…...
基于单片机的多功能蓝牙语音智能台灯(论文+源码)
1总体方案设计 通过需求分析,本设计多功能蓝牙语音智能台灯的系统框图如图2.1所示,系统架构包括主控制器STM32F103单片机、HC-06蓝牙通信模块、LU-ASR01语音识别模块、OLED液晶、LED灯、按键等器件,在使用时用户可以通过手机APP、语音识别、…...
leetcode刷题记录(七十二)——146. LRU 缓存
(一)问题描述 146. LRU 缓存 - 力扣(LeetCode)146. LRU 缓存 - 请你设计并实现一个满足 LRU (最近最少使用) 缓存 [https://baike.baidu.com/item/LRU] 约束的数据结构。实现 LRUCache 类: * LRUCache(int capacity)…...
力扣203题(3)
题目及之前的两种解法大家可以移步到这里: https://blog.csdn.net/suibiansa_/article/details/145242573?spm1001.2014.3001.5501 力扣203题—— 移除链表元素-CSDN博客 今天呢我们来写一下第三种解法: 虚拟创建一个头结点 ListNode firstnew Lis…...
网络安全:信息时代的守护者
随着互联网的快速发展,网络安全问题日益成为全球关注的焦点。无论是个人用户、企业组织还是政府部门,网络安全都已成为保障信息安全、保护隐私、确保社会秩序的基石。在这个数字化时代,如何应对复杂多变的网络安全威胁,成为了我们…...
【博客之星2024年度总评选】年度回望:我的博客之路与星光熠熠
【个人主页】Francek Chen 【人生格言】征途漫漫,惟有奋斗! 【热门专栏】大数据技术基础 | 数据仓库与数据挖掘 | Python机器学习 文章目录 前言一、个人成长与盘点(一)机缘与开端(二)收获与分享 二、年度创…...
接口自动化测试
APITEST: 接口自动化测试 目录结构介绍: conf目录:用来存放项目运行环境、执行环境相关的配置参数 testsuite目录:测试用例在此目录编写,pytest默认约定test开头的文件和方法为测试用例,不满足条件的不会被执行&#x…...
题海拾贝:力扣 138.随机链表的复制
Hello大家好!很高兴我们又见面啦!给生活添点passion,开始今天的编程之路! 我的博客:<但凡. 我的专栏:《编程之路》、《数据结构与算法之美》、《题海拾贝》 欢迎点赞,关注! 1、题…...
第7章:Python TDD测试Franc对象乘法功能
写在前面 这本书是我们老板推荐过的,我在《价值心法》的推荐书单里也看到了它。用了一段时间 Cursor 软件后,我突然思考,对于测试开发工程师来说,什么才更有价值呢?如何让 AI 工具更好地辅助自己写代码,或许…...
PyTorch基本功能与实现代码
PyTorch是一个开源的深度学习框架,提供了丰富的函数和工具,以下为其主要功能的归纳: 核心数据结构: • 张量(Tensor):类似于Numpy的ndarray,是PyTorch中基本的数据结构,…...
【2024 CSDN博客之星】技术洞察类:从DeepSeek-V3的成功,看MoE混合专家网络对深度学习算法领域的影响(MoE代码级实战)
目录 一、引言 1.1 本篇文章侧重点 1.2 技术洞察—MoE(Mixture-of-Experts,混合专家网络) 二、MoE(Mixture-of-Experts,混合专家网络) 2.1 技术原理 2.2 技术优缺点 2.3 业务代码实践 2.3.1 业务场…...
Single-Model and Any-Modality for Video Object Tracking——2024——cvpr-阅读笔记
Single-Model and Any-Modality for Video Object Tracking 摘要相关工作创新处MethodShared embeddingModal promptingRGB Tracker based on TransformerOverall ExperiimentDatasetRGB-D samples are sourced from DepthTrackRGB-T samples are extracted from LasHeRRGB-E s…...
Java中的构造器
Java中的构造器详解 1. 什么是构造器 构造器(Constructor) 是一种特殊的方法,用于在创建对象时初始化对象的状态。构造器的名字必须与类名相同,且没有返回类型,连 void 也不能使用。 2. 构造器的特点 名称与类名相同…...
Restormer: Efficient Transformer for High-Resolution Image Restoration解读
论文地址:Restormer: Efficient Transformer for High-Resolution Image Restoration。 摘要 由于卷积神经网络(CNN)在从大规模数据中学习可推广的图像先验方面表现出色,这些模型已被广泛应用于图像复原及相关任务。近年来&…...
将 AzureBlob 的日志通过 Azure Event Hubs 发给 Elasticsearch(3.纯python的实惠版)
前情: 将 AzureBlob 的日志通过 Azure Event Hubs 发给 Elasticsearch(1.标准版)-CSDN博客 将 AzureBlob 的日志通过 Azure Event Hubs 发给 Elasticsearch(2.换掉付费的Event Hubs)-CSDN博客 python脚本实现 厉害的…...
成就与远见:2024年技术与思维的升华
个人主页:chian-ocean 前言: 2025年1月17日,2024年博客之星年度评选——创作影响力评审的入围名单公布。我很荣幸能够跻身Top 300,虽然与顶尖博主仍有一定差距,但这也为我提供了更加明确的发展方向与指引。展望崭新的2025年&…...
BGP分解实验·9——路由聚合与条件性通告(1)
路由聚合是有效控制缩减BGP路由表的方法之一,路由聚合的前提和IGP一样,需要有路由目标存在BGP表中,与IGP不同的是,BGP路由聚合可以定义按需抑制路由的能力。 实验拓扑如下所示: 现在开始把从R1的R5的基础配置先准备好…...
栈和队列(C语言)
目录 数据结构之栈 定义 实现方式 基本功能实现 1)定义,初始化栈 2)入栈 3)出栈 4)获得栈顶元素 5)获得栈中有效元素个数 6)检测栈是否为空 7)销毁栈 数据结构之队列 定义 实现方…...
Jenkins-获取build用户信息
需求: 代码发布后,将发布结果发送至相关运维同学邮箱,需要获取发布人的信息。jenkins默认是没有相关内置变量的。 需要通过插件的方式进行解决: 插件: user build vars plugin 部署后,可使用的变量&…...
大数据学习(37)- Flink运行时架构
&&大数据学习&& 🔥系列专栏: 👑哲学语录: 承认自己的无知,乃是开启智慧的大门 💖如果觉得博主的文章还不错的话,请点赞👍收藏⭐️留言📝支持一下博主哦ᾑ…...
opengrok_windows_多工程环境搭建
目录 多工程的目录 工程代码下载和log配置 工程的索引 工程部署 工程测试 参考列表 多工程的目录 工程代码下载和log配置 工程代码下载 在每个工程的src目录下,下载工程代码,以下载pulseaudio的代码为例。 git clone gitgithub.com…...
Python网络自动化运维---SSH模块
目录 SSH建立过程 实验环境准备 一.SSH模块 1.1.Paramiko模块 1.1.1实验代码 1.1.2代码分段讲解 1.1.3代码运行过程 1.2Netmiko模块 Netmiko模块对比paramiko模块的改进: 1.2.1实验代码 1.2.2代码分段讲解 1.2.3代码运行过程 二.Paramiko模块和Ne…...
Failed to restart nginx.service Unit nginx.service not found
当你遇到 Failed to restart nginx.service: Unit nginx.service not found 错误时,这意味着系统无法找到 Nginx 的服务单元文件。这通常是因为 Nginx 没有通过 systemd 管理,或者 Nginx 没有正确安装。 解决方法 1. 检查 Nginx 是否正确安装 首先&am…...
学习记录之原型,原型链
构造函数创建对象 Person和普通函数没有区别,之所以是构造函数在于它是通过new关键字调用的,p就是通过构造函数Person创建的实列对象 function Person(age, name) {this.age age;this.name name;}let p new Person(18, 张三);prototype prototype n…...
【Redis】5种基础数据结构介绍及应用
考察频率难度60%⭐⭐ 这个方向的问题也是非常基础的,所以一般不会直接被当做一个单独的问题。常见的形式是结合你简历上的项目或者场景题来提问,即实际应用场景、是否可以优化、如何选择等。 由于场景题和实际项目差异较大,所以本文就只做基…...
基于GRU实现股价多变量时间序列预测(PyTorch版)
前言 系列专栏:【深度学习:算法项目实战】✨︎ 涉及医疗健康、财经金融、商业零售、食品饮料、运动健身、交通运输、环境科学、社交媒体以及文本和图像处理等诸多领域,讨论了各种复杂的深度神经网络思想,如卷积神经网络、循环神经网络、生成对抗网络、门控循环单元、长短期记…...
Java Web开发高级——Spring Boot与Docker容器化部署
随着云计算和微服务架构的快速发展,容器化已成为现代应用部署的重要手段。Docker作为最受欢迎的容器化技术之一,使得开发者能够将应用及其所有依赖打包到一个可移植的容器中,简化了开发、测试、部署和运维的流程。本篇文章将通过以下内容讲解…...
计算机网络——网络层
重点内容: (1) 虚拟互连网络的概念。 (2) IP 地址与物理地址的关系。 (3) 传统的分类的 IP 地址(包括子网掩码)和无分类域间路由选择 CIDR 。 (4) 路由选择协议的工作原理。 目录 重点内容: 一.网络层提供的两种服务 二…...
每打开一个chrome页面都会【自动打开F12开发者模式】,原因是 使用HBuilderX会影响谷歌浏览器的浏览模式
打开 HBuilderX,点击 运行 -> 运行到浏览器 -> 设置web服务器 -> 添加chrome浏览器安装路径 chrome谷歌浏览器插件 B站视频下载助手插件: 参考地址:Chrome插件 - B站下载助手(轻松下载bilibili哔哩哔哩视频)…...
cesium绕点旋转
绕点旋转的原理可以理解为相机一直看向一个点,不断改变相机的位置 let position Cesium.Cartesian3.fromDegrees(longitude, latitude) let lookAtTimer setInterval(() > {let heading viewer.camera.heading;let pitch viewer.camera.pitch;if (heading &…...
JavaScript系列(36)--微服务架构详解
JavaScript微服务架构详解 🏗️ 今天,让我们深入了解JavaScript的微服务架构,这是构建大规模分布式系统的关键技术。 微服务基础概念 🌟 💡 小知识:微服务架构是一种将应用程序构建为一组小型服务的方法&…...
神经网络基础 | 给定条件下推导对应的卷积层参数
神经网络基础 | 给定条件下推导对应的卷积层参数 按照 PyTorch 文档中 给定的设置: H o u t ⌊ H i n 2 padding [ 0 ] − dilation [ 0 ] ( kernel_size [ 0 ] − 1 ) − 1 stride [ 0 ] 1 ⌋ H_{out} \left\lfloor\frac{H_{in} 2 \times \text{padding}[0]…...
面向CTF的python_requests库的学习笔记
看师傅们写的各种脚本羡慕不已,自己却只会一点一点手搓,于是来做个笔记 requests库是干嘛的? 顾名思义,request就是请求,可以用来向服务器发送请求。它可以代替你在网站上发送请求报文,并接受回应报文。简…...
MIAOYUN信创云原生项目亮相西部“中试”生态对接活动
近日,以“构建‘中试’生态,赋能科技成果转化”为主题的“科创天府智汇蓉城”西部“中试”生态对接活动在成都高新区菁蓉汇隆重开幕。活动分为成果展览、“中试”生态主场以及成果路演洽谈对接三大板块。在成果展览环节,成都元来云志科技有限…...
Papers with Code:从代码索引到AI创新引擎
标题:Papers with Code:从代码索引到AI创新引擎 文章信息摘要: Papers with Code从解决机器学习论文代码复现的特定需求起步,通过建立全面的ML资源库和首个系统性leaderboard系统,快速积累了大量用户基础。被Meta收购…...