Linux shell编程学习笔记38:history命令

目录

  1. 0 前言
    1. 1  history命令的功能、格式和退出状态
    2. 1.1 history命令的功能
    3. 1.2 history命令的格式
    4. 1.3退出状态
    5. 2 命令应用实例
    6. 2.1 history:显示命令历史列表
    7. 2.2 history -a:将当前会话的命令行历史追加到历史文件~/.bash_history中
    8. 2.3 history -c:删除所有条目从而清空历史列表
    9. 2.4 history -d 偏移量:从指定位置删除历史列表内容
    10. 2.5 history 正整数:显示指定数量的历史命令纪录
    11. 2.6 history -r:读取历史文件并将内容追加到历史列表中
    12. 2.7 history -s 命令 :将 指定命令 追加到历史列表
    13. 2.8 history -w [文件]:将当前历史写入到历史文件中,并追加到历史列表中
      1. 2.8.1  将当前历史写入到默认历史文件中
      2. 2.8.2  将当前历史写入到指定文件中
    14. 2.9 !:重复执行命令
      1. 2.9.1 !! 或 !-1:重复执行上一条命令
      2. 2.9.2 !命令历史列表列号 :重复执行历史列表中指定行的命令
      3. 2.9.3 !字符串 :重复执行历史列表中以指定字符串开头的命令
    15. 2.10 其它使用技巧
      1. 2.10.1  重新执行或查看命令历史中的命令
      2. 2.10.2 使用(reverse-i-search)模式
      3. 2.10.3 使用命令历史记录中的参数
  2. 三、与history命令相关的环境变量

0 前言

使用DOS的朋友,都知道可以在命令行提示符中使用上下光标键来浏览最近执行过的命令,这是基于DOS提供的DosKey命令。

而在Unix和Linux的shell中,我们同样可以使用上下光标键来浏览最近执行过的命令历史纪录(history),这是因为有history命令。

bash可以保存的过去曾经执行过的命令。当某个用户登录到shell中,会读取该用户家目录中的~/.bash_history文件,并将历史命令列表保存到内存中。当用户退出当前shell时,会将内存中的历史命令列表覆盖至~/.bash_history文件。

 1  history命令的功能、格式和退出状态

我们可以使用 help history命令查看 history命令的帮助信息。

purpleEndurer @ bash ~ $help history
history: history [-c] [-d offset] [n] or history -anrw [filename] or history -ps arg [arg...]
    Display or manipulate the history list.
    
    Display the history list with line numbers, prefixing each modified
    entry with a `*'.  An argument of N lists only the last N entries.
    
    Options:
      -c        clear the history list by deleting all of the entries
      -d offset delete the history entry at offset OFFSET.
    
      -a        append history lines from this session to the history file
      -n        read all history lines not already read from the history file
      -r        read the history file and append the contents to the history
        list
      -w        write the current history to the history file 
        and append them to the history list
    
      -p        perform history expansion on each ARG and display the result
        without storing it in the history list
      -s        append the ARGs to the history list as a single entry
    
    If FILENAME is given, it is used as the history file.  Otherwise,
    if $HISTFILE has a value, that is used, else ~/.bash_history.
    
    If the $HISTTIMEFORMAT variable is set and not null, its value is used
    as a format string for strftime(3) to print the time stamp associated
    with each displayed history entry.  No time stamps are printed otherwise.
    
    Exit Status:
    Returns success unless an invalid option is given or an error occurs.
purpleEndurer @ bash ~ $

1.1 history命令的功能

history命令是一个内部命令,可以显示或操纵命令历史列表。

purpleEndurer @ bash ~ $type history
history is a shell builtin
purpleEndurer @ bash ~ $

1.2 history命令的格式

history [-c] [-d 偏移量] [历史记录数]

history -anrw [文件名]

history -ps 参数 [参数...]

选项功能备注
-a将当前会话的命令行历史追加到历史文件~/.bash_history中append
-c删除所有条目从而清空历史列表内容。clear
-d 偏移量 从指定位置删除历史列表内容。delete
历史记录数显示指定数量的历史命令纪录,应为正整数number
-n从历史文件中读取所有未被读取的行not
-p 参数对每一个指定参数展开历史并显示结果而不存储到历史列表中perform
-r读取历史文件并将内容追加到历史列表中read
-s 命令以单条记录将 指定命令 追加到历史列表中。如果指定了 文件名,则它将被作为历史文件。否则如果 $HISTFILE 变量有值的话使用之,不然使用 ~/.bash_history 文件。如果 $HISTTIMEFORMAT 变量被设定并且不为空,它的值会被用于 strftime(3) 的格式字符串来打印与每一个显示的历史条目想关联的时间戳,否则不打印时间戳。single
-w [文件]将当前历史写入到历史文件中,并追加到历史列表中write

1.3退出状态

返回成功,除非使用了无效的选项或者发生错误。


2 命令应用实例

2.1 history:显示命令历史列表

prupleEndurer @ bash ~ $ history
    1  PS1="prupleEndurer @ bash \w $ "
    2  history
prupleEndurer @ bash ~ $ 

 

 2.2 history -a:将当前会话的命令行历史追加到历史文件~/.bash_history中

prupleEndurer @ bash ~ $ cat ~/.bash_history
PS1="prupleEndurer @ bash \w $ "
history -2
echo $?
history
history -r
history
history
history -a
prupleEndurer @ bash ~ $ history -a
prupleEndurer @ bash ~ $ cat ~/.bash_history
PS1="prupleEndurer @ bash \w $ "
history -2
echo $?
history
history -r
history
history
history -a
history -n
ls ~/.bash_history
cat ~/.bash_history
cat ~/.bash_history -a
cls
clear
cat ~/.bash_history -a
cls
clear
cat ~/.bash_history
history -a
prupleEndurer @ bash ~ $ 

我们先执行cat ~/.bash_history 命令查看文件~/.bash_history的内容

然后执行history -a 命令将当前会话的命令行历史追加到历史文件~/.bash_history中

接着再次执行cat ~/.bash_history 命令查看文件~/.bash_history的内容

可以看到文件~/.bash_history中确实增加了下面这些命令行:

history -n
ls ~/.bash_history
cat ~/.bash_history
cat ~/.bash_history -a
cls
clear
cat ~/.bash_history -a
cls
clear
cat ~/.bash_history
history -a

2.3 history -c:删除所有条目从而清空历史列表

prupleEndurer @ bash ~ $ history
    1  PS1="prupleEndurer @ bash \w $ "
    2  history 0
    3  echo $?
    4  history
prupleEndurer @ bash ~ $ history -c
prupleEndurer @ bash ~ $ history
    1  history
prupleEndurer @ bash ~ $ 

我们先执行history 命令查看当前命令历史列表,内容如下:

    1  PS1="prupleEndurer @ bash \w $ "
    2  history 0
    3  echo $?
    4  history

然后执行history -c 命令将当前会话的命令行历史列表清空

接着再次执行history 命令查看当前命令历史列表,这时历史列表只有我们这次所输入的的命令:

    1  history

之前的命令历史列表都被清空了。

2.4 history -d 偏移量:从指定位置删除历史列表内容

prupleEndurer @ bash ~ $ history
    1  PS1="prupleEndurer @ bash \w $ "
    2  history
    3  history 0
    4  echo $?
    5  history 3
    6  history
prupleEndurer @ bash ~ $ history -d 2
prupleEndurer @ bash ~ $ history
    1  PS1="prupleEndurer @ bash \w $ "
    2  history 0
    3  echo $?
    4  history 3
    5  history
    6  history -d 2
    7  history
prupleEndurer @ bash ~ $ 

我们先执行history 命令查看当前命令历史列表,内容如下:

    1  PS1="prupleEndurer @ bash \w $ "
    2  history
    3  history 0
    4  echo $?
    5  history 3
    6  history

然后执行history -d 2 命令将第2行命令删除

接着再次执行history 命令查看当前命令历史列表,内容如下:

    1  PS1="prupleEndurer @ bash \w $ "
    2  history 0
    3  echo $?
    4  history 3
    5  history
    6  history -d 2
    7  history

可以看到命令历史列表中之前的第2条纪录:

    2  history

被删除了。 

如果我指定的偏移量是负数,例如-2,命令将出错,退出状态码为1:

prupleEndurer @ bash ~ $ history -d -2
bash: history: -2: history position out of range
prupleEndurer @ bash ~ $ echo $?
1
prupleEndurer @ bash ~ $ 

2.5 history 正整数:显示指定数量的历史命令纪录

 prupleEndurer @ bash ~/Code $ history
    1  history
prupleEndurer @ bash ~/Code $ history 1
    2  history 1
prupleEndurer @ bash ~/Code $ history 0
prupleEndurer @ bash ~/Code $ history 2
    3  history 0
    4  history 2
prupleEndurer @ bash ~/Code $ history
    1  history
    2  history 1
    3  history 0
    4  history 2
    5  history
prupleEndurer @ bash ~/Code $ 

如果我们指定的是负数,将提示出错,命令退出值为2。

prupleEndurer @ bash ~ $ history -2
bash: history: -2: invalid option
history: usage: history [-c] [-d offset] [n] or history -anrw [filename] or history -ps arg [arg...]prupleEndurer @ bash ~ $ echo $?
2

2.6 history -r:读取历史文件并将内容追加到历史列表中

prupleEndurer @ bash ~ $ history
    1  PS1="prupleEndurer @ bash \w $ "
    2  cat ~/.bash_history
    3  set | grep  $HISTFILE
    4  cat /home/csdn/.bash_history
    5  history -w
    6  cat /home/csdn/.bash_history
    7  history -w c.log
    8  cat c.log
    9  history
prupleEndurer @ bash ~ $ history -r
prupleEndurer @ bash ~ $ history
    1  PS1="prupleEndurer @ bash \w $ "
    2  cat ~/.bash_history
    3  set | grep  $HISTFILE
    4  cat /home/csdn/.bash_history
    5  history -w
    6  cat /home/csdn/.bash_history
    7  history -w c.log
    8  cat c.log
    9  history
   10  history -r
   11  PS1="prupleEndurer @ bash \w $ "
   12  cat ~/.bash_history
   13  set | grep  $HISTFILE
   14  cat /home/csdn/.bash_history
   15  history -w
   16  history
prupleEndurer @ bash ~ $ cat /home/csdn/.bash_history
PS1="prupleEndurer @ bash \w $ "
cat ~/.bash_history
set | grep  $HISTFILE
cat /home/csdn/.bash_history
history -w
prupleEndurer @ bash ~ $ 

我们先执行history 命令查看当前命令历史列表共有9条,内容如下:

    1  PS1="prupleEndurer @ bash \w $ "
    2  cat ~/.bash_history
    3  set | grep  $HISTFILE
    4  cat /home/csdn/.bash_history
    5  history -w
    6  cat /home/csdn/.bash_history
    7  history -w c.log
    8  cat c.log
    9  history

然后执行history -r 命令读取历史文件并将内容追加到历史列表中

接着再次执行history 命令查看当前命令历史列表,共有16条,内容如下:

    1  PS1="prupleEndurer @ bash \w $ "
    2  cat ~/.bash_history
    3  set | grep  $HISTFILE
    4  cat /home/csdn/.bash_history
    5  history -w
    6  cat /home/csdn/.bash_history
    7  history -w c.log
    8  cat c.log
    9  history
   10  history -r
   11  PS1="prupleEndurer @ bash \w $ "
   12  cat ~/.bash_history
   13  set | grep  $HISTFILE
   14  cat /home/csdn/.bash_history
   15  history -w
   16  history

我们用命令 cat /home/csdn/.bash_history 查看历史文件的内容:

PS1="prupleEndurer @ bash \w $ "
cat ~/.bash_history
set | grep  $HISTFILE
cat /home/csdn/.bash_history
history -w

可以看到,当前命令历史列表中的第10条-15条记录是从历史文件添加进来的。

2.7 history -s 命令 :将 指定命令 追加到历史列表

prupleEndurer @ bash ~/Code $ history
    1  PS1="prupleEndurer @ bash \w $ "
    2  ls
    3  cd Code
    4  pwd
    5  history
    6  pwd
    7  pwd
    8  pwd
    9  set | grep hist
   10  set | grep HIST
   11  export | grep HIST
   12  export
   13  history
prupleEndurer @ bash ~/Code $ history -s abcd
prupleEndurer @ bash ~/Code $ history
    1  PS1="prupleEndurer @ bash \w $ "
    2  ls
    3  cd Code
    4  pwd
    5  history
    6  pwd
    7  pwd
    8  pwd
    9  set | grep hist
   10  set | grep HIST
   11  export | grep HIST
   12  export
   13  history
   14  abcd
   15  history
prupleEndurer @ bash ~/Code $

在上面的实例中, 我们执行命令 history -s abcd 将  abcd 加入到命令历史列表中。

2.8 history -w [文件]:将当前历史写入到历史文件中,并追加到历史列表中

2.8.1  将当前历史写入到默认历史文件中

系统默认历史文件说明符由环境变量 HISTFILE 指定。

prupleEndurer @ bash ~ $ set | grep  $HISTFILE
HISTFILE=/home/csdn/.bash_history
_=/home/csdn/.bash_history
prupleEndurer @ bash ~ $ cat /home/csdn/.bash_history
cat: /home/csdn/.bash_history: No such file or directory
prupleEndurer @ bash ~ $ history -w
prupleEndurer @ bash ~ $ cat /home/csdn/.bash_history
PS1="prupleEndurer @ bash \w $ "
cat ~/.bash_history
set | grep  $HISTFILE
cat /home/csdn/.bash_history
history -w
prupleEndurer @ bash ~ $ 

我们先执行 set | grep  $HISTFILE 命令 查询环境变量 HISTFILE 的值为:/home/csdn/.bash_history。

然后我们执行  cat /home/csdn/.bash_history 命令查看 /home/csdn/.bash_history 的内容,结果这个文件不存在。

接着我们执行 history -w  命令将命令行历史记录 保存到 /home/csdn/.bash_history。

最后我们再次执行 cat /home/csdn/.bash_history 命令查看 /home/csdn/.bash_history 的内容,这次文件不仅存在,而且文件内容就是我们之前输入的命令。

2.8.2  将当前历史写入到指定文件中

我们将 命令行历史记录 保存到 到当前目录下的文件 c.log中。

prupleEndurer @ bash ~ $ history -w c.log
prupleEndurer @ bash ~ $ cat c.log
PS1="prupleEndurer @ bash \w $ "
cat ~/.bash_history
set | grep  $HISTFILE
cat /home/csdn/.bash_history
history -w
cat /home/csdn/.bash_history
history -w c.log
prupleEndurer @ bash ~ $ 

  

首先,我们执行命令  history -w c.log   将 命令行历史记录 保存到 到当前目录下的文件 c.log中。

然后,我们执行命令  cat c.log   查看文件 c.log 的内容。

2.9 !:重复执行命令

2.9.1 !! 或 !-1:重复执行上一条命令

prupleEndurer @ bash ~/Code $ pwd
/home/csdn/Code
prupleEndurer @ bash ~/Code $ !!
pwd
/home/csdn/Code
prupleEndurer @ bash ~/Code $ !-1
pwd
/home/csdn/Code
prupleEndurer @ bash ~/Code $ 

 

我们执行命令!! 或 !-1 ,均会重复执行上一条命令pwd

除了以上两种方法,还有两种方法 :

  • 使用方向键↑选中命令,按↑↓调整,并回车执行
  • 按Ctrl + p,调出命令,并回车执行

 2.9.2 !命令历史列表列号 :重复执行历史列表中指定行的命令

prupleEndurer @ bash ~ $ ls
Code
prupleEndurer @ bash ~ $ ls Code
prupleEndurer @ bash ~ $ cd Code
prupleEndurer @ bash ~/Code $ ls
prupleEndurer @ bash ~/Code $ history
    1  PS1="prupleEndurer @ bash \w $ "
    2  ls
    3  ls Code
    4  cd Code
    5  ls
    6  history
prupleEndurer @ bash ~/Code $ !2
ls
prupleEndurer @ bash ~/Code $ ! 2
bash: 2: command not found

在上面的实例中,命令 !2 会执行命令历史列表中的 第2条命令 ls

由于 当前目录 下没有内容,所以ls命令没有显示。

如果 我们输入的命令是 ! 2,就会报错。

注意:

  • ! 与 命令历史列表列号 之间不能有空格。
  • 命令历史列表列号如果为正整数,则从头往下数;如果为负整数,则从下往上倒数,例如!-1执行的就是命令列表中最后一条命令

如果我们指定的命令历史列表列号 不在 命令历史列表实际列数中,会怎么样呢?

prupleEndurer @ bash ~/Code $ !0
bash: !0: event not found
prupleEndurer @ bash ~/Code $ echo $?
0
prupleEndurer @ bash ~/Code $ !100
bash: !100: event not found
prupleEndurer @ bash ~/Code $ echo $?
0
prupleEndurer @ bash ~/Code $ 

我们执行命令 !0 和 !100,系统都会提示:event not found

而命令返回值均为0。

 2.9.3 !字符串 :重复执行历史列表中以指定字符串开头的命令

prupleEndurer @ bash ~/Code $ history
    1  PS1="prupleEndurer @ bash \w $ "
    2  ls
    3  ls Code
    4  cd Code
    5  ls
    6  history
    7  ls
    8  ! 2
    9  cd Code
   10  ehco $?
   11  echo $?
   12  echo $?
   13  echo $?
   14  echo $?
   15  echo $?
   16  history
prupleEndurer @ bash ~/Code $ !cd
cd Code
bash: cd: Code: No such file or directory
prupleEndurer @ bash ~/Code $ ! cd
prupleEndurer @ bash ~ $ !ls
ls
Code
prupleEndurer @ bash ~ $ !ls Cod
ls Cod
ls: cannot access Cod: No such file or directory
prupleEndurer @ bash ~ $ echo $?
2
prupleEndurer @ bash ~ $ 

我们行执行命令 history 查看当前命令历史列表

然后先后执行 了 !cd! cd!ls !ls Cod 命令。从执行情况看,要注意两点:

  1. ! 和 字符串 之间不能有空格
  2. 如果命令历史列表中不包括指定字符串的命令,系统会直接执行字符串,比如 !ls Cod

2.10 其它使用技巧

网上介绍的一些使用技巧,大家可以试试。

2.10.1  重新执行或查看命令历史中的命令

  • !:0 将前一条命令去除参数再执行
  • Ctrl + n显示当前历史中的下一条命令,但不执行
  • Ctrl + j执行当前命令
  • !?string 重复前一个包含string字符串的命令
  • !string:p   仅打印命令历史,而不执行
  • !$:p 打印输出!$(上一条命令的最后一个参数)的内容
  • !*:p 打印输出!*(上一条命令的所有参数)的内容
  • ^string 删除上一条命令中的第一个string
  • ^string1^string2将上一条命令中的第一个string1替换为string2
  • !:gs/string1/srting2 将上一条命令中所有的string1都替换为string2

2.10.2 使用(reverse-i-search)模式

Crtl + r:在命令历史中搜索命令

Crtl + g:从历史搜索模式退出

2.10.3 使用命令历史记录中的参数

  •  重新调用前一个命令中最后一个参数

     有3种方法:

  1. !$
  2. Esc . (点击Esc键后松开,然后点击.键)
  3. Alt+. (按住Alt键的同时点击.键),在一些终端软件中屏蔽了Alt功能键,需要开启
  • command !^      利用上一个命令的第一个参数做cmd的参数
  • command !$      利用上一个命令的最后一个参数做cmd的参数
  • command !*      利用上一个命令的全部参数做cmd的参数
  • command !:n     利用上一个命令的第n个参数做cmd的参数
  • command !n:^    调用第n条命令的第一个参数
  • command !n:$    调用第n条命令的最后一个参数
  • command !n:m    调用第n条命令的第m个参数
  • command !n:*    调用第n条命令的所有参数
  • command !srting:^   从命令历史中搜索string开头的命令,并获取它的第一个参数
  • command !srting:$   从命令历史中搜索string开头的命令,并获取它的最后一个参数
  • command !srting:n   从命令历史中搜索string开头的命令,并获取它的第n个参数
  • command !srting:*   从命令历史中搜索string开头的命令,并获取它的所有参数

三、与history命令相关的环境变量

prupleEndurer @ bash ~/Code $ set | grep HIST
HISTFILE=/home/csdn/.bash_history
HISTFILESIZE=500
HISTSIZE=500

  • HISTFILE        :指定了默认命令历史文件说明符
  • HISTFILESIZE:指定默认命令历史文件中保存命令的记录总数,即命令历史文件中最多只有HISTFILESIZE行
  • HISTSIZE       :指定了 history 命令输出的记录数,即输出命令历史文件中的最后HISTSIZE行

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/281540.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

引领企业人工智慧转型的 5 个可行策略

人工智能的最新进展引发了企业AI转型,其规模、速度和不确定性程度都是巨大的。那些敢于大胆行动、走在时代前沿的企业,将能够抓住人工智能在几乎每个行业中带来的巨大增长和价值创造机会。这样做需要他们的领导人掌握人工智能作为二十一世纪通用技术的深…

hbuilder对比两个文件的方法(图文教程)

查看专栏目录 Network 灰鸽宝典专栏主要关注服务器的配置,前后端开发环境的配置,编辑器的配置,网络服务的配置,网络命令的应用与配置,windows常见问题的解决等。 类似于git上文件不同的版本的对比,hbuilder…

一文轻松入门Dubbo

1、简介 Dubbo是一个高性能、轻量级的开源分布式服务框架,最初由阿里巴巴开发并开源。它提供了服务注册、发现、调用和负载均衡等分布式服务治理功能,旨在简化分布式系统的开发和维护。 Dubbo框架的核心概念: 服务提供者(Provider)&#xf…

Baumer工业相机堡盟工业相机如何通过NEOAPI SDK设置相机的图像剪切(ROI)功能(C++)

Baumer工业相机堡盟工业相机如何通过NEOAPI SDK设置相机的图像剪切(ROI)功能(C) Baumer工业相机Baumer工业相机的图像剪切(ROI)功能的技术背景CameraExplorer如何使用图像剪切(ROI)功…

【网络安全 | Misc】normal_png

方法一 可以通过stegsolve或winhex看到图片高度被改写: 改为: 再保存图片即可: flag{B8B68DD7007B1E406F3DF624440D31E0}方法二 使用脚本查看宽高是否被修改: import zlib import struct import argparse import itertoolspars…

【开源】基于Vue+SpringBoot的学生综合素质评价系统

目录 一、摘要1.1 项目介绍1.2 项目录屏 二、功能模块2.1 学生功能2.2 教师功能2.3 教务处功能 三、系统展示四、核心代码4.1 查询我的学科竞赛4.2 保存单个问卷4.3 根据类型查询学生问卷4.4 填写语数外评价4.5 填写品德自评问卷分 五、免责说明 一、摘要 1.1 项目介绍 基于J…

Java集合/泛型篇----第三篇

系列文章目录 文章目录 系列文章目录前言一、什么是list接口二、说说ArrayList(数组)三、Vector( 数组实现、 线程同步)四、说说LinkList(链表)前言 前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家。点击跳转到网站,这篇文章男女通…

百度沧海文件存储CFS推出新一代Namespace架构

随着移动互联网、物联网、AI 计算等技术和市场的迅速发展,数据规模指数级膨胀,对于分布式文件系统作为大规模数据场景的存储底座提出了更高的要求。已有分布式文件系统解决方案存在着短板,只能适应有限的场景: >> 新型分布式…

双指针刷题(三)

所有算法文章链接(最底部) http://t.csdnimg.cn/IbllR 1.有效三角形个数 力扣(LeetCode)官网 - 全球极客挚爱的技术成长平台 1.分析题意 给一个非负的数组,判断这个数组能组成多少个三角形。 2.解题思路 补充知识…

Python:正则表达式速通,码上上手!

1前言 正则表达式(Regular Expression)是一种用来描述字符串模式的表达式。它是一种强大的文本匹配工具,可以用来搜索、替换和提取符合特定模式的文本。 正则表达式由普通字符(例如字母、数字、符号等)和元字符&#…

NFS的基本使用

#江南的江 #每日鸡汤:岁月匆匆,时光荏苒,感悟人生路漫漫,不忘初心方得始终。 #初心和目标:和从前的自己博弈。 NFS(存储共享服务) 本文要点摘要: 下面将讨论什么是NFS,如何配置NFS,…

自然语言处理(第17课 文本分类和聚类)

一、学习目标 1.学习文本分类的两种传统机器学习方法:朴素贝叶斯和支持向量机 2.学习文本分类的深度学习方法 3.学习文本分类的性能评估标准 4.学习文本聚类的相似性度量、具体算法、性能评估 二、文本分类 1.概述 将文本分类,主要工作是让机器分析文…

迅为RK3588开发板RTMP推流之视频监控之搭建 RTMP 媒流体服务器

1.安装 nginxrtmp 运行所要用到的库和依赖环境 apt-get update apt-get install build-essential libpcre3 libpcre3-dev libssl-dev zlib1g-dev openssl 2. 下 载 nginx-1.20.2 源 码 ( 下 载 地 址 : http://nginx.org/download/nginx-1.20.2.tar.gz) 和nginx-…

【力扣题解】P226-翻转二叉树-Java题解

👨‍💻博客主页:花无缺 欢迎 点赞👍 收藏⭐ 留言📝 加关注✅! 本文由 花无缺 原创 收录于专栏 【力扣题解】 文章目录 【力扣题解】P226-翻转二叉树-Java题解🌏题目描述💡题解🌏总结…

MySQL高级SQL语句补充

目录 1.空值(NULL)和 无值( )的区别 2.正则表达式 3.存储过程 存储过程的优点 创建存储过程 调用存储过程 查看存储过程 存储过程的参数 IN 输入参数 OUT 输出参数 INOUT 输入输出参数 删除存储过程 存储过程的控制语…

QT中的信号与槽的讲解

文章目录 信号及其特点槽及其特点代码演示标准信号与标准槽函数方式一方式二 自定义信号和槽connect()函数信号和槽函数存在函数重载的情况下Qt的信号槽机制注意事项 信号及其特点 信号:是一种特殊的函数,又称信号函数,俗称信号,…

vue 项目 添加 页面上方 NProgress进度条

NProgress官网和Github地址 路由 跳转时 页面上方 和 右上角 会有一个加载进度 安装 使用npm安装 npm install --save nprogress 基本用法 main.js 引入 import NProgress from “nprogress”; import “nprogress/nprogress.css”; 开关和关闭 start()开启NProgress进度条d…

李宏毅 自然语言处理(Voice Conversion) 笔记

前一章笔记:李宏毅 自然语言处理(Speech Recognition) 笔记 引入 什么是voice conversion? 输入一段声音,输出另一段声音,我们希望这两端声音:内容一样,其他方面不一样&#xff08…

移动硬盘打不开怎么办?没有比这更好的办法了

移动硬盘打不开是常见故障,可能的原因有很多,例如硬盘驱动器故障、文件系统损坏、分区表错误等。本文将详细分析这些原因,并提供相应的解决方法,帮助您解决移动硬盘打不开的问题。 当移动硬盘打不开时,为了保留其中的文…

web:[BJDCTF2020]The mystery of ip(ssti模板注入、Smarty 模板引擎)

题目 进入页面显示如下 点击flag页面得到ip 点击hint页面 在hint.php的源代码页面中发现 由题目可以知道要从ip入手 这里尝试抓包加上X-Forwarded-For请求头修改为127.0.0.1 因为直接将127.0.0.1输出到页面,可以猜测是ssti模板注入 可以继续验证 这里发现输入什么…
最新文章