随笔分类 -  Linux 进阶类

摘要:通过fdisk 查看显示所有磁盘或闪存的信息 # fdisk -l /dev/sd* 使用 badlocks检查 linux 硬盘上的坏道/坏块。也可以修复坏道,但仅限于逻辑坏道,物理坏道只能更换硬盘 # badblocks -s -v /dev/sda > libin.txt # tail -f 阅读全文
posted @ 2022-07-28 16:39 LB_运维技术 阅读(3066) 评论(0) 推荐(1) 编辑
摘要:smartctl -i 指定设备 -d 指定设备类型,例如:ata, scsi, marvell, sat, 3ware,N -a 或A 显示所有信息# smartctl -a /dev/sdb1 -l 指定日志的类型,例如:TYPE: error, selftest, selective, dir 阅读全文
posted @ 2022-07-28 16:24 LB_运维技术 阅读(238) 评论(0) 推荐(0) 编辑
摘要:注:仅支持PC服务器(rhel7同类系统版本) #yum install -y ipmitool 没有就安装 #ipmitool lan print 打印出管理口地址信息 #lsmod |grep ipmi 查看是否加载模块 #ipmitool user list 1 列举所有用户和ID,一般ID会 阅读全文
posted @ 2022-07-28 16:23 LB_运维技术 阅读(294) 评论(0) 推荐(0) 编辑
摘要:parted /dev/sdb (用part命令对3T硬盘进行分区处理) mklabel gpt (用gpt格式可以将3TB弄在一个分区里) unit TB (设置单位为TB) mkpart primary 0 3 (设置为一个主分区,大小为3TB,开始是0,结束是3) mkpart primary 阅读全文
posted @ 2022-07-28 16:20 LB_运维技术 阅读(183) 评论(0) 推荐(1) 编辑
摘要:[root@libin1 ~]# blkid [root@libin1 ~]# uuidgen [root@libin1 ~]# xfs_admin -U f5239f62-12e5-4f67-8cce-b418de5f7939 /dev/sdc1 [root@libin1 ~]# blkid 阅读全文
posted @ 2022-07-28 16:19 LB_运维技术 阅读(82) 评论(0) 推荐(0) 编辑
摘要:1、ps aux|grep lookbusy 2、ps -ef|grep lookbusy|grep -v grep|cut -c 9-15 3、ps -ef|grep lookbusy|grep -v grep|cut -c 9-15|xargs kill -9 ps aux 以用户的格式显示所有 阅读全文
posted @ 2022-07-28 16:18 LB_运维技术 阅读(197) 评论(0) 推荐(0) 编辑
摘要:# ll -i1 第一列数字即该乱码文件夹的额inode号 # find -inum inode号 |xargs -i mv {} 新文件或者文件夹名 # find -inum inode号 |xargs -i rm -rf {} 重命名该文件或者文件夹如果乱码中有带数字或者带字母的可以,可以匹配删 阅读全文
posted @ 2022-07-28 16:16 LB_运维技术 阅读(488) 评论(0) 推荐(0) 编辑
摘要:注意:目录要求 /etc :目录和目录的内容 /etc/:只有目录的内容 cp -r /etc /tmp cp -r /etc/ /tmp/ 本地模式: cp rm 例如:# rsync /etc/hosts /tmp/ 隧道模式: 例如:# rsync -avz -e "ssh -p22" /et 阅读全文
posted @ 2022-07-28 16:14 LB_运维技术 阅读(384) 评论(0) 推荐(0) 编辑
摘要:放在~/.bashrc文件中 # vim ~/.bashrc PS1='\e[1;32m[\e[0m\t \e[1;33m\u\e[36m@\h\e[1;31m \W\e[1;32m]\e[0m$ ' # source ~/.bashrc # 阅读全文
posted @ 2022-07-28 16:11 LB_运维技术 阅读(20) 评论(0) 推荐(0) 编辑
摘要:定时任务(cronie 软件名称) crond (服务名称 进程名称) # crontab -l #查看定时任务脚本 (1)检查进程: ps -ef 、ps aux(更加详细 cpu 内存使用率) # ps -ef | grep crond | grep -v grep | wc -l # ps - 阅读全文
posted @ 2022-07-28 16:04 LB_运维技术 阅读(90) 评论(0) 推荐(0) 编辑
摘要:(-d:删除 -c:取反 -cd:除了什么都删除) 例如1: # cat redhat.txt 12333 12333 # tr '123' 'abc' <redhat.txt #只会改变输出的内容 # tr -cd 'a-zA-Z0-9' </dev/urandom # tr -cd 'a-zA- 阅读全文
posted @ 2022-07-28 15:47 LB_运维技术 阅读(57) 评论(0) 推荐(0) 编辑
摘要:硬链接:在同一个磁盘分区中文件的inode号码一样了 这些文件互为硬链接(用 ls -lhi) 创建硬链接: ln(link) ,可以防止误删了一个文件,但是不能防止误修改 例如: # ln redhat.txt redhat.txt.hard #创建硬链接 # ls -lhi #查看第一列的数字确 阅读全文
posted @ 2022-07-23 18:43 LB_运维技术 阅读(78) 评论(0) 推荐(0) 编辑
摘要:seq生成序介绍用法:seq 开始 结束 例如:seq 10 #从1到10进行排序seq 2 20 #从2到20进行排序seq 1 2 20 #从1开始每次加2进行排序到20,大于20不排序显示seq 10 -2 1 #从10开始每次减2进行排序到1,少于1不排序显示 阅读全文
posted @ 2022-07-23 18:40 LB_运维技术 阅读(125) 评论(0) 推荐(0) 编辑
摘要:# echo $LANG #查看当前使用的字符集,检查(rh6、7都一样)# export LANG=zh_CN.UTF-8 #临时修改字符集,重启失效 # vim /etc/locale.conf #永久性修改(1)# source /etc/locale.conf #永久性生效 # locale 阅读全文
posted @ 2022-07-23 18:39 LB_运维技术 阅读(286) 评论(0) 推荐(0) 编辑
摘要:selinux值的设置vim /etc/selinux/config # 重启服务器后生效#setenforce 0/1 #临时性修改,立即生效,0关闭,1开启#getenforce #查看 bash-completion #若不能TAB键 就装这个包 注: enforcing #开启permiss 阅读全文
posted @ 2022-07-23 18:38 LB_运维技术 阅读(171) 评论(0) 推荐(0) 编辑
摘要:开机自启命令 程序 脚本(命令大礼包)存放 # /etc/rc.local == /etc/rc.d/rc.local Centos 7.x 温馨提示 LIdao warning 用法:1、chmod +x /etc/rc.d/rc.local #第一次使用需要给X执行权限2、vim /etc/rc 阅读全文
posted @ 2022-07-23 18:37 LB_运维技术 阅读(67) 评论(0) 推荐(0) 编辑
摘要:环境变量的使用# libin=111# echolibin# echo libinlibin libin 用法2:[root@libin3 ~]# echoHOSTNAME[root@libin3 ~]# ping HOSTNAME # echoPS1# PS1='[\u@\ 阅读全文
posted @ 2022-07-23 18:36 LB_运维技术 阅读(79) 评论(0) 推荐(0) 编辑
摘要:/etc/inittabLinux运行级别的配置文件(Cent0S6&Cent0S7)运行级别 Linux不同状态Centos 6.x Cent0s 7.x (# ll /usr/lib/systemd/system/runlevel*.target/ll /etc/systemd/system/d 阅读全文
posted @ 2022-07-23 18:35 LB_运维技术 阅读(36) 评论(0) 推荐(0) 编辑
摘要:(1)gg/1G/:1 #把光标移动到文件的第一行(2)G/:#把光标移动到文件的最后一行(3)100gg/100G/:100 #把光标移动到文件的第100行(4)0(数字0)/^ #把光标移动到这一行的行首(5) #把光标移动到到这一行的结尾(7)yy #复制光标所在行(8)p/paste 阅读全文
posted @ 2022-07-23 18:34 LB_运维技术 阅读(114) 评论(0) 推荐(0) 编辑
摘要:# >~/.bash_history# history -c #第一步#清空当前缓存中的命令#关闭shell连接,可以避免写入~/.bash_history # 保留历史命令 1000条# vi /etc/profile 或者:sed -i ‘s/HISTSIZE=1000/HISTSIZE=100 阅读全文
posted @ 2022-07-23 18:33 LB_运维技术 阅读(57) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示