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]#

 解答:该命令相当于既找一个文件该文件既叫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]#

 解答:管道命令 “|” 只处理前一个命令传来的正确信息,即: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,069

 

[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=0

 

[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-6

 

[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-6

 

[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: 363

解答:yum仓库:CentOS-Base.repo中没有“enabled=0或者1”一行,但默认是启用的,后来加一行enabled=0时,可下载软件包数就减少了。

 

转载于:https://www.cnblogs.com/linux-ll/p/6915926.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值