当前位置: 首页 > news >正文

【Linux系统】Linux基础指令

l i n u x linux linux 命令是对 L i n u x Linux Linux 系统进行管理的命令。对于 L i n u x Linux Linux 系统来说,无论是中央处理器、内存、磁盘驱动器、键盘、鼠标,还是用户等都是文件 L i n u x Linux Linux 系统管理的命令是它正常运行的核心,与之前的 D O S DOS DOS 命令类似。 l i n u x linux linux 命令在系统中有两种类型:内置 S h e l l Shell Shell 命令和 L i n u x Linux Linux 命令。

文章目录

  • 一、Linux 基础知识
    • 1. 文件系统常识
    • 2. 路径(文件结构)
    • 3. 文件类型
    • 4. 重定向
  • 二、Linux 基本指令
    • 1. 常用指令
      • (1) ls 指令
      • (2) pwd 指令
      • (3) cd 指令
      • (4) touch 指令
      • (5) mkdir 指令(重要)
      • (6) rmdir 指令(重要)
      • (7) rm 指令(重要)
      • (8) man 指令(重要)
      • (9) cp 指令(重要)
      • (10) mv 指令(重要)
      • (11) cat 指令
      • (12) more 指令(重要)
      • (13) less 指令(重要)
      • (14) head 指令
      • (15) tail 指令
      • (16) date 指令
      • (17) cal 指令
      • (18) find 指令(非常重要)
      • (19) which 指令
      • (20) whereis 指令
      • (21) alias 指令
      • (22) grep 指令
      • (23) zip/unzip 指令
      • (24) tar 指令(重要)
      • (25) bc 指令
      • (26) uname -r 指令
      • (27) 关机
    • 2. 扩展指令
    • 3. 常用快捷键
    • 4. shell 命令以及运行原理
  • 总结


一、Linux 基础知识

要提前提升一下认知: L i n u x Linux Linux 系统下,一切皆文件!

1. 文件系统常识

符号意义
目录目录文件(也叫文件夹,但本质是文件)
文件内容 + + + 属性
终端/dev/pts 目录下的一个字符设备文件
|管道(本质上也是一个文件,使得一个命令的输出可以直接作为另一个命令的输入
. 开头的文件隐藏文件
指令 / / / 命令本质上就是可执行文件(普通文件)
~家目录
/根目录 / / / L i n u x Linux Linux 路径分割符
.当前目录
..上级目录

L i n u x Linux Linux 中,任何一个目录(即便是空的),系统都会自带 . . . . . .. .. 目录。

注意:即使建立一个空文件夹,该文件也要占据磁盘空间。(记录文件属性)

2. 路径(文件结构)

L i n u x Linux Linux 系统中,磁盘上的文件和目录被组成一棵目录树(多叉树),每个节点都是目录或文件,要访问某一个目录或文件,就要通过路径来访问。

在这里插入图片描述

  1. 绝对路径:一般从 /(根目录) 开始,不依赖其他目录的定位文件的方式。

绝对路径一般不会随着用户的路径变化而丧失唯一性,一般在特定服务的配置文件中经常被使用。

  1. 相对路径:相对于当前用户所处目录,定位文件的路径方式。

相对路径因为它的便捷性,一般在命令行中使用较多。

理解路径存在的意义:树状组织方式,都是为了保证快速定位查找到指定的文件,而定位文件就需要具有唯一性的方案来进行定位文件。其中任何一个节点,都只有一个父节点,所以,从根目录开始,定位指定文件,路径具有唯一性

在这里插入图片描述

3. 文件类型

L i n u x Linux Linux 系统中,我们不通过文件后缀或者文件在终端中显示的颜色来区分文件类型,而是通过文件属性的第一个字母来作区分的。

[root@VM-8-4-centos 113]# ls -l
total 4
drwxr-xr-x 2 root root 4096 Apr  7 09:54 dir
-rw-r--r-- 1 root root    0 Apr  7 09:55 file.txt

比如,第一个字母为 d 代表这是一个目录文件(dir);第一个字母为 - 代表这是一个普通文件(file.txt)。

主要文件类型如下:

属性名文件类型
-普通文件(文本,可执行程序,库,图片,视频 … …
d目录文件
c字符设备文件(键盘,显示器,终端,输入的数据具有顺序性)
b块设备文件(磁盘)
l软链接(类似于 w i n d o w s windows windows 的快捷方式)
p管道文件
s 套接字 s o c k e t socket socket文件

注意:虽然 L i n u x Linux Linux 系统不关心文件后缀,但是不代表一些工具(如 g c c gcc gcc)不关心。

4. 重定向

L i n u x Linux Linux 系统中,一切皆是文件,键盘和显示器也是文件。重定向可以把默认读入或写入键盘和显示器文件,改变读入或写入直接到指定文件上。

重定向类型功能
输出重定向 > > >输出内容重定向覆盖指定文件中(默认为显示器文件)
追加重定向 > > >> >>输出内容重定向追加指定文件中(默认为显示器文件)
输入重定向 < < <文件内容重定向到指定文件
  1. 输出重定向(覆盖之前的内容):
[root@VM-8-4-centos 113]# cat text.txt
nihao shijie
[root@VM-8-4-centos 113]# echo hello world > text.txt
[root@VM-8-4-centos 113]# cat text.txt
hello world
  1. 追加重定向(不覆盖,在原有内容上追加):
[root@VM-8-4-centos 113]# cat text.txt
hello world
[root@VM-8-4-centos 113]# echo hello world >> text.txt
[root@VM-8-4-centos 113]# cat text.txt 
hello world
hello world
  1. 输入重定向
[root@VM-8-4-centos 113]# cat < text.txt
hello world
hello world

注意:这里重定向了 c a t cat cat 的输入,和 cat text.txt 输出结果虽然相同,但是本质上是不同的。


二、Linux 基本指令

1. 常用指令

(1) ls 指令

语法ls [选项] [目录或文件]
功能:对于目录,该命令列出该目录下的所有子目录与文件;对于文件,将列出文件名以及其他信息

[root@VM-8-4-centos 113]# mkdir dir 		# 创建一个文件夹
[root@VM-8-4-centos 113]# touch file.txt	# 创建一个文件
[root@VM-8-4-centos 113]# ls				# 默认为当前目录
dir  file.txt
[root@VM-8-4-centos 113]# ls /root			# 指定目录
113  MySQL

常用选项

选项功能
− a -a a重点列出目录下的所有文件,包括以 . . . 开头的隐含文件
− l -l l重点列出文件的详细信息
− d -d d将目录像文件一样显示,而不是显示其下的文件
− i -i i输出文件的 i i i 节点的索引信息
− k -k k k k k 字节的形式表示文件的大小
− n -n n用数字的 U I D UID UID G I D GID GID 代替名称
− F -F F在每个文件名后附上一个字符以说明该文件的类型
− r -r r对目录反向排序
− t -t t以时间排序
− s -s s l l l 文件名后输出该文件的大小(大小排序)
− R -R R列出所有子目录下的文件(递归)
− 1 -1 1一行只输出一个文件
  1. ls -a

其中,... 为隐藏文件:

[root@VM-8-4-centos 113]# ls -a
.  ..  dir  file.txt

创建一个隐藏文件:

[root@VM-8-4-centos 113]# touch .youcannotseeme.txt
[root@VM-8-4-centos 113]# ls
dir  file.txt
[root@VM-8-4-centos 113]# ls -a
.  ..  dir  file.txt  .youcannotseeme.txt

可以看出:ls 查看不到隐藏文件(以 . 开头的文件),ls -a 却可以查看。

  1. ls -lll):

可以查看文件的详细信息:

[root@VM-8-4-centos 113]# ls -l
total 4
drwxr-xr-x 2 root root 4096 Apr  7 09:54 dir
-rw-r--r-- 1 root root    0 Apr  7 09:55 file.txt

也可以配合 -a 使用:

[root@VM-8-4-centos 113]# ls -a -l
total 12
drwxr-xr-x   3 root root 4096 Apr  7 10:00 .
dr-xr-x---. 10 root root 4096 Apr  7 09:53 ..
drwxr-xr-x   2 root root 4096 Apr  7 09:54 dir
-rw-r--r--   1 root root    0 Apr  7 09:55 file.txt
-rw-r--r--   1 root root    0 Apr  7 10:00 .youcannotseeme.txt

注意:这里 ls -a -lls -l -als -alls -la 都是等价的,不分先后顺序,两个选项都会执行。

  1. ls -d
[root@VM-8-4-centos ~]# ls -l -a 113	# 查看指定目录下所有文件和目录
total 12
drwxr-xr-x   3 root root 4096 Apr  7 10:00 .
dr-xr-x---. 10 root root 4096 Apr  7 09:53 ..
drwxr-xr-x   2 root root 4096 Apr  7 09:54 dir
-rw-r--r--   1 root root    0 Apr  7 09:55 file.txt
-rw-r--r--   1 root root    0 Apr  7 10:00 .youcannotseeme.txt
[root@VM-8-4-centos ~]# ls -l -a -d 113	# 查看指定目录本身
drwxr-xr-x 3 root root 4096 Apr  7 10:00 113
  1. ls -F* 表示可执行的普通文件;/ 表示目录;@ 表示符号链接;| 表示 F I F O FIFO FIFO= 表示套接字( s o c k e t s sockets sockets)(目录类型识别)

(2) pwd 指令

语法: pwd
功能:显示用户当前所在的目录

[root@VM-8-4-centos 113]# pwd
/root/113

(3) cd 指令

语法: cd [目录]
功能:改变工作目录,将当前工作目录改变到指定的目录下。

  1. 返回上级目录
[root@VM-8-4-centos 113]# pwd
/root/113
[root@VM-8-4-centos 113]# cd ..
[root@VM-8-4-centos ~]# pwd
/root
  1. 绝对路径定位目录或者文件:
[root@VM-8-4-centos ~]# pwd
/root
[root@VM-8-4-centos ~]# cd /root/113
[root@VM-8-4-centos 113]# pwd
/root/113
  1. 快速返回家目录
[root@VM-8-4-centos 113]# whoami
root
[root@VM-8-4-centos 113]# pwd
/root/113
[root@VM-8-4-centos 113]# cd ~
[root@VM-8-4-centos ~]# pwd
/root

或者直接不写目录(cd 默认返回的就是家目录)。

[root@VM-8-4-centos 113]# pwd
/root/113
[root@VM-8-4-centos 113]# cd
[root@VM-8-4-centos ~]# pwd
/root
  1. 相对路径定位目录或者文件:
[root@VM-8-4-centos ~]# pwd
/root
[root@VM-8-4-centos ~]# cd ~/113
[root@VM-8-4-centos 113]# pwd
/root/113
  1. 回退到最近访问目录
[root@VM-8-4-centos 113]# pwd	# 当前所在目录
/root/113
[root@VM-8-4-centos 113]# cd /
[root@VM-8-4-centos /]# pwd		# 切换目录
/
[root@VM-8-4-centos /]# cd -
/root/113
[root@VM-8-4-centos 113]# pwd	# 回退目录
/root/113

(4) touch 指令

语法touch [选项] [文件]
功能 t o u c h touch touch 命令参数可更改文档或目录的日期时间,包括存取时间和更改时间,或者新建一个不存在的文件

常用选项

选项功能
− a -a a c h a n g e o n l y t h e a c c e s s t i m e change\ only\ the\ access\ time change only the access time
− c -c c c h a n g e o n l y t h e m o d i f i c a t i o n t i m e change\ only\ the\ modification\ time change only the modification time

创建一个文件:

[root@VM-8-4-centos 113]# ls
dir
[root@VM-8-4-centos 113]# touch test.cpp
[root@VM-8-4-centos 113]# ls
dir  test.cpp

(5) mkdir 指令(重要)

语法mkdir [选项] [dirname]
功能:在当前目录下创建一个名为 d i r n a m e dirname dirname 的目录

常用选项

选项功能
− p -p p--parents可以是一个路径名称,即一次可以建立多个目录

此时若路径中的某些目录尚不存在,加上此选项后,系统将自动建立好那些尚不存在的目录。

[root@VM-8-4-centos 113]# ls
dir  file.txt
[root@VM-8-4-centos 113]# mkdir a/b/c	# 直接创建会报错
mkdir: cannot create directory ‘a/b/c’: No such file or directory
[root@VM-8-4-centos 113]# mkdir -p a/b/c
[root@VM-8-4-centos 113]# ls
a  dir  file.txt
[root@VM-8-4-centos 113]# cd a
[root@VM-8-4-centos a]# ls
b
[root@VM-8-4-centos a]# cd b
[root@VM-8-4-centos b]# ls
c

(6) rmdir 指令(重要)

r m d i r rmdir rmdir 是一个与 m k d i r mkdir mkdir 相对应的命令, m k d i r mkdir mkdir 是建立目录,而 r m d i r rmdir rmdir删除目录

适用对象:具有当前目操作权限的所有使用者。

语法rmdir [-p] [dirName]
功能:删除空目录

常用选项

选项功能
− p -p p当子目录被删除后如果父目录也变成空目录的话,就连带父目录一起删除
[root@VM-8-4-centos 113]# tree .
.
|-- a
|   `-- b
|       `-- c
|-- dir
`-- file.txt
[root@VM-8-4-centos 113]# rmdir ./a/b/c	# 删一个
[root@VM-8-4-centos 113]# tree .
.
|-- a
|   `-- b
|-- dir
`-- file.txt
[root@VM-8-4-centos 113]# rmdir -p a/b	# 是空就全删
[root@VM-8-4-centos 113]# tree .
.
|-- dir
`-- file.txt

(7) rm 指令(重要)

r m rm rm 命令可以同时删除文件或目录

适用对象:所有使用者。

语法rm [-f-i-r-v] [dirName/dir]
功能:删除文件或目录

常用选项

选项功能
− i -i i删除前逐一询问确认
− f -f f即使文件属性为只读(即写保护),亦直接删除
− r -r r删除目录及其下所有文件
  1. rm -irm):
[root@VM-8-4-centos 113]# ls
a  dir  file.txt
[root@VM-8-4-centos 113]# rm file.txt	# 进行询问
rm: remove regular empty file ‘file.txt’? y 
[root@VM-8-4-centos 113]# ls
a  dir
  1. rm -r
[root@VM-8-4-centos 113]# tree .
.
|-- a
|   `-- b
|       `-- c
`-- dir4 directories, 0 files
[root@VM-8-4-centos 113]# rm -r a
rm: descend into directory ‘a’? y
rm: descend into directory ‘a/b’? y
rm: remove directory ‘a/b/c’? y
rm: remove directory ‘a/b’? y
rm: remove directory ‘a’? y
[root@VM-8-4-centos 113]# tree .
.
`-- dir1 directory, 0 files

可以看出:rm -r递归删除的。

  1. rm -f
[root@VM-8-4-centos 113]# ls
a  dir  file.txt
[root@VM-8-4-centos 113]# rm -f file.txt	# 无需询问
[root@VM-8-4-centos 113]# ls
a  dir

注意rm -r -frm -rf):

[root@VM-8-4-centos 113]# tree .
.
|-- a
|   `-- b
|       `-- c
`-- dir4 directories, 0 files
[root@VM-8-4-centos 113]# rm -rf a
[root@VM-8-4-centos 113]# tree .
.
`-- dir1 directory, 0 files

rm -rf无需询问地删除任何文件或目录,因此要谨慎操作,避免删掉根目录(删库跑路了)。

(8) man 指令(重要)

语法man [选项] [命令]
功能 L i n u x Linux Linux 的命令有很多参数,我们不可能全记住,可以通过查看联机手册获取帮助。

常用选项

选项功能
− k -k k根据关键字搜索联机帮助
n u m num num只在第 n u m num num 章节查找
− a -a a将所有章节的都显示出来

m a n man man 手册分为 9 9 9 章:

  1. 普通的指令

  2. 系统调用,如 o p e n open open w r i t e write write 之类的(通过这个,至少可以很方便的查到调用这个函数,需要加什么头文件)

  3. 库函数,如 p r i n t print print f r e a d 4 fread4 fread4 是特殊文件,也就是 / d e v /dev /dev 下的各种设备文件

  4. 是指文件的格式,比如 p a s s w d passwd passwd,就会说明这个文件中各个字段的含义

  5. 是给游戏留的,由各个游戏自己定义

  6. 附件还有一些变量,比如像 e n v i r o n environ environ 这种全局变量在这⾥就有说明

  7. 系统管理用的命令,这些命令只能由 r o o t root root 使用,如 i f c o n f i g ifconfig ifconfig

[root@VM-8-4-centos 113]# man printf	# 查看printf指令(printf也是一条指令)
[root@VM-8-4-centos 113]# man 3 printf	# 查看C库函数

m a n man man 手册界面:

在这里插入图片描述

(9) cp 指令(重要)

语法cp [选项] [源文件或目录] [目标文件或目录]
功能复制文件或目录

说明

  1. c p cp cp 指令用于复制文件或目录。

  2. 如同时指定两个以上的文件或目录,且最后的目的地是一个已经存在的目录,则它会把前面指定的所有文件或目录复制到此目录中。

  3. 同一个目录下不能存在名字完全相同的两个文件

常用选项

选项功能
− i -i i--interactive覆盖文件之前先询问用户
− f -f f--force强行复制文件或目录,不论目标文件或目录是否已经存在
− r -r r拷贝指定目录及其下所有文件(递归处理))

注意:若源文件或目录的形态,不属于目录或符号链接,则一律视为普通文件处理。

  1. cp -i [srcfile] [destfile/destdir]cp):
[root@VM-8-4-centos dir]# which cp
alias cp='cp -i'/usr/bin/cp
[root@VM-8-4-centos dir]# tree ..
..
|-- a
|   `-- b
|       `-- c
|-- dir
|   `-- text.txt
`-- test.cpp4 directories, 2 files
[root@VM-8-4-centos dir]# cat ../test.cpp
Hello World
[root@VM-8-4-centos dir]# cat ./text.txt
hello linux
[root@VM-8-4-centos dir]# cp ../test.cpp .	# 询问是否覆盖
cp: overwrite ‘./text.txt’? y
[root@VM-8-4-centos dir]# tree ..
..
|-- a
|   `-- b
|       `-- c
|-- dir
|   `-- text.txt
`-- test.cpp4 directories, 2 files
[root@VM-8-4-centos dir]# cat ./text.txt	# 被覆盖了
Hello World
  1. cp -rf [srcdir] [destdir]
[root@VM-8-4-centos dir]# tree ..
..
|-- a
|   `-- b
|       `-- c
|-- dir
|   `-- test.cpp
`-- test.cpp4 directories, 2 files
[root@VM-8-4-centos dir]# cp -rf ../a .	# 不询问,有相同文件直接覆盖,没有就创建
[root@VM-8-4-centos dir]# tree ..
..
|-- a
|   `-- b
|       `-- c
|-- dir
|   |-- a
|   |   `-- b
|   |       `-- c
|   `-- test.cpp
`-- test.cpp7 directories, 2 files

(10) mv 指令(重要)

语法mv [选项] [源文件或目录] [目标文件或目录]
功能 m v mv mv 命令是 m o v e move move 的缩写,可以用来移动文件(剪切)或者将文件重命名(经常用来备份文件或者目录)。

说明

  1. m v mv mv 命令中第二个参数类型的不同(是目标文件还是目标目录), m v mv mv 命令将文件重命名或将其移至一个新的目录中。

  2. 当第二个参数类型是文件时, m v mv mv 命令完成文件重命名,此时,源文件只能有一个(也可以是源目录名),它将所给的源文件或目录重命名为给定的目标文件名。

  3. 当第二个参数是已存在的目录名称时,源文件或目录参数可以有多个, m v mv mv 命令将各参数指定的源文件均移至目标目录中。

常用选项

选项功能
− i -i i若目标文件( d e s t i n a t i o n destination destination)已经存在时,就会询问是否覆盖
− f -f f如果目标文件已经存在,不会询问而直接覆盖

剪切 + + + 重命名:

[root@VM-8-4-centos 113]# tree .
.
|-- dir
`-- test1 directory, 1 file
[root@VM-8-4-centos 113]# mv test ./dir/text
[root@VM-8-4-centos 113]# tree .
.
`-- dir`-- text1 directory, 1 file

(11) cat 指令

语法cat [选项] [文件]
功能:查看目标文件的内容。

常用选项

选项功能
− b -b b对非空输出行编号
− n -n n对输出的所有行编号
− s -s s不输出多行空行
  1. cat -b 输出非空行编号
[root@VM-8-4-centos 113]# cat -b test.cpp1	#include<iostream>2	using namespace std;3	int main()4	{5	    cout << "hello world" << endl;6	    return 0;7	}
  1. cat -n 输出所有行编号
[root@VM-8-4-centos 113]# cat -n test.cpp1	#include<iostream>2	3	using namespace std;4	5	int main()6	{7	    cout << "hello world" << endl;8	9	10	11	    return 0;12	}
  1. cat -s 最多输出一行空行:
[root@VM-8-4-centos 113]# cat -s test.cpp
#include<iostream>using namespace std;int main()
{cout << "hello world" << endl;return 0;
}

注意tac(其实就是 cat 倒过来)命令也可以显示文件内容,不过是反向显示文件内容

[root@VM-8-4-centos 113]# tac test.cpp
}return 0;cout << "hello world" << endl;
{
int main()using namespace std;#include<iostream>

(12) more 指令(重要)

语法more [选项]
功能 m o r e more more 指令,功能类似于 c a t cat cat

常用选项

选项功能
− n -n n指定输出行数
q q q退出 m o r e more more

注意:在 m o r e more more 界面中, E n t e r Enter Enter 键换行,且只能往下,不能往上翻。

[root@VM-8-4-centos 113]# more -10 temp.txt	# 指定输出10行
hello
0
hello
1
hello
2
hello
3
hello
4
--More--(0%)

(13) less 指令(重要)

语法less [参数] [文件]
功能 l e s s less less m o r e more more 类似,但使用 l e s s less less 可以随意浏览文件,而 m o r e more more 仅能向前移动,却不能向后移动,而且 l e s s less less 在查看之前不会加载整个文件

常用选项

选项功能
− i -i i忽略搜索时的大小写
− N -N N显示每行的行号
/ / / 字符串向下搜索字符串的功能
? ? ? 字符串向上搜索字符串的功能
n n n重复前一个搜索(与 / / / ? ? ? 有关)
N N N反向重复前一个搜索(与 / / / ? ? ? 有关)
q q q q u i t quit quit,退出 l e s s less less

注意:在 l e s s less less 界面中,可以按 ↑ / ↓ ↑/↓ / 键往上 / / / 下翻页,即可以随意浏览

l e s s less less 工具也是对文件或其它输出进行分页显示的工具,应该说是 l i n u x linux linux 正统查看文件内容的工具,功能极其强大:

  1. l e s s less less 的用法比起 m o r e more more 更加的有弹性,在 m o r e more more 的时候,我们并没有办法向前面翻, 只能往后面看但若使用了 l e s s less less 时,就可以使用 [ p a g e u p ] [ p a g e d o w n ] [pageup]\ [pagedown] [pageup] [pagedown] 等按键的功能来往前往后翻看文件,更容易用来查看一个文件的内容。

  2. 除此之外,在 l e s s less less 里头可以拥有更多的搜索功能,不止可以向下搜 / / / 字符串),也可以向上搜 ? ? ? 字符串)。

(14) head 指令

语法head [参数] [文件]
功能 h e a d head head 用来显示档案的开头至标准输出中,默认 h e a d head head 命令打印其相应文件的开头 10 10 10 行。

常用选项

选项功能
− n -n n显示的行数

打印文件开头的 5 5 5 行内容(默认打印 10 10 10 行):

[root@VM-8-4-centos 113]# head -5 temp.txt
hello
0
hello
1
hello

(15) tail 指令

语法tail [参数] [文件]
功能:用于显示指定文件的末尾内容,不指定文件时,作为输入信息进行处理。常用查看日志文件。

常用选项

选项功能
− n -n n显示的行数
− f -f f循环读取

打印文件末尾的 5 5 5 行内容(默认打印 10 10 10 行):

[root@VM-8-4-centos 113]# tail -5 temp.txt
1998
hello
1999
hello
2000

(16) date 指令

指定格式显示时间date +%Y:%m:%d
用法date [选项] [+格式]

常用格式

格式含义
% H \%H %H小时
% M \%M %M分钟
% S \%S %S
% X \%X %X小时
% d \%d %d
% m \%m %m月份
% Y \%Y %Y完整年份
% F \%F %F相当于 % Y − % m − % d \%Y-\%m-\%d %Y%m%d
% s \%s %s时间戳

U n i x Unix Unix 时间戳(英文为 U n i x e p o c h , U n i x t i m e , P O S I X t i m e Unix\ epoch,\ Unix\ time,\ POSIX\ time Unix epoch, Unix time, POSIX time U n i x t i m e s t a m p Unix\ timestamp Unix timestamp)是从 1970 1970 1970 1 1 1 1 1 1 U T C / G M T UTC/GMT UTC/GMT 的午夜)开始所经过的秒数,不考虑闰秒。

系统默认显示时间:

[root@VM-8-4-centos 113]# date
Wed Apr  9 01:22:46 CST 2025

用自定义格式来显示时间:

[root@VM-8-4-centos 113]# date +%Y/%m/%d' '%H:%M:%S
2025/04/09 01:19:19
[root@VM-8-4-centos 113]# date +%F
2025-04-09

时间戳转换为时间date -d @[时间戳]

[root@VM-8-4-centos 113]# date -d @1744133618
Wed Apr  9 01:33:38 CST 2025
[root@VM-8-4-centos 113]# date -d @0
Thu Jan  1 08:00:00 CST 1970

(17) cal 指令

命令格式cal [参数] [月份] [年份]
功能:用于查看日历等时间信息,如只有一个参数,则表示年份,如有两个参数,则表示月份和年份

常用格式

格式含义
− 3 -3 3显示系统最近三个月的月历(上月、本月、下月)
− j -j j显式在当年中的第几天(从 1 1 1 1 1 1 号开始,默认显示当前月在一年中的天数)
− y -y y显示当前年份的日历
  1. 默认打印当前月份和年份的日历
[root@VM-8-4-centos 113]# calApril 2025     
Su Mo Tu We Th Fr Sa1  2  3  4  56  7  8  9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30
  1. cal -j [月份] [年份]
[root@VM-8-4-centos 113]# cal -j 3 2024March 2024        
Sun Mon Tue Wed Thu Fri Sat61  6263  64  65  66  67  68  6970  71  72  73  74  75  7677  78  79  80  81  82  8384  85  86  87  88  89  9091
  1. cal -3
 [root@VM-8-4-centos 113]# cal -3March 2025            April 2025             May 2025      
Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa1         1  2  3  4  5               1  2  32  3  4  5  6  7  8   6  7  8  9 10 11 12   4  5  6  7  8  9 109 10 11 12 13 14 15  13 14 15 16 17 18 19  11 12 13 14 15 16 17
16 17 18 19 20 21 22  20 21 22 23 24 25 26  18 19 20 21 22 23 24
23 24 25 26 27 28 29  27 28 29 30           25 26 27 28 29 30 31
30 31            

(18) find 指令(非常重要)

语法find [pathname] [-options]
功能:用于在文件树中查找文件,并作出相应的处理(可能访问磁盘)。

常用选项

选项功能
− n a m e -name name按照文件名查找文件

L i n u x Linux Linux f i n d find find 命令在目录结构中搜索文件,并执行指定的操作。

[root@VM-8-4-centos 113]# find ~ -name test.cpp
/root/113/test.cpp

注意:在运行一个非常消耗资源 f i n d find find 命令时,更倾向于把它放在后台执行,因为遍历一个大的文件系统可能会花费很长的时间。(这里是指 30 G 30G 30G 字节以上的文件系统)

(19) which 指令

功能:搜索系统指定的命令。

[root@VM-8-4-centos ~]# which ls
alias ls='ls --color=auto'/usr/bin/ls
[root@VM-8-4-centos ~]# which pwd
/usr/bin/pwd

(20) whereis 指令

功能:用于找到程序的二进制文件手册

[root@VM-8-4-centos 113]# whereis ls
ls: /usr/bin/ls /usr/share/man/man1/ls.1.gz /usr/share/man/man1p/ls.1p.gz
[root@VM-8-4-centos 113]# whereis rm
rm: /usr/bin/rm /usr/share/man/man1/rm.1.gz /usr/share/man/man1p/rm.1p.gz

(21) alias 指令

功能:设置命令的别名。

默认命令的别名如下:

[root@VM-8-4-centos ~]# alias
alias cp='cp -i'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias mv='mv -i'
alias rm='rm -i'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'

我们也可以自己起别名:

[root@VM-8-4-centos ~]# alias ybc=pwd
[root@VM-8-4-centos ~]# ybc
/root
[root@VM-8-4-centos ~]# which ybc
alias ybc='pwd'/usr/bin/pwd

(22) grep 指令

语法grep [选项] [要搜寻的字符串] [文件]
功能 g r e p grep grep 的主要作用是进行文本过滤,即在文件中搜索字符串,将找到的行打印出来。

常用选项

选项功能
− i -i i忽略大小写的不同,所以大小写视为相同
− n -n n顺便输出行号
− v -v v反向选择,即显示出没有搜寻字符串内容的那一行
[root@VM-8-4-centos 113]# grep -n "hello" text.txt
5:hello
[root@VM-8-4-centos 113]# grep -in "abcd" text.txt
2:abcd
3:ABCD
[root@VM-8-4-centos 113]# grep -vn "hello" text.txt
1:1234
2:abcd
3:ABCD
4:ybc
6:world

(23) zip/unzip 指令

语法zip [压缩文件.zip] [目录或文件]
功能:将目录或文件压缩 z i p zip zip 格式。

常用选项

选项功能
− r -r r递归处理,将指定目录下的所有文件和子目录一并处理

语法unzip [压缩文件.zip] [选项] [目录或文件]
功能 z i p zip zip 格式文件解压成原目录或文件。

选项功能
− d -d d . z i p .zip .zip 文件解压到指定目录下
[root@VM-8-4-centos 113]# tree .
.
|-- dir
|   |-- dirxxx
|   |   `-- diryyy
|   |-- dirzzz
|   |   `-- test3.cpp
|   |-- test1.cpp
|   `-- test2.cpp
`-- obj5 directories, 3 files
[root@VM-8-4-centos 113]# zip -r dir.zip dir		# 压缩文件adding: dir/ (stored 0%)adding: dir/dirzzz/ (stored 0%)adding: dir/dirzzz/test3.cpp (stored 0%)adding: dir/test2.cpp (stored 0%)adding: dir/dirxxx/ (stored 0%)adding: dir/dirxxx/diryyy/ (stored 0%)adding: dir/test1.cpp (stored 0%)
[root@VM-8-4-centos 113]# ls
dir  dir.zip  obj
[root@VM-8-4-centos 113]# unzip dir.zip	-d ./obj	# 解压文件(到指定目录)
Archive:  dir.zipcreating: dir/creating: dir/dirzzz/extracting: dir/dirzzz/test3.cpp    extracting: dir/test2.cpp           creating: dir/dirxxx/creating: dir/dirxxx/diryyy/extracting: dir/test1.cpp
[root@VM-8-4-centos 113]# tree .
..
|-- dir
|   |-- dirxxx
|   |   `-- diryyy
|   |-- dirzzz
|   |   `-- test3.cpp
|   |-- test1.cpp
|   `-- test2.cpp
`-- obj|-- dir|   |-- dirxxx|   |   `-- diryyy|   |-- dirzzz|   |   `-- test3.cpp|   |-- test1.cpp|   `-- test2.cpp`-- dir.zip9 directories, 7 files

补充:可以通过 sz [压缩文件.zip] 命令从 L i n u x Linux Linux 云服务器把压缩文件传到 W i n d o w s Windows Windows 电脑上,同时也可以通过拖拽的方式,将 W i n d o w s Windows Windows 上的压缩文件传到 L i n u x Linux Linux 云服务器上(自动添加 rz -E 命令)。

(24) tar 指令(重要)

语法tar [选项] [文件与目录]
功能打包 / / / 解包,不打开它,直接看内容。

常用选项

选项功能
− c -c c创建一个压缩文件的参数指令( c r e a t e create create 的意思)
− x -x x解开一个压缩文件的参数指令
− t -t t查看 t a r f i l e tarfile tarfile 里面的文件
− z -z z是否同时具有 g z i p gzip gzip 属性?即是否需要使用 g z i p gzip gzip 压缩?
− j -j j是否同时具有 b z i p 2 bzip2 bzip2 属性?即是否需要使用 b z i p 2 bzip2 bzip2 压缩?
− v -v v压缩的过程中显示文件(这个常用,但不建议用在背景执行过程)
− f -f f使用档名(在 f f f 之后要立即接档名,不要再加参数)
− C -C C解压到指定目录
  1. tar czf [压缩文件名.tgz] [需要压缩的文件] 压缩一个文件
[root@VM-8-4-centos 113]# ls
dir  obj
[root@VM-8-4-centos 113]# tar czf dir.tgz dir		# 压缩文件
[root@VM-8-4-centos 113]# ls
dir  dir.tgz  obj
  1. tar xzf [压缩文件.tgz] 解压一个文件
[root@VM-8-4-centos 113]# ls
dir  dir.tgz  obj
[root@VM-8-4-centos 113]# tar xzf dir.tgz -C obj	# 解压文件(到指定目录下)
[root@VM-8-4-centos 113]# ls obj
dir

(25) bc 指令

功能: b c bc bc 命令可以很方便的进行浮点运算。(充当 L i n u x Linux Linux 下的计算器)

[root@VM-8-4-centos 113]# bc
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'. 
1+1
2
3.1415*261
819.9315
^C
(interrupt) Exiting bc.
[root@VM-8-4-centos 113]# echo "1+2+3+4+5+6" | bc
21

(26) uname -r 指令

语法uname [选项]
功能 u n a m e uname uname 用来获取电脑和操作系统的相关信息

常用选项

选项功能
− a -a a详细输出所有信息
− r -r r查看系统内核版本和体系结构

依次为:内核名称主机名内核版本号内核版本硬件名处理器类型硬件平台类型操作系统名称

[root@VM-8-4-centos ~]# uname
Linux
[root@VM-8-4-centos ~]# uname -a
Linux VM-8-4-centos 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
[root@VM-8-4-centos ~]# uname -r
3.10.0-1160.119.1.el7.x86_64

(27) 关机

语法shutdown [选项]
功能:将系统的服务停掉,然后关机。

常用选项

选项功能
− h -h h将系统的服务停掉后,立即关机
− r -r r将系统的服务停掉后,重新启动
− t s e c -t\ sec t sec − t -t t 后面加秒数,过几秒后关机

注意:云服务器永不关机,除非需要维护或者停止使用。

2. 扩展指令

命令的分类命令
安装和登录命令 l o g i n login login s h u t d o w n shutdown shutdown h a l t halt halt r e b o o t reboot reboot i n s t a l l install install m o u n t mount mount u m o u n t umount umount c h s h chsh chsh e x i t exit exit l a s t last last
文件处理命令 f i l e file file m k d i r mkdir mkdir g r e p grep grep d d dd dd f i n d find find m v mv mv l s ls ls d i f f diff diff c a t cat cat l n ln ln
系统管理相关命令 d f df df t o p top top f r e e free free q u o t a quota quota a t at at l p lp lp a d d u s e r adduser adduser g r o u p a d d groupadd groupadd k i l l kill kill c r o n t a b crontab crontab
网络操作命令 i f c o n f i g ifconfig ifconfig i p ip ip p i n g ping ping n e t s t a t netstat netstat t e l n e t telnet telnet f t p ftp ftp r o u t e route route r l o g i n rlogin rlogin r c p rcp rcp f i n g e r finger finger m a i l mail mail n s l o o k u p nslookup nslookup
系统安全相关命令 p a s s w d passwd passwd s u su su u m a s k umask umask c h g r p chgrp chgrp c h m o d chmod chmod c h o w n chown chown c h a t t r chattr chattr s u d o p s sudo\ ps sudo ps w h o who who
其他命令 t a r tar tar u n z i p unzip unzip g u n z i p gunzip gunzip u n a r j unarj unarj m t o o l s mtools mtools m a n man man u n e n d c o d e unendcode unendcode u u d e c o d e uudecode uudecode

3. 常用快捷键

快捷键功能
A l t + E n t e r Alt + Enter Alt+Enter全屏 / / / 退出全屏
T a b Tab Tab按一下:命令补全,按两下:命令搜索
C t r l + C Ctrl+ C Ctrl+C让当前程序停掉
C t r l + D Ctrl+ D Ctrl+D退出当前用户(也可以用来取代 e x i t exit exit
C t r l + R Ctrl+ R Ctrl+R搜索历史命令
↑ / ↓ ↑/↓ /查看历史命令

4. shell 命令以及运行原理

L i n u x Linux Linux 严格意义上说的是⼀个操作系统,我们称之为核心 k e r n e l kernel kernel),但我们一般用户,不能直接使用 k e r n e l kernel kernel,是通过 k e r n e l kernel kernel外壳程序,也就是所谓的 s h e l l shell shell,来与 k e r n e l kernel kernel 沟通。

从技术角度, S h e l l Shell Shell 的最简单定义:命令行解释器 c o m m a n d I n t e r p r e t e command\ Interprete command Interprete)主要包含:

  1. 将使用者的命令翻译给核心 k e r n e l kernel kernel)处理。

  2. 同时,将核心的处理结果翻译给使用者

对比 w i n d o w s G U I windows\ GUI windows GUI,我们操作 w i n d o w s windows windows 不是直接操作 w i n d o w s windows windows 内核,而是通过图形接口(比如,鼠标双击打开一个文件),从而完成我们的操作。

s h e l l shell shell 对于 L i n u x Linux Linux,有相同的作用,主要是对我们的指令进行解析,解析指令 L i n u x Linux Linux 内核。反馈结果在通过内核运行出结果,通过 s h e l l shell shell 解析给用户。


总结

以上就是对 L i n u x Linux Linux 操作系统的初步认识和基本介绍,以及对一些日常常用的指令的基本介绍。

相关文章:

【Linux系统】Linux基础指令

l i n u x linux linux 命令是对 L i n u x Linux Linux 系统进行管理的命令。对于 L i n u x Linux Linux 系统来说&#xff0c;无论是中央处理器、内存、磁盘驱动器、键盘、鼠标&#xff0c;还是用户等都是文件&#xff0c; L i n u x Linux Linux 系统管理的命令是它正常运…...

Android中Jetpack设计理念、核心组件 和 实际价值

一、Jetpack 的定义与定位&#xff08;基础必答&#xff09; Jetpack 是 Google 推出的 Android 开发组件集合&#xff0c;旨在&#xff1a; 加速开发&#xff1a;提供标准化、开箱即用的组件 消除样板代码&#xff1a;解决传统开发中的重复劳动问题 兼容性保障&#xff1a;…...

flutter开发音乐APP(前提准备)

1、项目的一些环境&#xff1a; 2、接口文档&#xff1a; 酷狗音乐 NodeJS 版 API 3、接口数据结构化 Instantly parse JSON in any language | quicktype UI样式借鉴参考&#xff1a; Coffee-Expert/Apple-Music-New-UI: Apple Music Clone on Flutter, with redesigned UI…...

网络协议学习

最近在适配ESP32的网络驱动&#xff0c;借此机会先学习一下网络通信协议。 以太网帧、IP包及TCP与UDP的报文格式 提问腾讯元宝提示词&#xff1a; TCP窗口是干什么的拥塞窗口是什么的...

示波器直流耦合与交流耦合:何时使用哪种?

直流耦合和交流耦合的基本区别应该在于它们如何处理信号的直流分量和交流分量。直流分量是指信号中的固定电压部分&#xff0c;而交流分量则是信号中变化的电压部分。 例如&#xff0c;一个5V的直流电压叠加了一个1V的正弦波交流信号&#xff0c;整个信号会在4V到6V之间波动。如…...

js解除禁止复制、禁止鼠标右键效果

有的网页会禁止复制&#xff0c;甚至禁止鼠标右键&#xff0c;如何解决 按F12进入检查模式&#xff0c;在控制台输入下面的js代码 1.解除禁止复制 document.addEventListener(copy,function(event){event.stopImmediatePropagation();},true); 2.解除禁止鼠标右键 document…...

如何把未量化的 70B 大模型加载到笔记本电脑上运行?

并行运行 70B 大模型 我们已经看到&#xff0c;量化已经成为在低端 GPU&#xff08;比如 Colab、Kaggle 等&#xff09;上加载大型语言模型&#xff08;LLMs&#xff09;的最常见方法了&#xff0c;但这会降低准确性并增加幻觉现象。 那如果你和你的朋友们把一个大型语言模型分…...

xwiki的权限-页面特殊设置>用户权限>组权限

官方文档https://www.xwiki.org/xwiki/bin/view/Documentation/AdminGuide/Access%20Rights/ 他有组权限、用户权限、页面及子页面特别设置。 页面特殊设置 > 用户权限 > 组权限 XWiki提供了设置wiki范围内权限、细粒度页面级权限的能力&#xff0c;以及在需要更多控制的…...

Go语言比较递归和循环执行效率

一、概念 1.递归 递归是指一个函数在其定义中直接或间接调用自身的编程方法 。简单来说&#xff0c;就是函数自己调用自己。递归主要用于将复杂的问题分解为较小的、相同类型的子问题&#xff0c;通过不断缩小问题的规模&#xff0c;直到遇到一个最简单、最基础的情况&#x…...

Windows 图形显示驱动开发-WDDM 2.0功能_供应和回收更改

供应和回收更改 对于 Windows 显示驱动程序模型 (WDDM) v2&#xff0c;有关 套餐 和 回收 的要求正在放宽。 用户模式驱动程序不再需要在内部分配上使用套餐和回收。 空闲/挂起的应用程序将使用 Microsoft DirectX 11.1 中引入的 TrimAPI 删除驱动程序内部资源。 API 级别将继…...

MongoDB 新手笔记

MongoDB 新手笔记 1. MongoDB 1.1 概述 MongoDB 是一种 文档型数据库&#xff08;NoSQL&#xff09;&#xff0c;数据以类似 JSON 的 BSON 格式存储&#xff0c;适合处理非结构化或半结构化数据。 对比 MySQL&#xff1a; MySQL 是关系型数据库&#xff0c;数据以表格形式存…...

Pytorch查看神经网络结构和参数量

基本方法 print(model) print(type(model))# 模型参数 numEl_list [p.numel() for p in model.parameters()] total_params_mb sum(numEl_list) / 1e6print(fTotal parameters: {total_params_mb:.2f} MB) # sum(numEl_list), numEl_list print(sum(numEl_list)) print(numE…...

Pytorch Dataset问题解决:数据集读取报错DatasetGenerationError或OSError

问题描述 在huggingface上下载很大的数据集&#xff0c;用多个parquet文件的格式下载到本地。使用load_dataset加载的时候&#xff0c;进度条加载到一半会报错DatasetGenerationError: An error occurred while generating the dataset&#xff1b;如果加载为IterableDataset&…...

学习OpenCV C++版

OpenCV C 1 数据载入、显示与保存1.1 概念1.2 Mat 类构造与赋值1.3 Mat 类的赋值1.4 Mat 类支持的运算1.5 图像的读取与显示1.6 视频加载与摄像头调用1.7 数据保存 参考&#xff1a;《OpenCV4快速入门》作者冯 振 郭延宁 吕跃勇 1 数据载入、显示与保存 1.1 概念 Mat 类 : Ma…...

特权FPGA之PS/2键盘解码

0 故事背景 见过这种接口的朋友们&#xff0c;大概都已经成家立业了吧。不过今天我们不讨论这种接口的历史&#xff0c;只讲讲这种接口的设计。&#xff08;如果还没有成家的朋友也别生气&#xff0c;做自己想做的事情就对了&#xff01;&#xff09; 1 时序分析 数据帧格式如图…...

SpringBoot 接口限流Lua脚本接合Redis 服务熔断 自定义注解 接口保护

介绍 Spring Boot 接口限流是防止接口被频繁请求而导致服务器负载过重或服务崩溃的一种策略。通过限流&#xff0c;我们可以控制单位时间内允许的请求次数&#xff0c;确保系统的稳定性。限流可以帮助防止恶意请求、保护系统资源&#xff0c;并优化 API 的可用性&#xff0c;避…...

FPAG_BUFFER学习

在FPGA设计中&#xff0c;缓冲器&#xff08;Buffer&#xff09;是信号传输和管理的核心组件&#xff0c;用于处理输入/输出信号、时钟分配以及信号完整性。以下是FPGA中常见缓冲器的详细介绍&#xff0c;分类说明其功能、应用场景和设计注意事项&#xff1a; --- ### **1. 输…...

《认知觉醒》下篇·第六章第一节“清晰:一个观念,重构你的行动力” 总结

《认知觉醒》下篇第六章第一节“清晰&#xff1a;一个观念&#xff0c;重构你的行动力”的核心内容总结&#xff1a; 1. 清晰的力量&#xff1a;行动力的第一性原理 定义 清晰是对目标、路径和结果的明确认知&#xff0c;是破除拖延与内耗的核心前提。 模糊的代价&#xff1a; …...

idea手动创建resources文件夹

有时maven没有构建成功可能造成&#xff0c;resources文件夹不创建的现象 此时我们可以手动创建 手动创建...

Scala相关知识学习总结6

1、集合计算高级函数说明 - 过滤&#xff1a;遍历集合&#xff0c;提取满足特定条件的元素组成新集合。 - 转化/映射&#xff08;map&#xff09;&#xff1a;将集合里的每个元素应用到指定函数进行转换。 - 扁平化&#xff1a;文档未详细阐述其具体含义和操作。 - 扁平化映射&…...

IDEA 调用 Generate 生成 Getter/Setter 快捷键

快捷键不会用&#xff1f; 快捷键&#xff1a;AltInsert 全选键&#xff1a;CtrlA IDEA 调用 Generate 生成 Getter/Setter 快捷键 - 爱吃西瓜的番茄酱 - 博客园...

【SpringCloud】从入门到精通(下)

网关与路由 什么是网关&#xff1f;顾明思议&#xff0c;网关就是网络的关口。数据在网络间传输&#xff0c;从一个网络传输到另一网络时就需要经过网关来做数据的路由和转发以及数据安全的校验。 现在前端不能请求各个微服务地址&#xff0c;只能去请求网关 网关可以做安全控…...

深入探索 C++23:特性测试与编译器支持

文章目录 一、C23 新特性概览&#xff08;一&#xff09;语言特性&#xff08;二&#xff09;标准库特性 二、特性测试程序三、主流编译器支持情况&#xff08;一&#xff09;GCC&#xff08;二&#xff09;Clang&#xff08;三&#xff09;MSVC 四、开发者建议&#xff08;一&…...

Electron 应用太重?试试 PakePlus 轻装上阵

Electron 作为将 Web 技术带入桌面应用领域的先驱框架&#xff0c;让无数开发者能够使用熟悉的 HTML、CSS 和 JavaScript 构建跨平台应用。然而&#xff0c;随着应用规模的扩大&#xff0c;Electron 应用的性能问题逐渐显现——内存占用高、启动速度慢、安装包体积庞大&#xf…...

驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接

驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接 原因描述 项目中有使用到 SQL Server 数据库, 在启动项目时, 出现报错信息: 【驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接。错误:“The server selected protocol version…...

Java 设计模式:原型模式详解

Java 设计模式&#xff1a;原型模式详解 原型模式&#xff08;Prototype Pattern&#xff09;是一种创建型设计模式&#xff0c;它通过复制现有对象来创建新对象&#xff0c;而无需依赖其具体类。这种模式特别适合创建复杂对象或需要频繁创建相似对象的场景。本文将详细介绍原…...

NLP高频面试题(三十七)——大模型训练和推理的显存估计

在训练和推理大型语言模型时,显存(GPU 内存)的需求是一个关键考虑因素。准确估计这些需求有助于选择合适的硬件配置,确保模型高效运行。 推理阶段的显存需求 在推理过程中,显存主要用于存储模型权重和中间激活值。模型权重的显存需求可以通过以下公式估算: 模型权重…...

PHP 阿里云oss 使用指南

1.介绍 把图片放到阿里云上的空间上&#xff0c;可以使用cdn加速。 可以在程序里直接调用 要使用阿里云 oss sdk &#xff0c;请先到阿里云下载 或用 copmposer 安装 相关链接&#xff1a; 安装OSS PHP SDK_对象存储(OSS)-阿里云帮助中心 composer require aliyuncs/oss…...

leetcode_面试题 02.07. 链表相交_java

面试题 02.07. 链表相交https://leetcode.cn/problems/intersection-of-two-linked-lists-lcci/ 1、题目 给你两个单链表的头节点 headA 和 headB &#xff0c;请你找出并返回两个单链表相交的起始节点。如果两个链表没有交点&#xff0c;返回 null 。 图示两个链表在节点 c…...

LeetCode 3375.使数组的值全部为 K 的最少操作次数:O(1)空间——排序+一次遍历

【LetMeFly】3375.使数组的值全部为 K 的最少操作次数&#xff1a;O(1)空间——排序一次遍历 力扣题目链接&#xff1a;https://leetcode.cn/problems/minimum-operations-to-make-array-values-equal-to-k/ 给你一个整数数组 nums 和一个整数 k 。 如果一个数组中所有 严格…...

紫光展锐5G SoC T8300:影像升级,「定格」美好世界

影像能力已成为当今衡量智能手机性能的重要标尺之一。随着消费者对手机摄影需求日益提升&#xff0c;手机厂商纷纷在影像硬件和算法上展开激烈竞争&#xff0c;力求为用户带来更加出色的拍摄体验。 紫光展锐专为全球主流用户打造的畅享影音和游戏体验的5G SoC——T8300&#x…...

java基础 关键字static

static static使用简介static结合类的生命周期1.加载2.链接(1) 验证&#xff08;Verification&#xff09;(2) 准备&#xff08;Preparation&#xff09;(3) 解析&#xff08;Resolution&#xff09; 3. 初始化4.使用5.卸载总结 staic作用总结静态变量静态代码块静态方法静态内…...

大数据学习(105)-大数据组件分析

&#x1f34b;&#x1f34b;大数据学习&#x1f34b;&#x1f34b; &#x1f525;系列专栏&#xff1a; &#x1f451;哲学语录: 用力所能及&#xff0c;改变世界。 &#x1f496;如果觉得博主的文章还不错的话&#xff0c;请点赞&#x1f44d;收藏⭐️留言&#x1f4dd;支持一…...

Spark运行

一文读懂Spark&#xff1a;从核心概念到实战编程 在大数据处理领域&#xff0c;Spark凭借其高效的计算能力和灵活的架构脱颖而出。今天&#xff0c;就来和大家深入聊聊Spark&#xff0c;帮助初学者快速入门。Spark采用经典的master - slave结构。Driver如同master&#xff0c;…...

在macOS的docker中如何安装及运行ROS2

1、macOS环境及版本 2、docker for macos版本 3、拉取ROS2镜像 docker pull ros:iron 4、查看容器 docker images 5、启动 ROS2 容器 docker run -it --rm ros:iron -it &#xff1a;以交互模式运行容器。 --rm &#xff1a;退出时自动删除容器&#xff08;测试时推荐&am…...

FFmpeg安装和使用

1. 安装与环境配置 Windows # 方法1&#xff1a;官网下载预编译二进制包 https://ffmpeg.org/download.html#build-windows 解压后添加bin目录到系统PATH# 方法2&#xff1a;通过Chocolatey安装 choco install ffmpegmacOS # 使用Homebrew安装 brew install ffmpegLinux # …...

基于多模态大模型的ATM全周期诊疗技术方案

基于多模态大模型的ATM全周期诊疗技术方案 1. 数据预处理模块 算法1:多模态数据融合伪代码 def multimodal_fusion(data_dict):# 输入:包含MRI、EEG、实验室指标的字典# 输出:对齐后的张量序列# 模态对齐aligned_data = temporal_alignment(data_dict,sampling_rate...

写时复制Copy-on-Write(COW)

简单理解写时复制 读的时候&#xff0c;直接访问原对象。 写的时候&#xff0c;对复制原对象&#xff0c;对副本进行写操作&#xff0c;最后将副本替换原对象。 写时复制多用于读多写少的场景&#xff0c;因为写操作是用悲观锁进行的&#xff0c;如果写的场景多&#xff0c;…...

S7-1200 PLC热电偶和热电阻模拟量模块

热电偶和热电阻模拟量模块 S7-1200 PLC有专用用于对温度进行采集的热电偶模块SM1231 TC和SM 1231RTD。热电偶模块有4AI和8AI两种&#xff0c;下面以SM1231 TC 4AI为例看一下接线图。 该模块一共有4个通道&#xff0c;每个通道有两个接线端子&#xff0c;比如0&#xff0c;0-。…...

ffmpeg函数简介(封装格式相关)

文章目录 &#x1f31f; 前置说明&#xff1a;FFmpeg 中 AVFormatContext 是什么&#xff1f;&#x1f9e9; 1. avformat_alloc_context功能&#xff1a;场景&#xff1a; &#x1f9e9; 2. avformat_open_input功能&#xff1a;说明&#xff1a;返回值&#xff1a; &#x1f9…...

操作数组的工具类

Arrays 它里面的每一个方法基本上都是static静态修饰的&#xff0c;如果想要调用里面的方法&#xff0c;不需要创建对象&#xff0c;直接用类名.就可以了 操作数组的工具类 方法&#xff1a; public static String toString&#xff08;数组&#xff09; 把数组拼接成…...

小刚说C语言刷题——第19讲 循环之continue和break

在循环中&#xff0c;当我们得到想要的答案时&#xff0c;这时我们可能要提前结束循环&#xff0c;这个时候我们就会用到break。而我们有时需要结束某一次循环时&#xff0c;我们可以用continue。 1.break语句 (1)在循环中想要提前终止循环&#xff0c;要用break。 (2)语法格…...

FairMOT复现过程中cython_bbox库问题

cython_bbox库就该这么安装_cython-bbox库就应该-CSDN博客...

记录学习的第二十四天

还是每日一题。 题解很巧&#xff0c;我根本想不到。 class Solution { public: int minOperations(vector<int>& nums, int k) { int count; int mnnums[0]; //接下来查找nums数组中最小值 for(int i1;i<nums.size();i) { if(nums[i]<mn) { mnnums[i]; } } …...

Kubernetes 入门篇之网络插件 calico 部署与安装

在运行kubeadm init 和 join 命令部署好master和node节点后&#xff0c;kubectl get nodes 看到节点都是NotReady状态&#xff0c;这是因为没有安装CNI网络插件。 kubectl get nodes NAME STATUS ROLES AGE VERSION k8s-master Not…...

HTTP 压力测试工具autocannon(AI)

简介 autocannon 是一款基于 Node.js 的高性能 HTTP 压力测试工具&#xff0c;适用于评估 Web 服务的并发处理能力和性能瓶颈。 一、工具特点 高性能‌&#xff1a;利用 Node.js 异步非阻塞机制模拟高并发请求‌。‌实时监控‌&#xff1a;测试过程中动态展示请求统计和性能…...

【面试】封装、继承、多态的具象示例 模板编程的理解与应用场景 链表适用的场景

文章目录 C面试&#xff1a;封装、继承、多态的具象示例1. 封装 (Encapsulation)2. 继承 (Inheritance)3. 多态 (Polymorphism)综合示例&#xff1a;封装、继承、多态 C模板编程的理解与应用场景我对模板编程的理解C中最常用的模板编程场景1. STL (标准模板库)2. 通用容器实现3…...

机器学习02——概要

一、简介 机器学习是一门在没有明确编程的情况下让计算机学习的科学。 监督学习是有目标的&#xff0c;输入数据对应明确的输出&#xff1b;无监督学习则是“探索”型的&#xff0c;模型的目标是从数据中发现潜在的模式或结构&#xff0c;而不需要预先知道标签。 二、机器学…...

常用的网络安全靶场、工具箱

转载&#xff1a;https://blog.csdn.net/zjzqxzhj/article/details/137945444 打CTF很好玩。可以试一下 1.CTF在线工具 1、CTF在线工具箱&#xff1a;http://ctf.ssleye.com/ 包含CTF比赛中常用的编码、加解密、算法。 2、CTF加解密工具箱&#xff1a;http://www.atoolbox.…...

excel中的VBA指令示例(一)

示例注释&#xff1a; Sub 宏1() sub是宏开头&#xff0c;宏1是宏的名称&#xff0c;自定义&#xff0c;在按钮中可指定用某个宏 后面是注释 Sheets("装配材料").Select ‘选择表 装配材料 Ce…...