记录一些linux命令

1 查询某个yum源安装了哪些包
yum install yum-utils
yumdb search from_repo bar

2 查看哪些包依赖krb5-libs
repoquery --requires krb5-libs

3 利用xargs -n 1,解压多个tar文件
echo *.tgz | xargs -n 1 tar xf

4 利用tee和exec,将一个脚本中所有的输出额外添加到文件中
exec &> >(tee -a "bar.log")
echo "This will be logged to the file and to the screen"
这里利用进程替换创建了pipe,利用exec将输出重定向到了pipe

5 特定yum源不使用代理
设置proxy=_none_

6 mount smb文件系统时使用特定uid和gid
sudo mount -t cifs //10.4.130.10/smarket /mnt/smb -o user=ci,passwd=ttylnbz,uid=500,gid=500

7 用top命令看所有mongod的状态
top -p $(pidof mongod | tr ' ' ',')

8 设置系统时间
date -s "20070414 13:58:00"

9 修改hostname
hostname $(cat /etc/sysconfig/network | grep HOSTNAME | cut -d '=' -f 2)

10 kafka查看offset
./bin/kafka-run-class.sh kafka.tools.GetOffsetShell

11 为用户添加sudo权限
echo "ci ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/ci
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值