2022年4月22日

【shell】shell脚本获取linux所有网口及连接状态

摘要: 工作上需要配置管理多个服务器,而服务器上基本上都接着有多根网线。 以前通过ethtool 网卡名称单个查询,操作比较重复且容易“吐血” [root@server01 /]# ethtool enp4s0f0 Settings for enp4s0f0: Supported ports: [ FIBR 阅读全文

posted @ 2022-04-22 15:11 卓某 阅读(1216) 评论(0) 推荐(0) 编辑

2022年4月1日

【shell】shell脚本计算1-100之和

摘要: #!/bin/bash sum=0 for i in `seq 1 100` do sum=$[${i}+${sum}] done echo ${sum} 阅读全文

posted @ 2022-04-01 17:02 卓某 阅读(190) 评论(0) 推荐(0) 编辑

【shell】shell脚本,输入一个数字n并计算1~n的和。要求:输入的数字大于1

摘要: #!/bin/bash while : sum=0 do read -p "please enter a num,num must greater than 1>>" num if test $[num] -gt 1 then for i in `seq 1 ${num}` do sum=$[${i 阅读全文

posted @ 2022-04-01 17:00 卓某 阅读(1288) 评论(0) 推荐(0) 编辑

2022年2月14日

mysql统计每天的数据量

摘要: 工作时遇到该需求:统计数据表中每天新增的记录数量,因数据库中带有时间点信息,故使用DATE_FORMAT转换成仅日期格式后,再用group by分组查询。 数据库中的时间格式: 2022-01-05 14:27:372022-01-05 14:04:422022-01-05 14:15:172022 阅读全文

posted @ 2022-02-14 14:24 卓某 阅读(2551) 评论(0) 推荐(0) 编辑

2022年1月18日

linux firewalld防火墙状态查询及开放端口

摘要: 一、查看防火墙状态 查看防火墙状态 systemctl status firewalld开启防火墙 systemctl start firewalld关闭防火墙 systemctl stop firewalld开启防火墙 service firewalld start若遇到无法开启先用:system 阅读全文

posted @ 2022-01-18 14:44 卓某 阅读(2900) 评论(0) 推荐(0) 编辑

2022年1月14日

linux /boot空间满了如何清理

摘要: 问题背景: yum -update之后,/boot分区满了 解决方法:删除/boot目录下多余文件,但该目录下文件不可随意删除,否则容易导致系统无法启动。 可删除多余内核文件,方法如下: 一、查看系统当前使用内核 uname -a [root@centos boot]# uname -a Linux 阅读全文

posted @ 2022-01-14 15:32 卓某 阅读(2786) 评论(0) 推荐(0) 编辑

2021年12月28日

lambda匿名函数

摘要: 定义方式:lambda x:x+1 (x为参数,x+1为返回值) lambda有个限制,返回值只能传入一个表达式 eg: >>> list(map(lambda x: x * x, [1, 2, 3, 4, 5, 6, 7, 8, 9]))[1, 4, 9, 16, 25, 36, 49, 64, 阅读全文

posted @ 2021-12-28 15:00 卓某 阅读(34) 评论(0) 推荐(0) 编辑

2021年12月21日

Linux查看系统信息(版本、cpu、raid)

摘要: 1、查看发行版本信息:cat /etc/redhat-release 如下为CentOS 7.6(CentOS 7.6 是 CentOS-7 的第七个发行版本) 2、查看CPU位数信息:getconf LONG_BIT 如下为运行的是64位系统 3、查看raid(磁盘列阵)信息:cat /proc/ 阅读全文

posted @ 2021-12-21 16:11 卓某 阅读(1013) 评论(0) 推荐(0) 编辑

2021年12月17日

chmod 777后,目录权限不可写解决方法

摘要: 问题: 部署web程序时,某些目录需要可写权限,故后台执行chmod -R 777 目录 通过ls -l看到已有写权限,带着稳妥的心情到前台刷新,wtf?还是不可写 解决方法: 通过关闭selinux解决,在此记录下: 一、查看selinux状态: /usr/sbin/sestatus -v 注:e 阅读全文

posted @ 2021-12-17 17:46 卓某 阅读(1208) 评论(0) 推荐(0) 编辑

2021年9月14日

python读写Excel数据(xlwt,xlrd,xlutils写入数据到已存在的Excel表格中)

摘要: 一、用到的库:xlwt,xlrd,xlutils 二、通过xlrd读取Excel数据: import xlrd # 通过open_workbook读取Excel文件 data_r = xlrd.open_workbook("资产盘点记录表.xls") #通过索引将sheet表赋值给变量 table_ 阅读全文

posted @ 2021-09-14 11:50 卓某 阅读(3432) 评论(0) 推荐(0) 编辑

导航