Powerful Ubuntu

常用命令

     lsof,它对应于“list open files”(列出打开的文件)

     fuser 命令列示了本地进程的进程号,那些本地进程使用 File 参数指定的本地或远程文件。对于阻塞特别设备,此命令列示了使用该设备上任何文件的进程。

使用端口号查看进程:

sudo lsof -i :80 | grep LISTEN  # 查看端口80的占用进程

sudo netstat -nlp | grep :80  # 另一种方式

根据端口号kill该占用tcp的进程:

sudo fuser -k 80/tcp   # 常用解决http端口占用问题

利器Tool

vim

基础编辑功能见这篇文章

常用技巧

复制粘贴

剪切板支持 查看vim --version | grep clipboard 

ubuntu安装
  sudo apt-get install vim-gtk

查看寄存器内容 :reg  linux下默认+寄存器为剪贴板, windows下为*

  

tmux (终端复用软件)待更新

proxychains-ng   (为某个程序设置使用代理,可以结合tor使用)

# Install proxychains with:
  sudo apt-get install proxychains

# And add the configuration for your current user:

mkdir ~/.proxychains  # create this dir if not exists

cat >> ~/.proxychains/proxychains.conf <<EOF
strict_chain
proxy_dns 
remote_dns_subnet 224
tcp_read_time_out 15000
tcp_connect_time_out 8000
localnet 127.0.0.0/255.0.0.0
quiet_mode

[ProxyList]
socks5  127.0.0.1 1080    # proxy server
EOF

# Now test it with: 
  proxychains4 curl http://www.askubuntu.com/

试一试

   `sudo proxychains4 apt-get update`

w3m 文本web浏览器

在终端访问谷歌  http://elgoog.im/terminal/

w3m www.google.com

网络优化 

Squid

Squid Cache是HTTP代理服务器软件。Squid用途广泛的,可以作为缓存服务器,可以过滤流量帮助网络安全,也可以作为代理服务器链中的一环,向上级代理转发数据或直接连接互联网。Squid程序在Unix一类系统运行。由于它是开源软件,有网站修改Squid的源代码,编译为原生Windows版;用户也可在Windows里安装Cygwin,然后在Cygwin里编译Squid。 Squid的发展历史相当悠久,功能也相当完善。除了HTTP外,对于FTP与HTTPS的支持也相当好,在3.0测试版中也支持了IPv6。但是Squid的上级代理不能使用SOCKS协议。

Polipo

与squid相比polipo更适合个人用户,更轻量级且容易配置,并能提供足够强大的缓存和网络优化功能。

HAProxy

高可用HTTP/TCP代理

haproxy.cfg示例

global
  	maxconn 1024000

defaults
  	mode http
  	balance roundrobin
  	option redispatch
  	option forwardfor

  	timeout connect 5s
  	timeout queue 5s
  	timeout client 50s
  	timeout server 50s

frontend http-in
	bind *:9006	
	default_backend http-servers

frontend ws-in
  	bind *:9005
  
  	# Any URL beginning with socket.io will be flagged as 'is_websocket'
  	acl is_websocket path_beg /socket.io
  	acl is_websocket hdr(Upgrade) -i WebSocket
  	acl is_websocket hdr_beg(Host) -i ws

  	# The connection to use if 'is_websocket' is flagged
  	use_backend websockets if is_websocket

frontend http-node-in
	bind *:9008
	default_backend http-node-servers

frontend chatscript-in
	bind *:9009
	mode tcp
	default_backend chatscript


backend http-servers
  	balance roundrobin
  	server server1 127.0.0.1:9016 check
  	server server2 127.0.0.1:9026 check
  	server server3 127.0.0.1:9036 check
  	server server4 127.0.0.1:9046 check
  	server server5 127.0.0.1:9056 check

backend websockets
  	balance source
  	option http-server-close
  	option forceclose
  	server ws-server1 127.0.0.1:9015 weight 1 maxconn 10240 check
  	server ws-server2 127.0.0.1:9025 weight 1 maxconn 10240 check
  	server ws-server3 127.0.0.1:9035 weight 1 maxconn 10240 check
  	server ws-server4 127.0.0.1:9045 weight 1 maxconn 10240 check
  	server ws-server5 127.0.0.1:9055 weight 1 maxconn 10240 check

backend chatscript
	mode tcp
	balance source
	server engine1 127.0.0.1:9019 check
	server engine2 127.0.0.1:9029 check
	server engine3 127.0.0.1:9039 check

backend http-node-servers
	mode http
	balance roundrobin
	server node-server1 127.0.0.1:9018 check
	server node-server2 127.0.0.1:9028 check
	server node-server3 127.0.0.1:9038 check

  

原文地址:https://www.cnblogs.com/7explore-share/p/5877733.html