馮荷飛 孫前
摘 要:本地計算機內文件數量逐年增長,并且文件和目錄還處于不斷的變化中,比如新增、刪除、修改等,因而用戶想要快速定位到所需文件也是越發困難。隨著Linux操作系統的推廣,普通Linux用戶更需要一款易用的本地文件快速搜索工具。在業務邏輯模塊中建立全盤索引、更新文件索引信息,采用Tkinter庫設計圖形用戶界面,以SQlite嵌入式數據庫管理索引數據,并使用inotify接口調用Linux內核特性來監控文件系統的變化。基于此,本文使用Python語言開發了一款輕量級的本地文件搜索工具,并能夠方便普通Linux用戶的快速搜索需求。
關鍵詞:Linux;本地文件;搜索;快速
中圖分類號:TP311 文獻標識碼:A
Abstract:Given that local files in computers increase year by year,and files and catalogues are in continuous changes,such as add,delete,modify,etc.,it becomes more difficult for users to fast locate the required documents.With the promotion of the Linux operating system,ordinary Linux users need an easy-to-use fast searching tool for local files.In the business logic module,the paper sets up index,updates file index information,uses Tkinter library to design GUI,manages data with SQlite embedded database,and applies Inotify interface to call Linux kernel characteristics to monitor file system changes.Based on this,this paper uses the Python language to develop a convenient local file searching tool,which can facilitate the rapid search requirements of ordinary Linux users.
Keywords:Linux;local files;search;fast
1 引言(Introduction)
在現今信息化時代,大數據概念已深入人心,各種類型信息、資源層出不窮。個人計算機中的文件越來越多,用戶想要快速定位到所需文件也是越發困難。操作系統自帶的文件搜索工具搜索速度較慢。因而在Windows平臺下出現了一大批由第三方開發的本地文件快速搜索工具,其中最著名的則是Everything軟件[1]。近年來隨著Linux操作系統的大力推廣,眾多國內Linux發行版中的中標麒麟、優麒麟、Deepin日益成熟,不少普通用戶也選擇了Linux系統。而Linux系統下卻沒有簡單易用的本地快速搜索工具。因此開發一款滿足普通用戶的輕量級本地文件搜索工具顯得十分有必要。
2 Linux下的文件查找方法(The file locating method in Linux)
任何一種操作系統都由成千上萬的文件組成,Linux系統更是認為“一切皆文件”。普通的文件、目錄、字符設備、塊設備、套接字等在Linux中都是以文件被對待。……