linux 查找文件夹命令_如何从命令行在Linux中查找文件,文件夹和目录?
linux 查找文件夹命令
Linux provides different ways to find and locate files and folders. We can use GUI tools like GNOME and KDE file managers or other 3’rd party applications designed for finding files. In this tutorial, we will look at how to find files, folders, and directories from the command line.
Linux提供了多种查找和定位文件和文件夹的方法。 我们可以使用GNOME和KDE文件管理器之类的GUI工具,也可以使用其他旨在查找文件的第三方应用程序。 在本教程中,我们将研究如何从命令行查找文件,文件夹和目录。
在Linux中查找文件和文件夹的工具 (Tools To Find Files and Folder In Linux)
As stated previously there are a lot of tools that can be used to find files and folders. We will look in detail all of them. Here list of these tools.
如前所述,有很多工具可用于查找文件和文件夹。 我们将详细介绍所有这些。 这里列出这些工具。
- find找
- locate定位
- grepgrep
- which哪一个
- whereis哪里
查找命令(Find Command)
find
command is very featureful command used with a lot of different options. More details about find
command can be found from the following tutorial.
find
命令是非常有特色的命令,它具有许多不同的选项。 可从以下教程中找到有关find
命令的更多详细信息。
Linux Find Command With Examples
Linux使用示例查找命令
仅查找文件(Find Only Files)
We can search only files by providing file type as -type f
. We will search files those named conf
in this example. We will use the glob start and end of the search term in order to accept any prefix or postfix for the search term. So this will match conffff
, myconf
, myconfffff
, myconfiguration.txt
etc.
我们可以通过将文件类型设置为-type f
来仅搜索文件。 在此示例中,我们将搜索名为conf
文件。 我们将使用全球范围内搜索词的开头和结尾,以便接受搜索词的任何前缀或后缀。 因此,这将匹配conffff
, myconf
, myconfffff
, myconfiguration.txt
等。
$ find . -type f -name "*conf*"
Alternatively, we can specify the path we want to search for the given file name. We will provide the path according to .
. In this example, we will search in the /etc
path.
或者,我们可以指定要搜索给定文件名的路径。 我们将根据提供路径.
。 在此示例中,我们将在/etc
路径中搜索。
$ find /etc -type f -name "*conf*"
仅查找文件夹(Find Only Folders)
We may need only to find the folder. We will specify the type like below a directory.
我们可能只需要找到该文件夹。 我们将在目录下指定类型。
$ find . -type d -name "*conf*"
查找命令(Locate Command)
locate
command can be used as an offline database of all files and folders. locate
will search a database which is created with updatedb
command. More detailed information can get from the following tutorial.
locate
命令可以用作所有文件和文件夹的脱机数据库。 locate
将搜索使用updatedb
命令创建的数据库。 可以从以下教程中获得更多详细信息。
locate Command Tutorial With Examples For Linux To Find Files
使用Linux查找文件的示例找到命令教程
As locate
database only holds file and folder names we can not search in detail. But this database provides us very fast search option then find
command because it works offline.
由于locate
数据库仅包含文件和文件夹名称,因此我们无法详细搜索。 但是此数据库为我们提供了非常快速的搜索选项,然后提供了find
命令,因为它可以脱机工作。
更新数据库 (Update Database)
As stated previously locate
uses a database to search files and folders. Updating this database is important before a search. The update will take very little time.
如前所述, locate
使用数据库来搜索文件和文件夹。 搜索之前更新此数据库很重要。 更新将花费很少的时间。
$ updatedb
搜索文件或文件夹 (Search For File or Folders)
We will use locate
command and the file and folder name to search.
我们将使用locate
命令以及文件和文件夹名称进行搜索。
$ locate /home/ismail/*back*
Grep命令(Grep Command)
grep
command mainly filters given text and files contents but we can use it to find files and folders. For more detail
grep
命令主要过滤给定文本和文件内容,但是我们可以使用它来查找文件和文件夹。 欲了解更多信息
Introduction to Linux Grep Command With Examples
Linux Grep命令简介和示例
We can use ls
command recursively and grep the files and folder we want to find. In this example, we will search for files and folders whose names contain backup
.
我们可以递归使用ls
命令,并grep我们要查找的文件和文件夹。 在此示例中,我们将搜索名称包含backup
文件和文件夹。
$ ls -R -l | grep backup
哪个命令(Which Command)
which
command is not an actual file and folder search. which
command simply search current environment executable files. This is generally useful if we are looking for a command which is not included in PATH
variable and can not use automatically.
which
命令不是实际的文件和文件夹搜索。 which
命令仅搜索当前环境的可执行文件。 如果我们要寻找一个不包含在PATH
变量中并且不能自动使用的命令,这通常很有用。
$ which ls
Whereis命令 (Whereis Command)
whereis
command is used to list given search term related binary, source, or man page files. In this example, we will search for ls
binary and related man page files.
whereis
命令用于列出与给定搜索词相关的二进制,源或手册页文件。 在此示例中,我们将搜索ls
二进制文件和相关的手册页文件。
$ whereis ls
翻译自: https://www.poftut.com/find-files-folders-directories-linux-command-line/
linux 查找文件夹命令
linux 查找文件夹命令_如何从命令行在Linux中查找文件,文件夹和目录?相关推荐
- java url 本地文件是否存在_我的应用程序知道URL中是否存在文件会一直停止[重复]...
这个问题在这里已有答案: 我试图写一个应用程序,如果在给定的URL中有一个文件,将字符串放在textview中,这是代码和崩溃信息,可能是什么错误? public class MainActivity ...
- bin文件如何编辑_如何为高通固件创建rawprogram0和patch0文件
这是一个分步教程,显示如何为Qualcomm固件创建rawprogram0.xml和patch0.xml文件. 要求 下载并安装Python @ https://www.python.org/down ...
- openstack常用运维命令_运维人员常用的Linux命令汇总
作为运维人员,这些常用命令不得不会,掌握这些命令,工作上会事半功倍,提供工作效率. 一.文件和目录 cd命令,用于切换当前目录,它的参数是要切换到的目录的路径,可以是绝对路径,也可以是相对路径. cd ...
- linux vim命令_提升生产力的20大Linux Vim命令
linux vim命令 VIM or the Vi Improved text editor is one of the most advanced text editors available. L ...
- centos找不到chattr命令_一个骚命令防止你的文件被误删除!
大家好,我是良许. 文件是我们在电脑里最珍贵的财富,我们经常工作了老半天,然后出来的成果就只是一个文件而已.特别是程序员,我们写了半天的代码,结果也就是一个个代码文件而已. 但是,我们都有过这样惨痛的 ...
- debian查看ip地址命令_鲜为人知而又实用的 Linux 命令大全
点击"Cisco思科CCIE俱乐部"→点击右上角"..."→"设为星标" 资讯丨干货丨入群 联系小E微信:SPOTO123456 Li ...
- lxrun不是内部或外部命令_在Win10 安装 WSL的Linux子系统,解决cmd中执行lxrun时提示“不是内部或外部命令”...
Win10 安装Linux子系统原理就是安装一个(Linux系统的)应用程序.使用应用程序一般的使用Linux子系统,非常方便. 第一步:启用开发者模式 启用开发者模式,其实很简单,本人参考的是该文章 ...
- java代码执行linux命令_怎么用java代码运行linux命令
展开全部 以下方法支持Linux和windows两个系统的命令行调用.还用到了apache的lang工具包32313133353236313431303231363533e78988e69d83313 ...
- find命令_用find命令查找文件目录
find 命令: 目的:查找符合指定条件的文件 格式:find 目录名 选项 查找条件 举例1: 说明: /Users/lanjingui/Desktop/指明了find命令所查找的目录路径 -nam ...
最新文章
- SignalR实现服务器与客户端的实时通信
- linux火狐浏览器49.0安装教程,火狐浏览器Linux最新版下载
- 两大硬件设计被OCP官方接受,腾讯成国内互联网公司第一家
- mobx中的数组需要注意的地方
- 甘特图看起来很生硬?教你使用智能颜色装饰你的甘特图!(一)
- Informatica 简单使用
- 计算机网络—三种CSMA协议
- java软件工程师工作业绩_JAVA软件工程师个人简历范文
- ubuntu重装显卡驱动
- 已在此计算机上安装了此应用cad,电脑安装CAD时提示已安装导致安装失败的问题如何解决...
- Spark Streaming简单入门(示例+原理)
- 齐齐哈尔大学计算机调剂,2020年齐齐哈尔大学硕士研究生调剂复试工作方案
- MySQL学习2:表的创建和增删改
- 华为路由器静态路由协议配置
- [个人资料整理]游戏类型总结
- 车牌识别停车场管理系统中 无感支付停车
- HowTo如何制作一个文字冒险游戏-里篇(1)
- pylint代码检查常见警告、提示的解决方法记录
- 检测到域名被墙如何解决?域名被墙怎么快速恢复?
- 树莓派远程4G遥控车教程(三)-摄像头安装及实现局域网实时监控