Common Use Shell Commands

 1、ps aux:查看当前所有进程 ,以用户名为主键。可以查看到 USER、PID、COMMAND(binary所有位置)

 2、netstat -an:查看当前所有socket连接。可以查看到 Proto(tcp4/udp4)、LocalAddress&Port、ForeignAddress&Port。

 3、grep -E:使用egrep来解析pattern。支持或运算("|")。

        -v:取反。

      -c:只输出匹配行数。

       -i:不区分大小写。

      -n:显示匹配行号。

      -A n:显示匹配行AfterN行。

      -C n:显示file文件中匹配foo字串那行以及上下N行。

      -B n:显示匹配行BeforeN行

      -R:递归搜索所有子目录。

用法举例:

  $ grep ‘test’ d*
    显示所有以d开头的文件中包含 test的行。
  $ grep ‘test’ aa bb cc
    显示在aa,bb,cc文件中匹配test的行。

  $ grep ‘[a-z]\{5\}’ aa
    显示所有包含每个字符串至少有5个连续小写字符的字符串的行。

 4、ls -d:查看目录属性,而非展示目中文件的属性。

      -h:显示占用硬盘空间大小。

 5、df -h:显示磁盘空间。

 6、cd -:返回上次所在的目录。

 7、tee:把输入copy到stdout和文件。

 8、head、tail -n:输出头/尾n行。

Frequently Used Shell Commands的更多相关文章

  1. Testing shell commands from Python

    如何测试shell命令?最近,我遇到了一些情况,我想运行shell命令进行测试,Python称为万能胶水语言,一些自动化测试都可以完成,目前手头的工作都是用python完成的.但是无法从Python中 ...

  2. Run Shell Commands in Python

    subprocess.call This is the recommended way to run shell commands in Python compared with old-fashio ...

  3. 在R中运行Shell命令脚本(Call shell commands from R)

    aaa.R Args <- commandArgs()cat("Args[1]=",Args[1],"\n")cat("Args[2]=&quo ...

  4. mysql 使用 informatin_schema tables 创建 shell commands

    SELECT CONCAT("mysqldump -uroot -p ", TABLE_SCHEMA, " ", TABLE_NAME, " > ...

  5. Hadoop FS shell commands

    命令格式:hadoop fs -command -option args appendToFileUsage: hadoop fs -appendToFile <localsrc> ... ...

  6. echo shell commands as they are executed

    http://stackoverflow.com/questions/2853803/in-a-shell-script-echo-shell-commands-as-they-are-execute ...

  7. Running shell commands by C++

    #include <iostream> #include <stdio.h> #include <stdlib.h> using namespace std; st ...

  8. run commands in linux shell using batch file

    adb shell as root after device rooted once device rooted, we must perform "su" before we g ...

  9. python与shell的3种交互方式介绍

    [目录] 1.os.system(cmd) 2.os.popen(cmd) 3.利用subprocess模块 4.subprocessor模块进阶 [概述] 考虑这样一个问题,有hello.py脚本, ...

随机推荐

  1. 一起来点React Native——你必须要会点FlexBox布局

    一.FlexBox布局 1.1 FlexBox是什么意思呢? flexible(形容词):能够伸缩或者很容易变化,以适应外界条件的变化 box(名词):通用的矩形容器 1.2  什么是FlexBox布 ...

  2. BZOJ3297: [USACO2011 Open]forgot(背包)

    3297: [USACO2011 Open]forgot Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 189  Solved: 126[Submit ...

  3. L3-011 直捣黄龙 (30 分)

    本题是一部战争大片 —— 你需要从己方大本营出发,一路攻城略地杀到敌方大本营.首先时间就是生命,所以你必须选择合适的路径,以最快的速度占领敌方大本营.当这样的路径不唯一时,要求选择可以沿途解放最多城镇 ...

  4. A*专题训练

    POJ2449 Remmarguts' Date UDF's capital consists of N stations. The hall is numbered S, while the sta ...

  5. 制作一个64M的U盘启动盘(mini linux + winpe +dos toolbox)

    制作一个64M的U盘启动盘(mini linux + winpe +dos toolbox) 自己动手定制winpe+各类dos工具箱U盘启动盘+minilinux 由于一个64M老U盘,没什么用,拿 ...

  6. Mysql中谓词使用date_format的优化

    优化前: SELECT a.* FROM t1 a, (SELECT obj_id,MAX(PRE_DETAIL_INST_ID) PRE_DETAIL_INST_ID FROM t1 WHERE D ...

  7. pthread中取消线程

    取消线程:告诉一个线程关掉自己,取消操作允许线程请求终止其所在进程中的任何其他线程.不希望或不需要对一组相关的线程执行进一步操作时,可以选择执行取消操作.取消线程的一个示例是异步生成取消条件. 对于c ...

  8. GNU Radio: Multiple USRP configurations 配置多个USRP设备

    Introduction 引言 Some USRP devices are capable of being grouped to form a single, virtual device. A s ...

  9. 【linux】linux文件属性权限的介绍

    众所周知,root的信息存在/etc/passwd下,个人密码存在/etc/shadow下,所有组名存在/etc/group下,因此这三个文件十分重要. 在linux系统下,我们可以通过"l ...

  10. java对图片的处理

    原文地址:http://www.blogjava.net/PrettyBoyCyb/archive/2006/11/13/80922.html java 中的图片处理是很让人头疼的一件事情.目前 ja ...