最近的学习的linux命令笔记

vmstat 2 2

 

mail -s nihao root < test.txt     f 323   h 300-310

 

crontab  -l,-e,-r    vim /etc/crontab

 

iptables -A INPUT -p tcp -m multiport --dports 22,80 -m state --state NEW,ESTABLISHED -

j ACCEPT

 

iptables -t nat -A PREROUTING -d 192.168.238.1 -p tcp --dport 80 -j DNAT --to-

destination 192.168.238.8:8080

 

iptables -P INPUT DROP          -R   -I   -N   -E   -X   -D   -Z    -F    

iptables -A INPUT -p tcp --dport 80 -m iprange --src-range 172.16.100.5-172.16.100.10 -j DROP

 

ss -tn | grep "<80>" | wc -l

sed -n "1,3p" file      sed '/test1/d' test      echo "this is a test" | sed ‘s@test@abc@’

head -3 file

cut -c 1-4 /etc/passwd          #取每行的前1-4个字符

cut -c -4 /etc/passwd            #取每行的前4个字符

cut -c 4- /etc/passwd            #取每行的第4个到最后字符

cut -c1 -4,5 /etc/passwd        #取每行的1-4和第5个字符 

cut -c 1 /etc/passwd

sort -n -r -k -t -u 

uniq -u -c

lsof -i:80   lsof /mydata/data        fuser -v  MOUNT_POINT          fuser  -km  MOUNT_POINT   lsof -p 1708此进程打

开了哪些文件

sysctl -p /etc/sysctl.conf      sysctl net.ipv4.ip_forward       sysctl -w net.ipv4.ip_forward=1

 

rev test

grep -o -v -A -B -C -c -E -n -i 

file /dev/tty5 | awk '{print $2}'

0 8-18 * * * rm -rf /abc/* &> /dev/null

tar -czf heihei.tar.gz heihei

/etc/sysconfig/network-scripts/ifcfg-eth0

useradd -g class01 std10     useradd -G class01 std01

last       last -n 5

route add -net 10.0.0.0/8 gw 192.168.238.1       route add default gw 192.168.238.1

第一次握手,建立连接,客户端发送SYN包到服务器,并进入SYN_SEND状态,等待服务器确认;

第二次握手,服务器收到SYN,同时自己也发送一个SYN包和一个ACK包来确认客户端的SYN,并进入SYN_RECV;

第三次握手,客户端收到服务器发来的SYN+ACK后,回复服务器端一个ACK确认,发送完毕后,双方进入ESTABLISHED状态。

ping -c 10 -W 1 1.1.1.1

fsck -a /dev/sda1

ulimit -n              ls -l /proc/35417/fd/    vim /etc/security/limits.conf

dd if=/dev/sda of=./mbr bs=1 count=512

tcpdump    tcpdump -i eth1 src host 192.168.238.229    tcpdump -i eth1 dst host 192.168.238.229

tcpdump tcp port 80        tcpdump src host -c 1000 192.168.238.250 and dst 192.168.238.1

tcpdump host -c 1000 192.168.238.250 and src port 80  tcpdump -i eth3 -nnAs0 dst host 211.143.63.58

-A :  以ASCII码格式打印每个数据包(不包括链路层的数据头)。方便捕捉web页面

-nn : 不转换协议和端口号

cat /dev/urandom | head -1 | md5sum | cut -c 32 >> /pass

openssl rand -base64 30 | head -c -32 >> /pass

cat access.log | sort | uniq -c | sort -n -r | head -10

$RANDOM  [0,32767]

iptables -A INPUT -p tcp --dport 80 -m limit --limit 1000/second -j ACCEPT

grep ":[[:digit:]]{1}:" /etc/inittab

> /dev/null 2>&1

 

find ~ -name "*rpm*" 

find . -name "[A-Z]*" 

find /var -user root -a -group mail -ls

find /usr -not -user root -a -not -user bin -ls

find /etc -mtime -7 -a -user root

find  /  ( -nouser -o -nogroup )  -atime  -7  -ls

find /etc -size +1M -type f -exec ls -lh {} ;

find /etc -not -perm -001 -type f -ls

find /etc -perm /113 -type f -ls 

find / -ctime +3 -name "*.log" -exec rm -f {} ;

 

MaxKeepAliveRequests为一次连接可以进行的HTTP请求的最大请求次数

sed -e 's@^#[[:space:]]*@@g' -e '/^UUID/d' fstab

 

update user set Password=Password('new') where User='root';

flush privileges;

skip-grant-tables

 

有一块移动硬盘,上面有300G数据,如何快速cp到linux服务器?

  mount -t ntfs /dev/sdc1 /mnt/

 

运行这样一条命令:yum install ntfs-3g -y 我们的linux就支持对ntfs格式的U盘的读写了

 

partx -a [device]  lspci | grep -i 'eth'   ethtool eth0

 

POST-->BIOS(boot,sequence)-àMBR(bootloader,446) -àKernelàinitramfsà(Rootfs)init

 

awk '{print NR,NF,$1,$NF}' file   echo "this is a test" | awk 'gsub(/test/,"abc")' (使用gsub如果一行匹配多个都替换)

 

awk '/^root/,/^mysql/' test----打印以正则表达式root开头的记录到以正则表达式mysql开头的记录范围内的所有记录。如果找到

一个新的正则表达式root开头的记 录,则继续打印直到下一个以正则表达式mysql开头的记录为止,或到文件末尾

 

comm -12 1sh 2.sh 注意比较的第一个文件要用sort先排序,这是找出1sh和2.sh相同的行 -3是找不同的行,--help查看命令帮助

 

原文地址:https://www.cnblogs.com/linuxboke/p/5451187.html