随笔分类 -  Linux

学习记录
linux进程与端口
摘要:1.通过进程名查其占用端口: 查看进程名PID # ps -ef | grep 进程名 根据pid查看占用端口 # netstat -nap | grep PID # ps -ef|grep ssh root 17231 9429 0 10:32 ? 00:00:00 sshd: patrol [p 阅读全文

posted @ 2020-11-26 10:44 winecork 阅读(169) 评论(0) 推荐(0)

centos 7.6 忘记root密码
摘要:按e进入编辑页面 在LANG=en_US.UTF-8 后面添加 rw single init=/bin/bash ctrl+x 组合键重启,通过passwd重置root密码 如果开启了SELinux,执行命令touch /.autorelabel命令 输入exec /sbin/init命令重启系统 阅读全文

posted @ 2020-11-21 11:26 winecork 阅读(352) 评论(0) 推荐(0)

Authentication token is no longer valid; new one required You (oracle) are not allowed to access to (crontab) because of pam configuration.
摘要:-bash-4.1$ crontab -e Authentication token is no longer valid; new one requiredYou (oracle) are not allowed to access to (crontab) because of pam conf 阅读全文

posted @ 2020-10-30 11:23 winecork 阅读(226) 评论(0) 推荐(0)

linux下进程号和端口号查看
摘要:查看mysql进程号和进程名 # ps -ef|grep mysql mysql 16565 15065 0 02:22 pts/0 00:00:18 /ultrapower/mysql/bin/mysqld --defaults-file=/ultrapower/mysql/my.cnf --da 阅读全文

posted @ 2020-09-26 15:35 winecork 阅读(696) 评论(0) 推荐(0)

[解决]/bin/bash^M: bad interpreter: No such file or directory
摘要:转载:https://blog.csdn.net/kwu_ganymede/article/details/54134104 执行一个脚本full_build.sh 时, 一直是提示我:-bash: ./full_build.sh: /bin/bash^M: bad interpreter: No 阅读全文

posted @ 2020-09-08 15:21 winecork 阅读(199) 评论(0) 推荐(0)

批量ping测试脚本
摘要:通过cat查看文件ipAddress.txt获取单行ip地址,根据if的"不等于"(-ne)条件判断,将返回状态(echo $?)为0表示成功,非0则失败。 1 #! /bin/bash 2 IP_LIST=`cat ipAddress.txt` 3 for i in ${IP_LIST} 4 do 阅读全文

posted @ 2020-03-23 10:13 winecork 阅读(182) 评论(0) 推荐(0)

linux6.5禁用telnet
摘要:# more /etc/redhat-releaseRed Hat Enterprise Linux Server release 6.5 (Santiago) 使用SSH协议进行远程维护,禁用telnetvi /etc/xinetd.d/telnetdisable=no重启xinetd进程serv 阅读全文

posted @ 2019-10-29 22:00 winecork 阅读(1496) 评论(0) 推荐(0)

限制用户su到root
摘要:eg:指定testuser用户可以切换到root用户 1.root操作,修改指定用户testuser附加组wheel # usermod -G wheel testuser 2.去掉su文件如下行的“#” # vi /etc/pam.d/su 3.文件login.defs末行添加“SU_WHEEL_ 阅读全文

posted @ 2019-10-29 16:06 winecork 阅读(534) 评论(0) 推荐(0)

按系统日期生成目录
摘要:# more PMFileCreat.sh #!/bin/bash today=$(date '+%Y%m%d') mkdir /opt/$today #ls -lrt /opt/dayFiles/PM*|tail -6|awk '{print $9}'|xargs -i cp {} ./$today/ cd /opt/dayFiles/ ls -lrt PM*|tail -6|awk '{pri 阅读全文

posted @ 2019-10-14 18:17 winecork 阅读(207) 评论(0) 推荐(0)

linux删除多文件
摘要:问题:删除多文件报错: #cd /home/bmc/Patrol3/Linux-2-6-x86-64-nptl/remote #rm -rf * -bash: /bin/rm: Argument list too long 原因: 系统限制,命令getconf ARG_MAX查看当前限制 方法1: 阅读全文

posted @ 2018-11-15 20:08 winecork 阅读(196) 评论(0) 推荐(0)

NTP centOS6.5
摘要:server: 编辑文件/etc/ntp.conf 添加如下 server IP prefer #主服务器 peer IP #备服务器 保存退出 启停: #/etc/init.d/ntpd start 系统自动启动 #chkconfig --list|grep ntp #chkconfig --le 阅读全文

posted @ 2018-06-29 00:04 winecork 阅读(115) 评论(0) 推荐(0)

shell脚本之lftp上传
摘要:#!/bin/bash# Upload HW cdr to ESB by FTP# wirter by HanBing TEL:local=/opt/NMSAPP/business/hwbill/tarFile/yesterday=`date -d "1 day ago" +"%Y%m%d"` cd 阅读全文

posted @ 2018-04-26 11:31 winecork 阅读(750) 评论(0) 推荐(0)

导航