linux查看执行过的命令行,在Linux命令终端中查看和编辑曾执行过的命令 – LINUX笔记 – CFEI.NET...

今天我们来讲讲linux的知识,积累的这些知识就是我们以后的财富,各位加油.

因为水平有限,难免有疏忽或者不准确的地方,希望大家能够直接指出来,我会及时改正。一切为了知识的分享。

history 命令可以用来显示曾执行过的命令,也可以根据显示的治疗来重新执行需要的命令

n 显示n个最近的记录

-a 添加记录

-r 读取记录,但不会添加内容记录

-w 覆盖原有的history 文件

-c 清除记录

-d[n] 删除指定n条记录

-n 读取指定文件

-r 读取文件但不记录

-w 覆盖原有文件

例1

[root@redhat ~]# history #查看所有执行过的命令

1  ls

2  pwd

3  fc -l

4  history

[root@redhat ~]# history 2 #显示2条

4  history

5  history 2

[root@redhat ~]# !4 #执行编号是4的命令,注意感叹号

history

1  ls

2  pwd

3  fc -l

4  history

5  history 2

6  history

[root@redhat ~]# history -c #清除历史记录

!$ 引用前一个命令的最后一个参数

[tank@localhost workspace]$ ls -all

总用量 1060

drwxrwxr-x. 15 tank tank    4096 8月   6 16:26 .

drwx------. 60 tank tank    4096 8月  15 16:13 ..

-rw-r--r--   1 root root    2466 7月  23 18:02 1.html

drwxr-xr-x   7 tank tank    4096 7月  17 03:02 ckeditor

drwxr-xr-x.  2 tank tank    4096 5月  29 00:08 database

[tank@localhost workspace]$ !$ #取得-all

-all

bash: -all: command not found

例2

[root@redhat ~]# ! -N #执行倒数第N条命令

[root@redhat ~]# !! #执行上一条命令

fcfc 命令可以编辑曾今执行过的命令,并以批处理的形式让这些命令重新执行

-1 列出第一个指令和最后一个指令之间额度所有指令

-n 不显示编号

-r 反向排序

-e 指定文本编辑器编辑,默认Vi

-s 选择指令执行

例1

[root@redhat ~]# fc -l #查看执行过的命令,根history,很相似

348      eval echo "aaa" ls

349      eval echo "aaa";ls

350      exec ls

351      apt-get install mysql

352      apt-get install mysql-server

353      exit

354      expr 4%6

355      expr 4 % 6

356      expr 4<6

357      expr 4'358      expr 6 '+' 5

359      expr 6 '*' 5

360      expr 6 '>' 5

361      fc -l

362      man fc

363      fc --help

[root@redhat ~]# fc -s 358 #执行第358个命令

expr 6 '+' 5

11

[root@redhat ~]# fc 358 #编辑第358个命令

好啦,今天飞哥就讲到这里,后续会有更多的精彩的内容分享给大家,希望对大家能够有所帮助,也希望大家能多多支持飞网,让我们共同进步。

基于Qt与PaddleOCR的跨平台OCR工具开发实战 本文详细介绍了基于Qt与PaddleOCR开发跨平台OCR工具的实战经验。通过Qt的跨平台特性和PaddleOCR的高效识别能力,开发者可以快速构建支持Windows、Linux和macOS的OCR工具。文章涵盖了环境配置、核心功能实现、性能优化及打包发布等关键环节,特别针对中文识别、内存管理和多线程处理等常见问题提供了解决方案。 阅读详情

相关推荐

金现代面试题—— i++,++i, &&,&|自动装箱和自动拆箱(int,byte,float等)|取int等基本类型的最大值

public static void main(String[] args){ int i=1,j=1; if(i++==2&amp;amp;amp;amp;amp;amp;amp;amp;&amp;amp;amp;amp;amp;amp;amp;amp;++j==2){ i=7; } System.out.println(“i=”+i+”,j=”+j); } 请给出 输出结果:

老孟嘚吧嘚 1400

Linux查看历史命令执行记录(history)

Linux查看历史命令执行记录(history)

m0_46282787的博客 3201

Ubuntu系统下搭建QtCreator开发环境详细过程(Qt简介;Linux下安装QtCreator;Ubuntu安装后闪退蓝屏的解决方法)

Qt 是一个跨平台的 C++开发库。主要用来开发图形用户界面 (Graphical User Interface,简称 GUI) 程序。Qt 支持的操作系统有很多,例如通用操作系统 Windows、Linux、Unix、智能手机系统Android、ios、WinPhone, 嵌入式系统 QNX、VxWorks 等。

分享学习成长历程,Winter is coming! 8629

Linux history 命令详解:如何查看、显示时间、清空、重复和控制历史记录

在 Linux 中,如果你使用终端操作系统(sh、bash、zsh、fish等),那么有一个非常强大且方便的命令叫做history。它的作用是让你查看之前终端中输入的所有命令记录,以及可以方便地快速重复执行某个命令或修改一些参数后重新执行。

u012964600的博客 4万+

掌控板玩板指南1:初识掌控板、扩展板、Mind+编辑器

掌控板、I/O扩展板入门

好乐无荒之地 1万+

别再乱拖了!Godot 4.x 场景编辑器的7个隐藏操作技巧(附快捷键清单)

本文揭示了Godot 4.x场景编辑器的7个隐藏操作技巧,包括智能对齐、轴心点应用、多节点批量操作等,帮助开发者提升游戏开发效率。特别介绍了坐标系切换和自定义快捷键等实用功能,适用于处理复杂场景和团队协作。

weixin_29534421的博客 368

Linux查看用户的7个命令

<br /> 在Linux系统里,我们会经常用Linux查看用户的命令,在这里我们一些命令进行了总结,总共有7个,并做了详细的解释,以便让大家更深入的理解,接下来让我们一起来看看这些命令和具体应用。 <br /> <br />  一、Linux查看用户命令w命令<br />  该命令用于显示登录到系统的用户情况,w命令功能强大,它不但可以显示有谁登录到系统,还可以显示出这些用户当前正在进行的工作,并且统计数据相对who命令来说更加详细和科学.<br />  w命令的显示项目按以下顺序排列:当前时间,系统启动

jincf2011的专栏 6843

ESP32Servo库驱动SG90舵机:从入门到精准控制

本文详细介绍了如何使用ESP32Servo库驱动SG90舵机,从硬件连接到软件环境搭建,再到编写示例程序实现精准控制。内容涵盖库安装、基础驱动代码解析、舵机校准方法以及平滑运动控制,帮助开发者快速掌握ESP32控制舵机的核心技能,并提供了电源管理、信号抗干扰等实用避坑指南。

ik678901的博客 904

实用篇:linux如何查看历史命令(以前使用过的命令)

在 Linux 中,你可以使用以下几种方法查看历史命令

Ven%的博客 1万+

用 SAP CDS View 和 Fiori Elements 快速打造 CRM Service Order 应用──十分钟跑通从数据模型到上线的全流程

通过CDS 视图 + Fiori Elements的组合,我们得以在极短时间内把传统 CRM Service Order 场景迁移到现代化的 Fiori 界面,而且代码量极小、可维护性高。若后续需要离线能力,可考虑将同一 OData 服务暴露给 Mobile Services,再配合 MDK 或 UI5 Mobile Toolkit;若要支持复杂审批流,则可以在同一 Launchpad 内嵌入 Process Visibility Dashboard,实现端到端可视化。

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 400

如何选择深度强化学习算法:MuZero/SAC/PPO/TD3/DDPG/DQN/等算法

如何选择深度强化学习算法:MuZero/SAC/PPO/TD3/DDPG/DQN/等算法

丨汀、的博客 5227

Linux快速查看和执行历史命令

在使用 Linux 系统过程中,熟练使用命令(CLI)比界面可视化操作(GUI)更高效,Linux 命令很多,且有时执行过的命令行语句较长,快速查询并执行历史命令是操作提效的关键因素,下面就来介绍下这方面的相关知识点。......

cdq2012的博客 2万+

基于YOLOv8的城市违建识别系统:从数据集构建到UI界面实现

YOLOv8是Ultralytics公司于2023年推出的最新一代YOLO(You Only Look Once)系列目标检测算法。更高效的骨干网络设计改进的锚框机制更精确的损失函数支持分类、检测、分割等多任务YOLOv8特别适合像违建识别这样的实时检测任务,能够在保持高精度的同时实现快速推理。

YOLO 679

Linux 系统 history(查看执行命令历史) 命令详解

history命令是Linux/Unix系统中的一个常用命令,用于查看当前用户在命令行中执行过的命令历史记录。该命令允许用户查看、搜索、编辑和执行之前执行过的命令,为用户提供了方便、快捷的操作方式。本文将全面详细地讲解history命令的各种用法和注意事项,并提供一些实用的技巧和技巧。

兴趣是最好的老师,勤能补拙 3万+

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

Linux命令之查看执行过的历史命令history

`history` 命令可以查看已经执行过的历史命令。

二木成林 3万+

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

听说你还不知道history的强大? 你还不知道谁在你linux上操作了什么?

curl。

2401_84254196的博客 1163

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

Linux系统查看历史用户的指令、代码

查看Linux系统的用户进程,历史操作指令,和记录用户登录代码。

美国梦中国心 3903

【Linux】如何查看Linux命令的使用方法

man 命令用于查看 Linux 系统的在线帮助文档(man page)。man 是 “manual” 的缩写,通过它,你可以访问关于各种命令、函数、配置文件等的详细文档。cd 是一个常用的命令,用于在 Linux 系统中切换当前工作目录。cd 后面可以跟目录的路径,用于切换到指定的目录。col -b 是一个管道命令,它用于过滤 cd 命令的输出,并去除其中特殊的控制字符。这样可以确保将干净的输出保存到文件中。

一起加油吧 1810

谁动了我的Linux?原来history这么强大!

大家好,我是肖邦,这是我的第 15 篇原创文章。当我们频繁使用 Linux 命令行时,有效地使用历史记录,可以大大提高工作效率。在平时 Linux 操作过程中,很多命令是重复的,你一定不希望大量输入重复的命令。如果你是系统管理员,你可能需要对用户操作进行审计,管理好 Linux 命令历史记录显得非常重要。今天我们来介绍一下,在 Linux 使用 history 来减少重复命令的几个实用技巧。1 基本原理 Linux 命令的历史记录,会持久化存储,默认位置是当前用户家目录的 .bash_h

hnjsjsac的博客 252

【Linux】如何查看命令运行历史时间以及操作人IP

我们在工作中,往往为了省事,多个人用一个linux账户,这样当我们在系统出问题时,无法知道是谁进行了不好的操作,比如误删除或错误的执行了命令,我们可以通过这个方法来查询定位这个“坏家伙”。......

猫巳的博客 6439

查看Linux系统中用过什么命令 history

history 命令用于显示和操作当前用户在当前会话中执行过的命令历史记录。它是 Bash shell 的内置命令,提供了一些选项和参数来查看、管理和操作命令历史记录。提示:以下所有命令都在Ubuntu-24.04-live-server-amd64系统中运行history 命令是管理和回顾命令行操作非常有用的工具,它可以帮助用户快速查找、执行和管理之前执行过的命令。

lhmx557的博客 2151

Linux 查询正在运行的shell脚本命令

2.如果太多了找不到,看的眼花,可以加条件 grep是分组 查看正在运行的shell脚本的进程shell脚本就是 sh。如图下面就是查询出来的所有sh脚本,看第三列就是脚本的进程UID,直接杀死UID就行。如果查看其它的脚本比如 python的脚本。1.查看当前运行的所有进程。

hzhairuntao的博客 1万+

linux查询用户执行过的命令,linux纪录系统用户执行过的命令

在/etc/profile文件里添加:export HISTSIZE=50000export HISTORY_FILE=/var/log/CommandHistory.logexport PROMPT_COMMAND='{ thisHistID=`history 1|awk "{print \\$1}"`;lastCommand=`history 1| awk "{\\$1=\"\" ;print...

weixin_34587698的博客 1249

查看php进程命令,linux查看进程命令是什么

linux查看进程的命令有:1、PS命令,该命令可以查看哪些进程正在运行及其运行状态;2、Top命令,该命令可以实时显示各个线程情况;3、Pstree命令,该命令以树状图的方式展现进程之间的派生关系;4、Pgrep命令等等。Linux查看进程命令一、Linux查看进程命令:PS命令ps命令是一个相当强大地Linux进程查看命令.运用该命令可以确定有哪些进程正在运行和运行地状态、 进程是否结束、进程...

weixin_29128689的博客 908

Linux 查看端口状态 netstat

Linux 查看端口状态netstat netstat命令参数: -t : 指明显示TCP端口 -u : 指明显示UDP端口 -l : 仅显示监听套接字(所谓套接字就是使应用程序能够读写与收发通讯协议(protocol)与资料的程序) -p : 显示进程标识符和程序名称,每一个套接字/端口都属于一个程序。 -n : 不进行DNS轮询,显示IP(可以加速操作) 即可显示当前服务器上所有端口及进程服务...

Rp的博客 574

linux查看执行过哪些命令,linux查看执行过的所有命令

在linux下可以通过命令查看之前执行过的命令,那么具体是哪一条命令呢?下面由学习啦小编为大家整理了linux下查看执行过命令的相关知识,希望对大家有所帮助。1.linux查看执行过的命令的命令——historyhistory 命令可以用来显示曾执行过的命令,也可以根据显示的治疗来重新执行需要的命令2.history命令参数说明-n 显示n个最近的记录-a 添加记录-r 读取记录,但不会添加内容记...

weixin_28846405的博客 1万+
上一篇: linux ubuntu下编译运行c程序,[Linux]在ubuntu系统下编译运行c程序并使用makefile管理项目...
下一篇: linux查看485串口是否在运行,RS485在linux下的调试
陈国诤
博客等级 码龄7年 24粉丝 67原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值