文章 16
评论 3
浏览 252550
linux基础命令

linux基础命令

#sed
* 替换字符串
sed -i 's/old_string/new_string/g' filename

#prometheus热加载
curl -X POST http://ip:19102/-/reload

#telnet不通分析
*telnet connect to address 10.138.xxx.xxx: Connection refused 服务没起
*Trying 10.138.xxx.xxx...   (防火墙等原因导致)端口没通
telnet时无法退出 ctrl+} quit

#ssh -p10022 -uroot-pxxxx     SSH连接另一台主机 
#TMOUT=0                      关闭会话超时时间 

#linux文件句柄数open files查看 ulimit -n (默认1024)

#跨服务器传输文件
scp components.yaml root@192.168.26.25:/opt/module/k8s/pod-controller

#磁盘相关
df -Th
du -sh *|sort -hr
#磁盘扩缩容

#系统服务
systemctl start/restart/status/stop kubelet.service
/usr/lib/systemd/system或/etc/systemd/system 两者区别
#设置开机自启
systemctl enable prometheus-os.service
或者
vim /etc/rc.d/rc.local
chmod u+x /etc/rc.d/rc.local(centos7下首次设置开机自启的话需要增加该文件权限)

#linux环境变量设置
/etc/profile.d/xx.sh和/etc/profile文件

#为普通用户添加sudo权限(sudo -i | sudo su -)并设置免密登录
chmod u+w /etc/sudoers 
zqm ALL=(ALL) NOPASSWD:ALL

#查看系统所有用户
cat /etc/passwd 

#查看linux操作系统版本
uname -r查看操作系统版本 -a查看内核版本 cat /etc/redhat-release

#yum源配置-外网(cd /etc/yum.repos.d)
wget http://mirrors.aliyun.com/repo/Centos-8.repo
yum clean all
yum makecache

#重命名文件
文件名带() mv new\(1\).txt new.txt
文件名乱码 mv "乱码文件名" new.txt

#实时查看系统日志tail -200f /var/log/messages

#vim 光标移至文件末尾G 开头gg 移至行首0 行末$

#cd C:\Windows\System32   ipconfig /flushdns

#ctrl+a移到命令最前 +e末尾

#sql增删改查
update table_name set filed_name='xxx' where filed_name2='xxx';
delete  from table_name where filed_name='xxx';
source /tmp/a.sql
动态签名档

© 2024皖ICP备2024033306号

Designed with by 02Rider

加载中...

All of us will be better

取消