【1】常见小技巧
【1.0】脚本汇总
sudo echo "export TIME_STYLE='+%Y-%m-%d %H:%M:%S'" >> /etc/profile && source /etc/profile
sudo echo "export PS1='[\u@\h \w]$ '">>/etc/profile && source /etc/profile
echo 'export HISTTIMEFORMAT="%F %T"' >>/etc/profile && source /etc/profile
【1.1】以年-月-日格式显示日期
sudo echo "export TIME_STYLE='+%Y-%m-%d %H:%M:%S'" >> /etc/profile && source /etc/profile
【1.2】linux显示当前路径的绝对路径
具体参考:https://www.cnblogs.com/gered/p/11364053.html
sudo echo "export PS1='[\u@\h \w]$ '">>/etc/profile && source /etc/profile
【1.3】删除过滤出来的文件
#删除当前目录下,不包含aaa的所有文件
ll |grep -v "aaa"|grep .sql|awk '{print $NF}'|xargs rm -f
【1.4】tar
https://www.cnblogs.com/centos2017/p/7896807.html
【1.5】history命令显示时间
echo 'export HISTTIMEFORMAT="%F %T "' >>/etc/profile && source /etc/profile
【1.6】dhcp重新分配ip地址
dhclient -r #释放现有ip
dhclient #获取新ip
【1.7】linux 查看外网出口地址
curl -s http://httpbin.org/ip
【命令小技巧】
(1)xargs 配合 scp
ls 20210803*|grep `date +%Y-%m-%d`|xargs -i scp {} dba@47.103.129.219:/data/backup/10.112.5.1