linux命令(16):which命令

Linux常用命令之which命令详解 which 是一个用于查找命令行工具或可执行文件路径的命令,它在 Unix 和类 Unix 系统(如 Linux 和 macOS)中非常有用。which 的主要作用是在环境变量 PATH 指定的目录列表中搜索给定命令的位置,并返回第一个找到的结果 阅读详情

linux命令(16):which命令

我们经常在linux要查找某个文件,但不知道放在哪里了,可以使用下面的一些命令来搜索: 
       which  查看可执行文件的位置。
       whereis 查看文件的位置。 
       locate   配合数据库查看文件位置。
       find   实际搜寻硬盘查询文件名称。

which命令的作用是,在PATH变量指定的路径中,搜索某个系统命令的位置,并且返回第一个搜索结果。也就是说,使用which命令,就可以看到某个系统命令是否存在,以及执行的到底是哪一个位置的命令。 

1.命令格式:

which 可执行文件名称 

2.命令功能:

which指令会在PATH变量指定的路径中,搜索某个系统命令的位置,并且返回第一个搜索结果。

3.命令参数:

-n  指定文件名长度,指定的长度必须大于或等于所有文件中最长的文件名。

-p  与-n参数相同,但此处的包括了文件的路径。

-w  指定输出时栏位的宽度。

-V  显示版本信息

4.使用实例:

实例1:查找文件、显示命令路径

命令:

which lsmod

输出:

[root@localhost ~]# which pwd

/bin/pwd

[root@localhost ~]#  which adduser

/usr/sbin/adduser

[root@localhost ~]#

说明:

which 是根据使用者所配置的 PATH 变量内的目录去搜寻可运行档的!所以,不同的 PATH 配置内容所找到的命令当然不一样的!

实例2:用 which 去找出 which

命令:

  which which

输出:

[root@localhost ~]# which which

alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot  --show-tilde'

     /usr/bin/which

[root@localhost ~]#

说明:

竟然会有两个 which ,其中一个是 alias 这就是所谓的『命令别名』,意思是输入 which 会等於后面接的那串命令!

实例3:找出 cd 这个命令

命令:

 which cd

输出:

 

       说明:

cd 这个常用的命令竟然找不到啊!为什么呢?这是因为 cd 是bash 内建的命令! 但是 which 默认是找 PATH 内所规范的目录,所以当然一定找不到的!

java——if嵌套循环、which分支结构、random的使用 2、which结构 代码示例: * switch选择结构: * 语法结构: * switch(表达式){ * case 常量1: * //语句1 * break; * case 常量2: * 阅读详情

相关推荐

Liunx基础命令 - which命令

如果我们既不关心同名文件(find与locate),也不关心命令所对应的源代码和帮助文件(whereis),仅仅是想找到命令本身所在的路径,那么这个which命令就太合适了。输出的结果包括命令的可执行文件路径、手册页路径和源代码路径等信息。命令会在环境变量$PATH指定的路径中查找命令的可执行文件,并将查找到的第一个可执行文件的完整路径输出到标准输出上。这条命令将输出cat命令的可执行文件路径为/bin/cat,手册页路径为/usr/share/man/man1/cat.1.gz。命令所在的完整路径。

鹅不糊涂的博客 2015

每天一个linux命令(16):which命令

我们经常在linux要查找某个文件,但不知道放在哪里了,可以使用下面的一些命令来搜索:        which  查看可执行文件的位置。       whereis 查看文件的位置。        locate   配合数据库查看文件位置。       find   实际搜寻硬盘查询文件名称。which命令的作用是,在PATH变量指定的路径中,搜索某个系统命令的位置,并且返回第一个搜索结果。也就...

weixin_34336526的博客 499

在国产麒麟系统上,用Postfix和Dovecot手搓一个内部邮件服务器(附Foxmail配置)

本文详细介绍了在国产麒麟系统上使用Postfix和Dovecot搭建内部邮件服务器的完整流程,包括系统准备、核心配置、安全加固及客户端适配。针对国产环境的特殊需求,提供了依赖包适配、配置差异和Foxmail客户端配置的实用解决方案,助力企业实现高效内部协作。

weixin_33722405的博客 370

linux java 卸载_linux下查看已经安装的jdk 并卸载jdk的方法(推荐)

一、查看Jdk的安装路径:whereis javawhich java (java执行路径)echo $JAVA_HOMEecho $PATH备注:如果是windows中,可以使用:set java_home:查看JDK安装路径java -version:查看JDK版本二、卸载旧版本的JDK:1. 确定JDK的版本:rpm -qa | grep jdkrpm -qa | grep gcj可能的结果...

weixin_42315338的博客 1098

linux下autocad完美替代品bricscad的安装运行

前言 在Linux平台下,能完美兼容.dwg文件的软件并不多。 虽然国产的中望和浩辰为适配uos操作系统,近期都推出了linux版本,但目前好像还没有对应的破姐流出。(如果有的话请私信我或留下评论) 然而有了这一款源自比利时的软件——bricscad,linux下查看和编辑.dwg文件再也不是噩梦了! 安装pj 资源链接:https://pan.baidu.com/s/1dC7zarlqwuO5fa4CBL_KGQ 提取码:24j6 1.下载对应的压缩包,解压并安装其中对应的deb或rpm软件包。 2.在C

weixin_35259117的博客 4482

C# emgu.cv图像识别 从大图中寻找小图,判断存在图的相似度

这是2个问题,我采用emgu.cv来解决这个识别问题,这里需要在nuget中引用emgu。最近写了一个在一张图片中,截取一部分,通过机器判断截取图片是这张图片的。第一、通过小图去找判断是否存在大图中,第二、小图存在大图的什么位置。

一个专注于技术研究创新的程序员 2467

每天一个linux命令(16):which命令

我们经常在linux要查找某个文件,但不知道放在哪里了,可以使用下面的一些命令来搜索:   which 查看可执行文件的位置。   whereis 查看文件的位置。   locate 配合数据库查看文件位置。   find 实际搜寻硬盘查询文件名称。   which命令的作用是,在PATH变量指定的路径中,搜索某个系统命令的位置,并且返回第一个搜索结果。也就是说,使用which命令,就可以看到某个系统命令是否存在,以及执行的到底是哪一个位置的命令。 1. 命令格式    which 可执行文件名称 2.

知不道道不知知不知道道道知的博客 402

2025年12月GESP真题及题解(C++一级): 小杨的爱心快递

2025年12月GESP真题及题解(C++一级): 小杨的爱心快递

王老师青少年编程 1648

Linux:常用命令16-which

which` 确定给定命令的可执行文件的路径。它帮助用户找到可执行程序的位置,这在系统管理和脚本编写中非常有用。

Wei_sx的博客 624

FanucROBOGUIDE软件二次开发:使用ROBOGUIDEAPI进行编程

菜单栏:位于界面顶部,提供文件、编辑、视图、插入、格式、工具、窗口和帮助等选项。工具栏:包含常用的工具按钮,如新建、打开、保存、运行、停止、机器人控制等。工作站视图:显示工作站的3D模型,用户可以在这里放置机器人、工件、工具和其他设备。机器人控制面板:用于控制机器人运动,包括手动移动、程序编辑和运行。程序编辑器:在这里可以编写和编辑机器人程序,支持Fanuc的R-30iB Plus和R-30iB控制柜的程序格式。状态栏:显示当前工作站的状态信息,如机器人位置、程序状态等。

kkchenjj的博客 1408

37.华为路由器:loopback(本地回环)接口的作用

本地环回接口(或地址),亦称回送地址(loopback address)。 此类接口是应用最为广泛的一种虚接口,几乎在每台路由器上都会使用。常见于如下用途: 1 作为一台路由器的管理地址 系统管理员完成网络规划之后,为了方便管理,会为每一台路由器创建一个loopback 接口,并在该接口上单独指定一个IP 地址作为管理地址 ,管理员会使用该地址对路由器远程登录(telnet ),该地址实际上起到了类似设备名称一类的功能。 但是通常每台路由器上存在众多接口和地址,为何不从当中随便挑选一个呢 ? 原因如下:由于

迷逝 3万+

Linux命令(16):which命令

which命令 功能说明 which命令用于查找并显示给定命令的绝对路径,环境变量PATH中保存了查找命令时需要遍历的目录。which指令会在环境变量$PATH设置的目录里查找符合条件的文件。也就是说,使用which命令,就可以看到某个系统命令是否存在,以及执行的到底是哪一个位置的命令。which命令只适用于可执行程序,而不适用于内置命令和命令...

weixin_33908217的博客 253

[Dify实战] 招聘筛简历机器人:自动筛选、排序、生成面试要点-带绑定资源

摘要:本文介绍了如何利用Dify优化简历筛选流程,解决人工筛选耗时、标准不统一等问题。通过结构化输出"评分+亮点+风险+面试关注点",将主观判断转化为规则化流程。关键步骤包括:设计标准化Prompt、配置权重排序策略、确保公平合规性、与ATS系统对接,以及持续优化评估指标。该方法能显著提升筛选效率(缩短招聘周期)、增强一致性(避免主观偏差),并为面试官提供结构化参考信息,最终实现更高效精准的人才筛选。

技术小甜甜:传播可落地技术,帮助个人和企业降低解决真实场景问题的成本 581

每天一个 Linux 命令(16):which命令

which命令的作用是,在PATH变量指定的路径中,搜索某个系统命令的位置,并且返回第一个搜索结果。也就是说,使用which命令,就可以看到某个系统命令是否存在,以及执行的到底是哪一个位置的命令。

young_kim的技术博客 418

Windows10环境下激活虚拟环境报错【source : 无法将“source”项识别为 cmdlet、函数、脚本文件或可运行程序的名称】

在使用Django创建Web程序前,需要创建一个虚拟的工作环境,在使用【source ll_env/bin/activate】命令激活虚拟环境时报错:source : 无法将“source”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后再试一次。所在位置 行:1 字符: 2。

提供C#相关开发 、云计算、运维测试、网络安全相关技术分享与服务,有意向可联系。 1万+

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

每天一个Linux命令(16):which命令

我们经常在linux要查找某个文件,但不知道放在哪里了,可以使用下面的一些命令来搜索:         which  查看可执行文件的位置。        whereis 查看文件的位置。         locate   配合数据库查看文件位置。        find   实际搜寻硬盘查询文件名称。 which命令的作用是,在PATH变量指定的路径中,搜索某个系统命令的位置,并且

Booooom 301

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

上一篇: linux命令(15):tail 命令
下一篇: linux命令(17):whereis 命令
CsharpGame
博客等级 码龄21年 11粉丝 1原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值