---
title: "Fedora17-command not found-命令延时"
author: "nigelzeng"
date: "2012-11-13T14:35:04Z"
tags: ["Fedora", "command not found"]
categories: ["操作系统"]
slug: "fedora17-command-not-found"
draft: false
lastmod: "2012-11-20T14:30:56Z"
id: 1724614
url: "https://nigelzeng.iteye.com/blog/1724614"
---

Fedora 17下不小心输入错误一条命令，提示command not found之后，往往还有几秒的延迟，这段时间系统干嘛去了呢？

在Fedora 17里，如果发现刚刚输入的这个命令没有，会自动在网上查找，所以导致command not found提示之后，还有几秒的latency。

 

这个机制是由“PackageKit-command-not-found-0.7.4-3.fc17.x86\_64” 包提供的，找到它的配置文件就可以把这几秒远程查找的latency关闭掉：

 

vim /etc/PackageKit/CommandNotFound.conf

 

找到SoftwareSourceSearch=true

 

\# Controls if the tool should search for packages in remote  
\# software sources. This may introduce a non-trivial delay if the sources  
\# have not been recently refreshed.  
\#  
\# Allowed values are 'true' or 'false'  
\#  
\# default=true  
SoftwareSourceSearch=true

 

设置为false，就可以关闭掉search功能。

 

另外，“SimilarNameSearch”这一条也可以考虑关掉：

 

\# Controls if the tool should look for similar command names and suggest  
\# those instead.  
\#  
\# Allowed values are 'true' or 'false'  
\#  
\# default=true  
SimilarNameSearch=true

 

它的功能如下，比如我输入‘sl’，它会提示你相似的命令是‘ls’：

 

\[root@fedora conf]# sl  
bash: sl: command not found...  
Similar command is: 'ls'

 

---EOF---

--nigelzeng