现在的位置: 首页 > 综合 > 正文

很有用的shell / python 脚本片段(记录)

2017年05月09日 ⁄ 综合 ⁄ 共 289字 ⁄ 字号 评论关闭

1, kill包含某关键字的进程。

ps aux |grep eclipse |awk '{print $2}'|xargs kill -9

2. 查看当前用easy_install 安装的 python包(egg等)的安装位置:

可以通过如下的命令来显示出 ``site-packages`` ::
python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"

3. 取出/etc/passwd文件中各类shell出现的次数

cat /etc/passwd|awk -F: '{print $7}'|sort | uniq -c  


抱歉!评论已关闭.