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.

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