计算
除以 [hadoop-user@hadoop1]$ echo expr 9 / 3
3
加 [hadoop-user@hadoop1]$ echo expr 9 + 3
12
减 [hadoop-user@hadoop1]$ echo expr 9 - 3
6
乘以 [hadoop-user@hadoop1]$ echo expr 9 \* 3
27
取余数 [hadoop-user@hadoop1]$ echo expr 9 % 2
1
使用bc命令 加 -bash-4.1$ echo 9 + 3 |bc 12 乘 -bash-4.1$ echo 9 * 3 |bc 27
减 -bash-4.1$ echo 9 - 3 |bc 6 除 -bash-4.1$ echo 9 / 3 |bc 3
取余数 -bash-4.1$ echo 9 % 2 |bc 1
python
gdb
求和:
awk '{sum+=$1} END {print "Sum = ", sum}'
求平均值: awk '{sum+=$1} END {print "Average = ", sum/NR}'
求最大值: awk 'BEGIN {max = 0} {if ($1>max) max=$1 fi} END {print "Max=", max}'
网络
检查节点 ping NODE_IP
检查端口:
telnet IP port
关闭端口: iptables -A OUTPUT -p tcp -d 101.122.37.16 --dport 8167 -j DROP
查看端口: iptables -L
恢复端口: iptables -F
查看进程在那些处理器核上运行
ps 命令可以告诉你每个进程/线程目前分配到的(在“PSR”列)CPU ID。
示例: 方法1:
ps -o pid,psr,comm -p 214266 ps -eF|grep test
方法2:
top -p PID,按f,选择j
download
python -m SimpleHTTPServer 10000 &
rpm 相关命令
重新强制安装: rpm -ivh *.rpm --force rpm -ivh *.rpm --nodeps 更多命令请参考:https://wenku.baidu.com/view/04d18133084e767f5acfa1c7aa00b52acfc79c93.html
blktrace 相关命令
blktrace -d /dev/sda -o test.btrace -w 5 blkparse -i test.btrace.blktrace.31
rpm 安装
1023 2023-07-26 11:02:42 tar xzf essd-vhost-rpms-1.2.4.1_x86.tar.gz 1028 2023-07-26 11:03:18 rpm rm essd 1029 2023-07-26 11:03:23 man rpm 1030 2023-07-26 11:03:47 rpm -e essd 1031 2023-07-26 11:04:53 yum localinstall *.rpm 1033 2023-07-26 11:05:33 yum localinstall *.rpm
系统版本
[root@localhost ~]# cat /etc/centos-release CentOS Linux release 7.2.1511 (Core) [root@localhost ~]#
登录
sudo -u ebs ssh 101.14.1.4
IO
dd if=/dev/zero of=/dev/vdb bs=1024 count=9999999999 & dd if=/dev/zero of=/dev/vdb bs=2048 count=9999999999 & #dd if=/dev/zero of=/dev/vdb bs=1024 count=9999999999 &
查找
egrep -e "WARN|INFO" log/blockserver.log | less