Everything for linux前言

Everything 是windows下一款快速搜索工具,它可以瞬间搜索到电脑磁盘中的任何文件,不论这个文件正躲藏在哪个角落里吃灰。Everything凭借超快的搜索速度可以做到即时搜索的效果,每输入一个字符就进行一次搜索,搜索结果立即显示,几乎没有延时。Everything不仅支持普通字符搜索,而且可以使用通配符和正则表达式进行搜索,速度较一般搜索没有一点变化。

 

一直对Everything的原理很感兴趣,希望能在Linux下使用到与Everything一样高效的工具。最近一个项目在用QT,又重新学习了一遍QT,现在闲下来了就想用QT实现一个Linux版的Everything,于是就有了这个系列的笔记。

 

Everything的工作原理
原来Everything之所以这么快靠的是NTFS中的USN Journal + 建立索引。有兴趣的可以去看一下,文章中还给出了部分代码可以在windows中读取USN。
但是Linux一般使用磁盘格式为ext3/ext4,并没有USN,这种方式也就无法在Linux下使用。

 

Locate
Linux下有两个常用的搜索命令,一个是find,另一个是locate。locate因为有一个自己数据库(mlocate.db),搜索时直接在这个数据库文件中检索,所以速度较快。于是我想到了使用QT+locate的方式实现一个Everything。

 

网上搜了一下,还真找到了几个和我想法差不多的工具,都是简单的把locate包装了一下。
1. found: 一个简单的命令行工具,包装了locate。   liancheng/found · GitHub
2. wxPython做的Everything: wxPython写前段GUI界面,后端使用locate。 Frank.Wu - cnblogs
3. catfish: 使用主机上已经存在的搜索工具作为搜索引擎的一个GUI工具。 点击查看

 

这种方式虽然简单,可以很快的做出来,但是因为使用了外部命令,搜索速度肯定快不了,没有足够的速度也就无法做到Eeverthing那样的炫酷的即时搜索(这3个工具无一例外也都没有做到)。即便如此我还是想要把它做出来看一下,我觉得想要得到一个完善的事物,需要一步一步不断的去改进,所以这一步还是要走一下的,后面再采用其他优化的方法。

 

一个初步的计划:
第一步: 后台调用 locate命令,QT绘制GUI负责显示
第二步: 读取mlocate.db文件,写入数据库,使用QT的MVC模型进行显示,数据库做Model
第三步: 直接读取mlocate.db文件,利用更高效的算法匹配,自己完成一个MVC模型中的Model
  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
ALL YOU NEED TO KNOW TO SECURE LINUX SYSTEMS, NETWORKS, APPLICATIONS, AND DATA–IN ONE BOOK From the basics to advanced techniques: no Linux security experience necessary Realistic examples & step-by-step activities: practice hands-on without costly equipment The perfect introduction to Linux-based security for all students and IT professionals Linux distributions are widely used to support mission-critical applications and manage crucial data. But safeguarding modern Linux systems is complex, and many Linux books have inadequate or outdated security coverage. Linux Essentials for Cybersecurity is your complete solution. Leading Linux certification and security experts William “Bo” Rothwell and Dr. Denise Kinsey introduce Linux with the primary goal of enforcing and troubleshooting security. Their practical approach will help you protect systems, even if one or more layers are penetrated. First, you’ll learn how to install Linux to achieve optimal security upfront, even if you have no Linux experience. Next, you’ll master best practices for securely administering accounts, devices, services, processes, data, and networks. Then, you’ll master powerful tools and automated scripting techniques for footprinting, penetration testing, threat detection, logging, auditing, software management, and more. To help you earn certification and demonstrate skills, this guide covers many key topics on CompTIA Linux+ and LPIC-1 exams. Everything is organized clearly and logically for easy understanding, effective classroom use, and rapid on-the-job training.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值