1.查询网络接口上的设备ip

 sudo arp-scan -l -I enp0s25

 


 

2.ssh连接时长时间无操作会“假死”、无响应

按回车(Enter)后按住shift 按 ~(波浪号)再按.(句号)回到本机的shell。再次登陆后可以用:

who
sudo pkill -kill -t pts/0

踢掉多余的用户。

后来发现如果"假死"后,按住shift 按 ~(波浪号)再按.(句号)也能回到shell,不需要按回车。

至于如果想一开始就自动保持连接,那么

ssh -o TCPKeepAlive=yes -o ServerAliveInterval=60 username@123.123.123.123 -p 123

就可以了 。

 


 

3.验证图片是否为渐进式,以及转成渐进式

$ identify -verbose ./header-pic7-orgin.jpg | grep Interlace 
  Interlace: None
$ sudo convert ./header-pic7-orgin.jpg -interlace Plane h-progressive.jpg
$ identify -verbose ./h-progressive.jpg | grep Interlace 
  Interlace: JPEG

 


 

4.升级Pycharm的时候提示"PyCharm does not have write access to /opt/"

其实很简单,把文件夹权限改一下:

//这里可以看到文件夹权限是755
archie @ edison in /opt [16:17:22] 
$ ls -l
总用量 4
drwxr-xr-x 11 root root 4096 12月 18 15:44 pycharm-2017.3.1
//修改成777
# archie @ edison in /opt [16:17:24] 
$ sudo chmod 777 -R pycharm-2017.3.1 
[sudo] archie 的密码:
//这就改完了。
# archie @ edison in /opt [16:18:10] 
$ ls -l
总用量 4
drwxrwxrwx 11 root root 4096 12月 18 15:44 pycharm-2017.3.1
//到这里就打开Pycharm升级。升级完了之后回来再改成755
# archie @ edison in /opt [16:20:30] 
$ sudo chmod 755 -R pycharm-2017.3.1
//这就改回来了
# archie @ edison in /opt [16:22:19] 
$ ls -l                             
总用量 4
drwxr-xr-x 11 root root 4096 12月 29 16:19 pycharm-2017.3.1

 


 

5.升级Oh My Zsh的时候提示"Failed to receive SOCKS4 connect request ack."

像这样:

$ upgrade_oh_my_zsh            
Updating Oh My Zsh
fatal: unable to access 'https://github.com/robbyrussell/oh-my-zsh.git/': Failed to receive SOCKS4 connect request ack.
There was an error updating. Try again later?

把ss客户端关了又显示

fatal: unable to access 'https://github.com/robbyrussell/oh-my-zsh.git/': Failed to connect to 127.0.0.1 port 1080: 拒绝连接

细细想想,是因为代理没有走socks5.所以解决方法是:

git config --global https.proxy 'socks5://127.0.0.1:1080'
git config --global http.proxy 'socks5://127.0.0.1:1080'

顺带一提,如果要实时查看日志文件的最后部分,可以用

tail -f

 


 

6.查看文件的编码格式以及转换编码格式

$ enca i2c.c 
Simplified Chinese National Standard; GB2312
  CRLF line terminators
$ iconv -f GB2312 -t UTF8 i2c.c -o i2c-utf8.c 

 


 

7.接收向阿里云通过UDP发送的数据

安全组打开一个UDP端口(例如12345端口),然后

nc -lu 12345

启用监听即可。

 


 

8.转换win下的doc产生的"with CRLF line terminators"

$ sudo pacman -S dos2unix

$ file Infrared_Radiation_Encoding.c  
Infrared_Radiation_Encoding.c: UTF-8 Unicode text, with CRLF line terminators

$ dos2unix Infrared_Radiation_Encoding.c
dos2unix: 正在转换文件 Infrared_Radiation_Encoding.c 为Unix格式...

$ file Infrared_Radiation_Encoding.c     
Infrared_Radiation_Encoding.c: UTF-8 Unicode text

 


 

9.滚动升级时提示"installing x265 (2.8-1) breaks dependency 'libx265.so=151-64' required by ffmpeg2.8"

$ sudo pacman -Syu                                                      
:: 安装 x265 (2.8-1) 破坏依赖 'libx265.so=151-64' (ffmpeg2.8 需要)
:: installing x265 (2.8-1) breaks dependency 'libx265.so=151-64' required by ffmpeg2.8

只需要Removing unused packages (orphans)就好了

sudo pacman -Rns $(pacman -Qtdq)

 


 

10.遍历某个目录下的所有文件并cat

$ find ./aDirectory -type f -print0 | xargs --null cat

 


 

11.Nginx HTTP每到100次就断开

这个问题不是在Arch下遇到的,是在工作中遇到的,不过记录在这里。问题大概就是在一次TCP连接里,调了很多次get(post等也一样),到了第100次的时候Nginx就会发close下来。查了Nginx的配置有这么一段:

Keepalive Connections
Keepalive connections can have a major impact on performance by reducing the CPU and network overhead needed to open and close connections. NGINX terminates all client connections and creates separate and independent connections to the upstream servers. NGINX supports keepalives for both clients and upstream servers. The following directives relate to client keepalives:

keepalive_requests – The number of requests a client can make over a single keepalive connection. The default is 100, but a much higher value can be especially useful for testing with a load‑generation tool, which generally sends a large number of requests from a single client.

那么问题就是这样,改大就好了。


 

12.xtensa-lx106-elf-gcc command not found

原因貌似是因为这台虚拟机的ubuntu是64位的,所以装一下这个就能编译了

sudo apt-get install lsb-core

如果后续有“xtensa-lx106-elf-gcc: error while loading shared libraries: libstdc++.so.6”,那么:

sudo apt-get install lib32z1 lib32ncurses5 lib32stdc++6

 


 

12.开启监听模式嗅探wifi广播、组播报文并抓包

抓包简单,主要是开启监听模式。使用类似 ip link set dev wlp3s0 promisc on 的命令只有混杂模式,选不了监听模式。那么:

sudo pacman -S net-tools wireless_tools
#有桌面的话关闭wifi
sudo rfkill unblock wifi
sudo ifconfig wlp3s0 down
sudo iwconfig wlp3s0 mode monitor
sudo ifconfig wlp3s0 up

就可以继续用wireshark之类的抓包了。

更改监听信道:

sudo iwconfig wlp3s0 channel 13

除了上面的方式外,还可以用aircrack-ng来监听:

sudo pacman -S aircrack-ng
sudo airmon-ng check
#然后用类似systemctl stop的命令关闭相关的进程
sudo airmon-ng start wlp3s0
#然后就可以抓wlp3s0mon这个虚拟网卡的包了
#要关闭的话
sudo airmon-ng stop wlp3s0

 

 


 

13.打开百度或者mail.qq.com提示“无法验证此证书 因为颁发者未知”“无法找到该证书的颁发者”

不知道是不是因为用SS的原因,周围就我出现这个问题,切换proxy就没有这个问题,因为切换后证书就换了。反复排查无解,只能找别人电脑上导出一份CA证书。so,把 VeriSign Class1 Extended Validation CA.crt 放到百度云上,链接:https://pan.baidu.com/s/1U-U79jrIta3SMANIWXV4Yw
提取码:kacu