linux文件搜索查找命令

HHD Device Monitoring Studio:破解版在串口调试中的实战应用 本文详细介绍了HHD Device Monitoring Studio破解版在串口调试中的实战应用,包括安装指南、串口监控功能解析、Modbus RTU协议分析案例以及自定义协议解析技巧。通过具体操作步骤和性能优化建议,帮助开发者高效完成端口监控和调试任务,提升工作效率。 阅读详情

linux文件搜索查找命令

Posted on  2011-11-07 21:36  break_1stday 阅读(142) 评论( 0)  编辑  收藏 

1、grep

功能描述 
grep 命令在一个或多个文件中查找与指定模式匹配的字符串。如果模式里包含有空格,必须用引号括起来。grep的模式只能是一个被引号括起来的字符串或者是一个单词,后面紧跟着的参数都被当作文件名。grep命令把结果输出到标准输出上,并不改变被搜索的源文件。

命令格式 
grep pattern filename filename2 ...

grep有几个选项比较常用的 
-i    查找时忽略大小写进行比较 
-n    显示找到的行在文件中的行号 
-v    显示不匹配的行

例1:在/etc/passwd文件中查找包含"bugboy"的行 
[bugboy@bugboy ~]$ grep bugboy /etc/passwd 
bugboy:x:500:500:YanDingcheng:/home/bugboy:/bin/bash

grep在/etc/passwd文件中查找含有bugboy的每一行,如果找到就把该行输出到标准输出上,grep的退出状态 
为0;如果没找到,grep将不会输出任何信息,退出状态为1;如果指定的文件不存在,grep的退出状态为2。

grep模式支持正则表达式,下面是一些常用的正则表达式匹配元字符。

^      行起始锚定符,例如'^love',匹配所有以love开始的行。 
$     行结束锚定符,例如'love$',匹配所有以love结束的行。 
.      匹配任意一个字符, 例如'l..e',匹配所有以"l"开头,紧跟两个字符,然后以"e"结尾的字符串。 
*     匹配0个或多个任意字符,例如' *bug',匹配以任意多个空格开始,后跟"bug"的字符串。 
[]     匹配字符集中的一个字符,例如'[Bb]ook',匹配Book或book。 
[^]   匹配不在字符集中的一个字符,例如'[^A-Z]low',匹配所有不以大写字母开头,后跟"low"的字符串。 
/<   单词超始锚定符,例如'/<go',匹配所有以"go"开头的单词。 
/>   单词结束锚定符,例如'or/>',匹配所有以"or"结束的单词。 
x/{m/}    匹配m个x,例如'o/{5}',匹配5个o,即"ooooo"。 
x/{m,/}   匹配至少m个x,例如'o/{5,/},匹配至少5个o,即"ooooo","oooooo"等。 
x/{m,n/} 匹配m到n个x,例如'o/{2,5/}',匹配2到5个为,即"oo","ooo","oooo","ooooo"。

例2:在/etc/passwd中查找用户名以"b"开头的用户 
[bugboy@bugboy test]$ grep ^b /etc/passwd 
bin:x:1:1:bin:/bin:/sbin/nologin 
bugboy:x:500:500:YanDingcheng:/home/bugboy:/bin/bash

例3:在/etc/passwd中查找SHELL为bash的用户 
[bugboy@bugboy test]$ grep bash$ /etc/passwd 
root:x:0:0:root:/root:/bin/bash 
ftp:x:14:50:FTP User:/var/ftp:/bin/bash 
netdump:x:34:34:Network Crash Dump user:/var/crash:/bin/bash 
pvm:x:24:24::/usr/share/pvm3:/bin/bash 
mysql:x:27:27:MySQL Server:/var/lib/mysql:/bin/bash 
postgres:x:26:26:PostgreSQL Server:/var/lib/pgsql:/bin/bash 
bugboy:x:500:500:YanDingcheng:/home/bugboy:/bin/bash

例3:在/etc/passwd中查找含有"00"的行 
[bugboy@bugboy test]$ grep '0/{2/}' /etc/passwd 
games:x:12:100:games:/usr/games:/sbin/nologin 
bugboy:x:500:500:YanDingcheng:/home/bugboy:/bin/bash

例4:查找sscanf.c文件中的非空行 
[bugboy@bugboy test]$ cat sscanf.c 
#include <stdio.h> 
#include <stdlib.h>

int main(int argc, char *argv[]) 
{ 
    const char *str = "I am bugboy"; 
    char mystr[256];

    sscanf(str, "%s", mystr); 
    printf("1: %s/n", mystr);

    char key[64], value[64]; 
    sscanf(str, "%s %s", key, value);

    printf("key: %s, value: %s/n", key, value);

    return 0; 
} 
[bugboy@bugboy test]$ grep -v '^ *$' sscanf.c 
#include <stdio.h> 
#include <stdlib.h> 
int main(int argc, char *argv[]) 
{ 
    const char *str = "I am bugboy"; 
    char mystr[256]; 
    sscanf(str, "%s", mystr); 
    printf("1: %s/n", mystr); 
    char key[64], value[64]; 
    sscanf(str, "%s %s", key, value); 
    printf("key: %s, value: %s/n", key, value); 
    return 0; 
}

例5:查找sscanf.c文件中含有"const char"的行,注意,如果要查找的字符串不只一个单词,要用引号括起来。 
[bugboy@bugboy test]$ grep "const char" sscanf.c 
    const char *str = "I am bugboy"; 
2、find

功能描述 
find命令在文件系统中查找文件

命令格式 
find  [path ...] [option] [-exec | -ok | -print]

find 命令的参数 
path    find命令所查找的目录路径。 
-exec   find命令对查找到的每一个匹配文件执行一个shell命令,命令格式为 "-exec command {} /;", 
        注意“{}”和“/;”之间有一个空格,最后的“;“也不要忘了。 
-ok     和-exec的作用相同,只是在执行命令之前请求用户确认,更安全的执行命令。
-print  将查找到的文件输出到标准输出。

例1:查到/tmp目录下所有扩展名为".tmp"的文件并删除。 
[bugboy@bugboy test]$ find /tmp -name "*.tmp" -exec rm {} /; 
这里用到了一个-name选项,是指按文件名查找,后面我将会对它进行说明。

命令选项 
-name      按照文件名查找文件。 
-perm       按照文件权限来查找文件。 
-user        按照文件属主来查找文件。 
-group     按照文件所属的组来查找文件。 
-mtime -n +n  按照文件的更改时间来查找文件,-n表示文件更改时间距现在n天以内,+n表示文件更改时间距现在n天以前。 
              find命令还有-atime和-ctime选项,它们和-mtime选项类似。 
-nogroup   查找无有效所属组的文件,即该文件所属的组在/etc/groups中不存在。 
-nouser    查找无有效属主的文件,即该文件的属主在/etc/passwd中不存在。 
-newer file1 ! -newer file2  查找更改时间比文件file1新但比文件file2旧的文件。 
-type      查找某一类型的文件,诸如: 
    b - 块设备文件。 
    d - 目录。 
    c - 字符设备文件。 
    p - 管道文件。 
    l - 符号链接文件。 
    f - 普通文件。 
-size n:[c] 查找文件长度为n块的文件,带有c时表示文件长度以字节计。 
-depth     在查找文件时,首先查找当前目录中的文件,然后再在其子目录中查找。 
-fstype    查找位于某一类型文件系统中的文件,这些文件系统类型通常可以在配置文件/etc/fstab中找到, 
                该配置文件中包含了本系统中有关文件系统的信息。 
-mount     在查找文件时不跨越文件系统mount点。 
-follow     如果find命令遇到符号链接文件,就跟踪至链接所指向的文件。 
-cpio        对匹配的文件使用cpio命令,将这些文件备份到磁带设备中。

另外,下面三个的区别: 
  -amin  n 查找系统中最后N分钟访问的文件 
-atime n 查找系统中最后n*24小时访问的文件 
-cmin  n 查找系统中最后N分钟被改变文件状态的文件 
-ctime n 查找系统中最后n*24小时被改变文件状态的文件 
  -mmin  n 查找系统中最后N分钟被改变文件数据的文件 
-mtime n 查找系统中最后n*24小时被改变文件数据的文件

例2:查找当前目录下的块设备文件 
[bugboy@bugboy dev]$ find . -type b 
./fd0H720 
./fd0H360 
./fd0H1440 
./fd0D720 
这里省略掉了部份结果。

例3:查找当前目录下5天以内修改过的文件 
[bugboy@bugboy test]$ find . -mtime -5 
. 
./toto.s 
./toto.c 
./tookit 
./over 
./over.s 
./over.c 
./tookit.c

例3:查找当前目录下比stat.c文件新,比over.c文件旧的文件 
[bugboy@bugboy test]$ find . -newer stat.c ! -newer over.c 
./toto.s 
./crypt 
./test 
./toto.c 
./strtok 
./foo.h 
./fstatvfs 
./strsep.c

例4:查找当前目录下,具有644(用户可读、写,组可读,其它用户可读)权限的文件 
[bugboy@bugboy test]$ find . -perm 644 
./auto/gnip-1.0.tar.gz 
./auto/gnip.o 
./auto/.deps/gnip.Po

find命令与xargs命令相结合使用

在使用find命令的-exec选项处理匹配到的文件时, find命令将所有匹配到的文件一起传递给exec执行。但有些系统对能够传递给exec的命令长度有限制,这样在find命令运行几分钟之后,就会出现溢出错误。错误信息通常是“参数列太长”或“参数列溢出”。这就是xargs命令的用处所在,特别是与find命令一起使用。

find命令把匹配到的文件传递给xargs命令,而xargs命令每次只获取一部分文件而不是全部,不像-exec选项那样。这样它可以先处理最先获取的一部分文件,然后是下一批,并如此继续下去。

在有些系统中,使用-exec选项会为处理每一个匹配到的文件而发起一个相应的进程,并非将匹配到的文件全部作为参数一次执行;这样在有些情况下就会出现进程过多,系统性能下降的问题,因而效率不高;

而使用xargs命令则只有一个进程。另外,在使用xargs命令时,究竟是一次获取所有的参数,还是分批取得参数,以及每一次获取参数的数目都会根据该命令的选项及系统内核中相应的可调参数来确定。

例5:查找当前目录下所有的.c文件,并在文件中搜索stat字符串,输出包含stat的行和行号 
[bugboy@bugboy test]$ find . -name "*.c" | xargs grep -n stat 
./stat.c:3:#include <sys/stat.h> 
./stat.c:5:#include <sys/statvfs.h> 
./stat.c:9:    struct statvfs fsd; 
./stat.c:11:    statvfs("/", &fsd); 
./fstatvfs.c:2:#include <sys/statvfs.h> 
./fstatvfs.c:4:#include <sys/stat.h> 
./fstatvfs.c:10:    struct statvfs vfs; 
./fstatvfs.c:14:    if (fstatvfs(fd, &vfs) < 0) { 
./fstatvfs.c:15:        fprintf(stderr, "fstatvfs error()./n"); 
./statl.c:2:#include <sys/stat.h> 
./statl.c:8:    struct stat statbuf; 
./statl.c:15:    stat(argv[1], &statbuf); 
./statl.c:16:    if (S_ISDIR(statbuf.st_mode)) { 
./statl.c:18:    } else if (S_ISBLK(statbuf.st_mode)) { 
./test.c:7:static int get_netmask_len(const char *netmask)

3、which, whereis

which命令在PATH环境变量中查找可执行文件,并打印出文件的全路径。例 
[bugboy@bugboy test]$ which test 
/usr/bin/test 
[bugboy@bugboy test]$ which ls man find 
alias ls='ls --color=tty' 
        /bin/ls 
/usr/bin/man 
/usr/bin/find

whereis命令查找源文件、可执行文件、手册文件的位置。例 
[bugboy@bugboy test]$ whereis test 
test: /usr/bin/test /usr/share/man/man1p/test.1p.gz /usr/share/man/man1/test.1.gz
[bugboy@bugboy test]$ whereis ls find 
ls: /bin/ls /usr/share/man/man1p/ls.1p.gz /usr/share/man/man1/ls.1.gz 
find: /usr/bin/find /usr/share/man/man1p/find.1p.gz /usr/share/man/man1/find.1.gz

which和whereis这两个命令都可以接受多个参数作为查找命令。


转自:http://www.cnblogs.com/helloBreak/archive/2011/11/07/2240331.html



GD32F303开发实战(一):从零搭建MDK工程与时钟配置详解 本文详细介绍了如何从零开始为GD32F303微控制器搭建一个清晰、可维护的MDK工程模板。内容涵盖开发环境准备、工程目录结构规划、文件分组管理、关键工程配置,并重点解析了时钟树原理,手把手指导配置108MHz系统时钟。通过实战步骤与常见问题排查,帮助开发者构建一个稳定可靠的开发基础,便于后续功能扩展。 阅读详情

相关推荐

SNN目标识别MNIST

总体来说这篇论文提出的方法用了多种更精密的细节,如LIF膜电位公式,三种STDP方法,但我觉得还可以有很大的改进,比如输入层全连接到兴奋层,兴奋层通过抑制层实现的侧向抑制,抑制层不参与学习等等。尤其是兴奋层通过抑制层实现侧向抑制这里,当神经元兴奋时,通过抑制层再倒回兴奋层,所抑制的已经经过一了一段时间的延迟。如有错误,请不吝赐教。

m0_74982304的博客 1262

linux命令获取ftp文件列表名称和上传日期

ftp文件如下:打印结果:命令详解如下:curl就不用说了,远程请求文件服务器。

sara_han的博客 1788

告别Docker Desktop!Colima在Mac上的5分钟极速安装与配置指南(M1芯片实测)

本文详细介绍了如何在Mac(尤其是M1芯片)上快速安装和配置Colima,作为Docker Desktop的免费替代品。通过优化配置和实战指南,帮助开发者提升容器运行效率,减少资源占用,实现丝滑的开发体验。

weixin_28839601的博客 445

linux 常用(三) ftp服务命令

ftp命令与通常的linux命令不太相同,所以自己记下。 登陆方式: 替换下面例子中 IP 或域名为你的服务器地址 ftp ip 例如: ftp domain.comftp 192.168.0.1ftp user@ftpdomain.com 然后 绝大多数的 FTP 服务器是使用密码保护的,因此这些 FTP 服务器会询问'username'和'password'.

xiaohai798的专栏 1252

NMOS管和PMOS管做开关控制电路

NMOS管和PMOS管做开关控制电路

while(1) 3万+

从Reset到Read:深入解析Rolling Shutter曝光流水线

本文深入解析Rolling Shutter(卷帘曝光)的工作原理,重点探讨Reset和Read信号在图像传感器中的关键作用。通过Reset-Read流水线机制,详细解释了曝光控制、时序调优及运动伪影补偿等核心技术,帮助读者理解卷帘曝光在高速摄影和动态场景中的应用。

weixin_42531925的博客 253

Linux下常用的ftp操作命令

文章目录1.登陆ftp服务器2.ftp子命令2.1.帮助命令2.2.查看ftp中的文件列表(ls和dir都可以查看)2.3.切换ftp的目录2.4.查询linux系统信息1) 查询系统中的文件列表(ls)2)切换linux中的工作目录(lcd)2.5.下载上传文件或目录1)创建(mkdir)和删除(rmdir)ftp目录2)下载ftp的文件下载单个文件(get)下载多个文件(mget)3)上传文件3.1)上传单个文件(put)创建测试文件上传3.2)上传多个文件(mput)2.6.ftp文件目录操作1)修改

qichangjian的博客 5695

图像处理(12)--图像各种噪声及消除方法

文章目录结构1.什么是图像噪声2. 图像噪声来源3. 噪声分类及其消除方法3.1 高斯噪声及其消除方式3.1.1 如何确定一种噪声是高斯噪声3.1.2 高斯滤波消除高斯噪声3.1.3 高斯函数的重要性质3.2 瑞利噪声及其消除方式3.3 伽马(爱尔兰)噪声及其消除方式3.4 指数分布噪声及其消除方式3.5 均匀噪声及其消除方式3.6 脉冲(椒盐)噪声及其消除方式 1.什么是图像噪声 图像噪声是指...

ShaneHolmes 11万+

Linux下的FTP服务器

从零开始写一个FTP服务器和配套客户端

qq_52479948的博客 2374

【DRAM存储器六十七】DDR5介绍--训练相关之write leveling

详述DDR5 write leveling细节

highman110的博客 284

【Claude】Disabled organization 错误:组织被禁用的原因与 API Key 绕过方法

如果环境变量存在,下一步是找出它在哪里被设置的。"Disabled organization" 错误的本质不是账户被封,而是认证优先级冲突。环境变量优先级最高始终覆盖 OAuth 订阅认证报错信息具有误导性:"组织被禁用"指的通常是 API Key 所属的组织,而不是你的个人账户旧 Key 是隐形炸弹:即使你已经不再使用某个组织的 API,只要环境变量中残留该 Key,它就会持续覆盖你的订阅认证非交互模式更敏感claude -p模式下,只要有环境变量,就会强制使用它,完全忽略/login。

博客 8857

linux ftp 查找文件,Linux shell ftp命令根据文件日期下载文件的方法

需求:ftp获取远程数据的文件,根据文件的创建时间点下载文件。 可以自行扩展根据文件的大小等其他需求。知识点总结:1、获取文件的时间:ls -lrt|awk '{print $6" "$7" "$8}'时间内容:Sep 8 16:032、时间格式转换date -d "Sep 8 16:03" +%Y%m%d%H%M转换结果:2017090816033、指定文件名,正则匹配pattern="${m...

weixin_30129661的博客 1179

【QNX+Android虚拟化方案】01 - 芯片介绍

【QNX+Android虚拟化方案】01 - 芯片介绍

|~~~热爱生活、努力学习的小伙汁~~~| 2944

Linux下文件搜索、查找、查看命令

Linux下文件搜索、查找、查看命令 1、最强大的搜索命令:find 查找各种文件的命令  2、在文件资料中查找文件:locate   3、搜索命令所在的目录及别名信息:which  4、搜索命令所在的目录及帮助文档路径:whereis 5、在文件中搜寻字符串匹配的行并输出:grep......

weixin_43976602的博客 3485

深度学习工具包 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")

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

liunx 全盘查找_Linux下文件搜索、查找、查看命令

Linux下文件搜索、查找、查看命令1、最强大的搜索命令:find 查找各种文件的命令2、在文件资料中查找文件:locate3、搜索命令所在的目录及别名信息:which4、搜索命令所在的目录及帮助文档路径:whereis5、在文件中搜寻字符串匹配的行并输出:grep6、分页显示一个文件或任何输出结果:more7、分页显示一个文件并且可以回头:less8、指定显示前多少行文件内容:head9、指定显...

weixin_39628945的博客 1280

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

Linux文件搜索与查找命令速记

在本文中,我们详细介绍了Linux文件搜索与查找命令的基本用法和高级技巧,并给出了使用注意事项。在现代的信息化时代,Linux作为一款广泛应用于服务器和终端用户的操作系统,文件搜索与查找命令的功能变得越来越重要。Linux文件搜索与查找命令是Linux操作系统中一项强大的功能,它可以帮助用户在海量文件资源中快速定位到所需文件。在实际应用中,我们建议大家在使用Linux文件搜索与查找命令时,结合实际情况进行灵活运用,以达到最佳的效果。对于需要大量文本信息查找的情况,locate命令是一个很好的选择。

searchboy2025的博客 61

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

Linux find命令详解使用:掌握高效文件查找搜索

find是一个功能非常强大的文件搜索工具,能够基于各种条件搜索文件和目录,并执行相应的操作。通过灵活运用find的各种选项和高级用法,可以极大提高在 Linux 和 Unix 环境下的文件管理和操作效率。

promise524的博客 3627

linux 搜索s开头的文件,Linux文件查找/内容搜索命令

Linux的文件检索或者日志文件关键字搜索应该是很常用的工作场景, 这里汇总常见的命令用法.find以文件名查找.# 只查找特定文件find . -type f -name '*.py'# 只查找特定文件find . -type f -name '*.py'# 在所有目录查找特定文件名find / -type f -name httpd.conf# 忽略大小写find . -iname# 忽略目录...

weixin_28826545的博客 4063

Linux查找文件树,Linux搜索查找命令

Linux搜索查找指令find,用于在文件树中查找文件并作相应的处理-name:按照文件名查找文件-perm:按照文件权限查找文件-user:按照文件属主来查找文件-size:按照指定的文件大小查找文件【+n:大于,-n:小于,n:等于】-group:按照文件所属的组来查找文件-mtime:按照文件更改时间来查找文件,-n表示n天之内,+n表示n天以前-newer file1 file2:查找更改...

weixin_42360285的博客 258

linux 查找py文件命令_Linux下的搜索查找命令的详解(find)

4.findLinux下find命令在目录结构中搜索文件,并执行指定的操作。Linux下find命令提供了相当多的查找条件,功能很强大。由于find具有强大的功能,所以它的选项也很多,其中大部分选项都值得我们花时间来了解一下。即使系统中含有网络文件系统( NFS),find命令在该文件系统中同样有效,只你具有相应的权限。 在运行一个非常消耗资源的find命令时,很多人都倾向于把它放在后台执行,因为...

weixin_36448199的博客 1212

转载—Linux下文件搜索、查找、查看命令

Linux下文件搜索、查找、查看命令

qq_21952195的博客 1758

HoRain云--Linux文件查找:find命令时间搜索全攻略

本文详细介绍了Linux系统中使用find命令按时间搜索文件的实用技巧,包括基础参数(-mtime/-mmin)、精确时间范围搜索(-newermt)以及组合条件搜索方法。文章还提供了搜索结果处理技巧(查看详情、批量操作)、性能优化建议和常见问题解决方案。通过对比表格展示了不同时间参数的适用场景,帮助用户高效定位时效性文件。文末特别提醒注意命令安全性,并鼓励读者持续学习。

sinat_57153473的博客 1189

简书 Linux 搜索文件夹,linux下的find文件查找命令与grep文件内容查找命令

文章目录[隐藏]一、find命令1. 按照文件名查找2. 按照文件特征查找3. 使用混合查找方式查找文件二、grep命令1. 主要参数2. 实例在使用linux时,经常需要进行文件查找。其中查找的命令主要有find和grep。两个命令是有区的。区别:(1)find命令是根据文件的属性进行查找,如文件名,文件大小,所有者,所属组,是否为空,访问时间,修改时间等。(2)grep是根据文件的内容进行查找...

weixin_35935249的博客 325

Linux 命令之 find -- 查找文件和目录/搜索文件和目录

文章目录参考示例示例1,在当前目录搜索内容含有 `140.206.111.111`的所有文件:示例2,列出当前目录及子目录下所有文件和目录:示例3,在/home目录下查找以.txt结尾的文件名:示例4,基于目录深度搜索,向下最大深度限制为3:示例5,删除当前目录下所有.txt文件:示例6,删除当前目录中的名为`MyDocuments`的目录:示例7,借助`-exec`选项与其他命令结合使用,在当前目录下找出root用户所有的文件,并把文件的所有者更改为用户tom:示例8,从一个目录查找并复制所有以 '.tx

liaowenxiong的博客 1万+
上一篇: Linux 更改启动级别
下一篇: windows 批处理更改IP
lioncode
博客等级 码龄18年 67粉丝 34原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值