linux學習中遇到的問題—請教

問題1:find命令用 「-a」 時爲何找不出如下*sample*文件?

[root@lys test]# find / -name "usr"
/usr
/usr/share/doc/oddjob-0.30/sample/usr
/usr/share/gdb/auto-load/usr
[root@lys test]# find / -name "usr" -a -name "sample"
[root@lys test]# find / -name "usr" -a -name "*sample*"
[root@lys test]#vim

 解答:該命令至關於既找一個文件該文件既叫usr同時又叫sample,矛盾!

問題2:如下命令爲何不能重定向?

[root@lys test]# ifconfig eth10
eth10: error fetching interface information: Device not found
[root@lys test]# ifconfig eth10 2> /dev/null
[root@lys test]# ifconfig eth10 | grep 'interface' 2> /dev/null
eth10: error fetching interface information: Device not found
[root@lys test]# centos

 解答:管道命令 「|」 只處理前一個命令傳來的正確信息,即:standard output,對於standard error output會予以忽略。

問題3:yum倉庫沒有ehabled=1爲什麼仍能夠下載軟件包?

[root@lys yum.repos.d]# yum repolist
Loaded plugins: fastestmirror, refresh-packagekit
Loading mirror speeds from cached hostfile
* base: mirrors.tuna.tsinghua.edu.cn
* extras: mirrors.tuna.tsinghua.edu.cn
* updates: mirrors.tuna.tsinghua.edu.cn
repo id repo     name             status
base          CentOS-6 - Base          6,706
extras        CentOS-6 - Extras        45
updates         CentOS-6 - Updates       318
repolist: 7,069fetch

 

[root@lys yum.repos.d]# pwd
/etc/yum.repos.d
[root@lys yum.repos.d]# ls
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo
[root@lys yum.repos.d]# grep 'enabled=1' CentOS*
[root@lys yum.repos.d]# grep 'enabled' CentOS*
CentOS-Base.repo:enabled=0
CentOS-Base.repo:enabled=0
CentOS-Debuginfo.repo:enabled=0
CentOS-Media.repo:enabled=0url

 

[root@lys yum.repos.d]# grep '\[base\]' -A6 CentOS-Base.repo
[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6spa

 

[root@lys yum.repos.d]# vim CentOS-Base.repo
[root@lys yum.repos.d]#
[root@lys yum.repos.d]# grep '\[base\]' -A6 CentOS-Base.repo
[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6orm

 

[root@lys yum.repos.d]# yum clean all
Loaded plugins: fastestmirror, refresh-packagekit
Cleaning up Everything
Cleaning up list of fastest mirrors
[root@lys yum.repos.d]# yum repolist
Loaded plugins: fastestmirror, refresh-packagekit
Determining fastest mirrors
* extras: mirrors.tuna.tsinghua.edu.cn
* updates: mirrors.tuna.tsinghua.edu.cn
extras | 3.4 kB 00:00
extras/primary_db | 29 kB 00:00
updates | 3.4 kB 00:00
updates/primary_db | 864 kB 00:00
repo id          repo name            status
extras            CentOS-6 - Extras          45
updates         CentOS-6 - Updates         318
repolist: 363it

解答:yum倉庫:CentOS-Base.repo中沒有「enabled=0或者1」一行,但默認是啓用的,後來加一行enabled=0時,可下載軟件包數就減小了。

相關文章
相關標籤/搜索