linux
gnome 自带录屏 control+shift+alt R 录屏时间限制默认30秒
修改默认时间 gsettings set org.gnome.settings-daemon.plugins.media-keys max-screencast-length "uint32 0"
修改终端小标题: PROMPT_COMMAND='echo -ne "\033]0;set-title\007"
命令行打开图片 eog + 路径
yum源格式:
[centosplus]
name=CentOS
baseurl=file:///
gpgcheck=1
enabled=0
常用监控命令:
ss Socket Statistics 接口统计 编程接口api 套接字
sar yum install -y sysstat
uptime 显示系统已经运行了多长时间 目前有多少登陆用户 1 5 15 平均负载
iostat
vmstat
top
free -m
df -h
w
who
top
ps aux -ef
lsof -i -u -c 显示打开的文件
cat /proc/meminfo 查看内存
netstat -nultp 查看正在使用的端口
ps -ef |grep defunct |grep -v grep 查找僵尸进程
watch -n 1 df -h 动态查看磁盘空间
sed -i '/oracle soft nofile/a\nice' a.conf
挂载nfs网盘
mount -t nfs -o rw 192.168.122.1:/iso/Packages_el6 /mnt
并发数:
查看apache并发 netstat -nat | grep ESTABLISHED |wc -l
查看并发 netstat -n |awk '/^tcp/ {++S[$NF]} END {for (a in S) print a,S[a]}'
查看ip连接数netstat -n |awk '{print $5}'|awk -F: '{print $1}'|sort |uniq -c|sort -nr
查看日志中访问最多的5个ipcat access_log |awk '{print $1}'|sort |uniq -c |sort -nr |head -5
脚本使用:
grant all on *.* to user@'%' identified by 允许user用户可以从任何ip访问数据库
useradd bob -p 123 添加用户并指定密码
dd if=/dev/zero of=/tmp/test bs=1M count=50 写入50M 0
dd if=/dev/null of=/tmp/test bs=1M count=50 全部清空
iptables -A INPUT -d ip -p tcp --dport 80 -m limit --limit 1/second -j ACCEPT
echo user$(echo $RANDOM| md5sum |cut -c 1-5) |passwd --stdin user 添加用户 付密码随意5位
修改配置文件:
awk '{if(/oracle soft nofile/)gsub(/oracle soft nofile.*/,"oracle soft nofile 777");print $0}' a.conf
替换配置
sed 's/^oracle soft nofile.*/oracle soft nofile 888/g' a.conf
追加配置
sed -i '/oracle soft nofile/a\nice' a.conf
截取ip地址 sed -n '/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/p'
sed -i '/^$/d' a.conf 去除空行
sed 's/[[:space:]]//g' a.conf 去除空格
输出重定向
cat >> /tmp/text << ok
bob=123
bob1=455
mm=412
ok
cat << end >> /tmp/file
bob
bob123
end