Linux运维常用脚本整理
、查找当前目录下占用为0字节的文件并删除
find ./ -type f -size -exec rm -rf {}\; #此命令不要用于对根目录0字节文件的操作
、将系统进程按内存占用大小排列显示出来
ps -e -o “%C : %p : %z : %a”|sort -k5-nr
、将系统进程按CPU占用大小排列显示
ps -e -o “%C : %p : %z : %a”|sort -nr
、匹配某文件中某一行并进行内容替换
sed -i ‘/Root/s/no/yes’/etc/ssh/sshd_config #先匹配到Root,再将此行no替换为yes
、显示所有运行级别为3并开机启动的服务
ls /etc/rc3.d/S* |cut -c - #rc3.d中S开头即为运行级别3的服务,并用cut截取第15个字符后面的内容
、取得eth0网卡的IP地址
方法1:ifconfig | grep ‘inet addr:’| grep -v ’127.0.0.1′ | cut -d:-f2 | awk ‘{ print $}’
方法2:ifconfig eth0 |grep “inet addr:” |awk ‘{print $}’|cut -c -
、TCP抓包工具分析80端口数据流
tcpdump -c -i eth0 -n dst port
、查询昨天的日期
date –date=yesterday
、删除所有空目录
find /data -type d -empty -exec rm -rf {}; #最好不要在/目录下执行此命令
、删除5天前的文件
find /data -mtime + -type f -exec rm -rf{};
、强制踢出终端用户
pkill -KILL -t pts/
、将来自80端口的请求转发到8080端口
iptables -A PREROUTING -p tcp -m tcp –dport80 -j DNAT –to-destination 127.0.0.1:
、linux服务器之间传文件
scp ~/test.txtroot@192.168.0.10:/data/ #将个人主目录下test.txt传到远程主机的/data目录下
、对大文件进行分割
split -l message.log message #按每个文件1000行来分割
split -b 5m message.log message #按每个文件5M来分割
Linux运维常用脚本整理的更多相关文章
- Linux运维常用的几个命令介绍【转】
Linux运维常用的几个命令介绍 1. 查看系统内核版本 [root@funsion geekxa]# cat /etc/issue CentOS release 6.5 (Final) Kerne ...
- 盘点Linux运维常用工具(一)-web篇之httpd
#前言:想把自己学的各种服务进行分类归档起来,于是就写了盘点Linux运维常用工具,Linux方面使用到的web应用服务有httpd(apache).nginx.tomcat.lighttpd,先了解 ...
- Linux运维常用150个命令
Linux运维常用150个命令 转载自:www.cnblogs.com/bananaaa/p/7774467.html 命令 功能说明 线上查询及帮助命令(2个) man 查看命令帮助,命令的词典,更 ...
- Linux运维-常用操作-培训用例
一.服务器环境 Centos 7.9 二.常用连接工具(免费) 1.Finalshell 2.MobaXterm 3.Putty + WinSCP 三.Linux 系统目录结构 /bin :是 Bi ...
- linux运维常用命令及知识
1.查找当前目录下所有以.tar结尾的文件然后移动到指定目录: find . -name “*.tar” -exec mv {} ./backup/ ; 查找当前目录30天以前大于100M的LOG文件 ...
- Linux运维常用命令详解
1.ls 文件属性: -:普通文件 d:目录文件 b:块设备 c:字符设备文件 l:符号连接文件 p:命令管道 s:套接字文件 文件权限: 9位数字,每3位一组 文件硬链接次数 文 ...
- Linux运维常用的命令详解
1. 查看系统内核版本 [root@funsion geekxa]# cat /etc/issue CentOS release 6.5 (Final) Kernel \r on an \m 显示了系 ...
- linux 运维常用工具表
https://code.google.com/p/httperf/ ※测量Web服务器的性能 ./configure make &&make install http://ww ...
- Linux 运维常用命令
参考: https://segmentfault.com/a/1190000009745139 http://blog.51cto.com/xuqq999/774714 .查看有多少个IP访问: aw ...
随机推荐
- 03.父工程pom、整合测试、SpringBootApplication注解
父工程 idea点击spring-boot-starter-parent找到父工程spring-boot-dependencies模仿配置 父工程 <?xml version="1.0 ...
- java object bean 转map
import java.lang.reflect.Field; /** * obj-->map * ConvertObjToMap * 2016年8月17日上午10:53:59 * @param ...
- tuple unpacking
拆开Tuple lax_coordinates = (33.9425, -118.408056) latitude, longitude = lax_coordinates # tuple unpac ...
- Spring Boot 2.x:SpringBoot
几个重要的事件回调机制: 1.配置在META-INF/spring.factories ApplicationContextInitializer SpringApplicationRunlisten ...
- ajax使用jsonp请求方式
/* //简写形式,效果相同 $.getJSON("http://app.example.com/base/json.do?sid=1494&busiId=101&jsonp ...
- centos6安装完成之后必要的配置
centos6安装完成之后必要的配置 一配置yum源 [root@centos61 ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirro ...
- 04 SecurityContextHolder与SecurityContext说明
该篇记录一下SecurityContextHolder与SecurityContext两个类,当然还有与它们关系密码的SecurityContextPersistenceFilter.java这个过滤 ...
- springmvc 的 @PathVariable
@PathVariable映射 URL 绑定的占位符 通过 @PathVariable 可以将 URL 中占位符参数绑定到控 •制器处理方法的入参中:URL 中的 {xxx} 占位符可以通过@Path ...
- c#一些操作
C# FileStream 按大小分段读取文本内容 using System.IO; namespace FileStreamRead { class Program { static void Ma ...
- python练习题自己实现一个字符串的find函数
# 第五题:自己实现一个字符串的find函数 # 1.在一个字符串中查找另一个字符串 # 2.找到了返回第一次出现的位置 # 3.没找到返回-1 # 4.参数s1为源字符串,参数s2为要查找的字符串 ...