Skip to content

Instantly share code, notes, and snippets.

@digjack
digjack / linux 常用命令合集
Last active October 22, 2019 06:12
linux 常用命令合集
#进程按照内存占用逆序显示
ps -eo pmem,pcpu,rss,vsize,args | sort -k 1 -r | less
#文件夹内批量替换字符串
sed -i "s/127.0.0.1/172.16.1.1/g" `grep 127.0.0.1 -rl ./db.ini`
#查看连接你服务器 top10 用户端的 IP 地址
netstat -nat | awk '{print $5}' | awk -F ':' '{print $1}' | sort | uniq -c | sort -rn | head -n 10
#服务器查看出口ip
@pocesar
pocesar / get domain without subdomain.php
Created April 11, 2013 20:27
PHP code to get the domain name without subdomains (includes the tld, and the special types from IANA). Don't have support for unicode domain names.
<?php
/**
* @param string $domain Pass $_SERVER['SERVER_NAME'] here
* @param bool $debug
*
* @debug bool $debug
* @return string
*/
function get_domain($domain, $debug = false)
{