数学之路-分布式计算-linux/unix技术基础(2)

让进程在后台运行,执行命令后立即返回,可以继续执行其它命令,在命令行最后加上“&”

bash-4.2$ find ~ -name doc &
[1] 5453
bash-4.2$ /home/myhaspl/hadoop-2.4.1/share/doc
/home/myhaspl/pypy-2.3.1-src/site-packages/numpy/doc
/home/myhaspl/pypy-2.3.1-src/ctypes_configure/doc
/home/myhaspl/pypy-2.3.1-src/pypy/doc
/home/myhaspl/numpy/doc
/home/myhaspl/numpy/build/lib.linux-x86_64-2.7/numpy/doc
/home/myhaspl/numpy/numpy/doc
/home/myhaspl/numpy/numpy/numpy/doc
/home/myhaspl/numpy/numpy/numpy/f2py/doc

重定向

下面命令查找文件,并将结果列表重定向到一个文件中

bash-4.2$ find ~ -name doc >mydoclist &
[1] 5461
bash-4.2$ ls
hadoop-2.4.1 hadoop-2.4.1.tar.gz  numpy
hadoop-2.4.1-src.tar.gz  mydoclist      pypy-2.3.1-src
[1]+  完成                  find ~ -name doc > mydoclist
bash-4.2$ cat mydoclist
/home/myhaspl/hadoop-2.4.1/share/doc
/home/myhaspl/pypy-2.3.1-src/site-packages/numpy/doc
/home/myhaspl/pypy-2.3.1-src/ctypes_configure/doc
/home/myhaspl/pypy-2.3.1-src/pypy/doc
/home/myhaspl/numpy/doc
/home/myhaspl/numpy/build/lib.linux-x86_64-2.7/numpy/doc
/home/myhaspl/numpy/numpy/doc
/home/myhaspl/numpy/numpy/numpy/doc
/home/myhaspl/numpy/numpy/numpy/f2py/doc
/home/myhaspl/numpy/numpy/build/lib.linux-x86_64-2.7/numpy/doc
bash-4.2$ 

重定向增加到一个文件中,使用">>"

bash-4.2$ find ~ -name hadoop >>mydoclist &
[1] 5466

bash-4.2$ cat mydoclist
/home/myhaspl/hadoop-2.4.1/share/doc
/home/myhaspl/pypy-2.3.1-src/site-packages/numpy/doc
/home/myhaspl/pypy-2.3.1-src/ctypes_configure/doc
/home/myhaspl/pypy-2.3.1-src/pypy/doc
/home/myhaspl/numpy/doc
/home/myhaspl/numpy/build/lib.linux-x86_64-2.7/numpy/doc
/home/myhaspl/numpy/numpy/doc
/home/myhaspl/numpy/numpy/numpy/doc
/home/myhaspl/numpy/numpy/numpy/f2py/doc
/home/myhaspl/numpy/numpy/build/lib.linux-x86_64-2.7/numpy/doc
/home/myhaspl/hadoop-2.4.1/bin/hadoop
/home/myhaspl/hadoop-2.4.1/etc/hadoop
/home/myhaspl/hadoop-2.4.1/share/hadoop
/home/myhaspl/hadoop-2.4.1/share/hadoop/httpfs/tomcat/webapps/webhdfs/WEB-INF/classes/org/apache/hadoop
/home/myhaspl/hadoop-2.4.1/share/hadoop/httpfs/tomcat/webapps/webhdfs/WEB-INF/classes/org/apache/hadoop/lib/service/hadoop
/home/myhaspl/hadoop-2.4.1/share/doc/hadoop
/home/myhaspl/hadoop-2.4.1/share/doc/hadoop/api/src-html/org/apache/hadoop
/home/myhaspl/hadoop-2.4.1/share/doc/hadoop/api/org/apache/hadoop
/home/myhaspl/hadoop-2.4.1/share/doc/hadoop/api/org/apache/hadoop/lib/service/hadoop
/home/myhaspl/hadoop-2.4.1/share/doc/hadoop/hadoop-hdfs-httpfs/apidocs/src-html/org/apache/hadoop
/home/myhaspl/hadoop-2.4.1/share/doc/hadoop/hadoop-hdfs-httpfs/apidocs/src-html/org/apache/hadoop/lib/service/hadoop
/home/myhaspl/hadoop-2.4.1/share/doc/hadoop/hadoop-hdfs-httpfs/apidocs/org/apache/hadoop
/home/myhaspl/hadoop-2.4.1/share/doc/hadoop/hadoop-hdfs-httpfs/apidocs/org/apache/hadoop/lib/service/hadoop


本博客所有内容是原创,如果转载请注明来源

http://blog.csdn.net/myhaspl/

使用管道“|",将第1个命令的输出变为第2个命令的输入。

bash-4.2$ find ~ -name hadoop|grep hdfs
/home/myhaspl/hadoop-2.4.1/share/hadoop/httpfs/tomcat/webapps/webhdfs/WEB-INF/classes/org/apache/hadoop
/home/myhaspl/hadoop-2.4.1/share/hadoop/httpfs/tomcat/webapps/webhdfs/WEB-INF/classes/org/apache/hadoop/lib/service/hadoop
/home/myhaspl/hadoop-2.4.1/share/doc/hadoop/hadoop-hdfs-httpfs/apidocs/src-html/org/apache/hadoop
/home/myhaspl/hadoop-2.4.1/share/doc/hadoop/hadoop-hdfs-httpfs/apidocs/src-html/org/apache/hadoop/lib/service/hadoop
/home/myhaspl/hadoop-2.4.1/share/doc/hadoop/hadoop-hdfs-httpfs/apidocs/org/apache/hadoop
/home/myhaspl/hadoop-2.4.1/share/doc/hadoop/hadoop-hdfs-httpfs/apidocs/org/apache/hadoop/lib/service/hadoop

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。