Simply with output redirection:

system_profiler > file.txt

Basically, this will take the output of system_profiler and save it to the file file.txt. There are technically two different output "streams", standard output, and standard error. They are treated separately, and if you use the simple redirection method above, you will only redirect standard output to the file. If you want to redirect both standard output and standard error, you could do this:

system_profiler &> file.txt

The & tells the shell to redirect the standard output and standard error to the file.

If you want to just output standard error, you can do this:

system_profiler 2> file.txt

The 2 lets the shell know that it needs to only redirect standard error.

Using the > will overwrite the file if it's already there. If you want to append it to a file without erasing the old one, you can use >>, like so:

system_profiler >> file.txt

You can of course use the & and 2 for sending both standard out and standard error, and just standard error with the >> operator.

Save output to a text file from Mac terminal的更多相关文章

  1. create feature from text file

    '''---------------------------------------------------------------------------------- Tool Name: Cre ...

  2. The 12th tip of DB Query Analyzer, powerful in text file process

    MA Gen feng ( Guangdong Unitoll Services incorporated, Guangzhou 510300) Abstract   It's very powerf ...

  3. New text file line delimiter

    Window -> Preferences -> General -> Workspace : Text file encoding :Default : 选择此项将设定文件为系统默 ...

  4. [转]Loading, Editing, and Saving a Text File in HTML5 Using Javascript

    本文转自:http://thiscouldbebetter.wordpress.com/2012/12/18/loading-editing-and-saving-a-text-file-in-htm ...

  5. How to remove duplicate lines in a large text file?

    How would you remove duplicate lines from a file that is  much too large to fit in memory? The dupli ...

  6. shell脚本执行时报"bad interpreter: Text file busy"的解决方法

    在执行一个shell脚本时,遇到了“-bash: ./killSession.sh: /bin/bash: bad interpreter: Text file busy”错误提示,如下所示: [or ...

  7. eclipse的使用-------Text File Encoding没有GBK选项的设置

    eclipse的使用-------Text File Encoding没有GBK选项的设置 2013-12-25 09:48:06 标签:java myeclipse使用 有一个项目是使用GBK编码的 ...

  8. Writing Text File From A Tabular Block In Oracle Forms

    The example given below for writing text file or CSV using Text_IO package from a tabular block in O ...

  9. 【转】shell脚本执行时报"bad interpreter: Text file busy"的解决方法

    1)问题现象: 在ubuntu下执行以下脚本( while_count),报错: -bash: ./while_count: /bin/bash: bad interpreter: Text file ...

随机推荐

  1. Hello BaiduMap

    百度提供了地图的API,可以在android手机上用,这里其实只要参考百度给的文档就好了.因为api不断在更新,所以网上的博客感觉还是不太好,直接看官网的文档比较靠谱 这里照着百度文档上面提供的文档我 ...

  2. bnuoj 4209 Triangle(计算几何)

    http://www.bnuoj.com/bnuoj/problem_show.php?pid=4209 题意:如题 题解:公式直接计算,或者角平分线求交点 [code1]: #include < ...

  3. Careercup - Facebook面试题 - 4909367207919616

    2014-05-01 01:23 题目链接 原题: WAP to modify the array such that arr[I] = arr[arr[I]]. Do this in place i ...

  4. Luence简单实现1

    初步认识Luence,简单按照官方文档做了个例子,大牛绕开,仅供小白路过参考.如有错误,欢迎指正批评. 建一个简单工程,并且加入这几个小奶瓶,如下图: 注:版本不同,可能对jdk的需求是不同的,这个需 ...

  5. SUID ,SGID ,Sticky

    SUID passwd:s SUID: 运行某程序时,相应进程的属主是程序文件自身的属主,而不是启动者: chmod u+s FILE chmod u-s FILE 如果FILE本身原来就有执行权限, ...

  6. ORA-01031:insufficient privileges

    描述:oracle11g用scott用户在plsql上以sysdba身份登录显示以上错误,可是在cmd面板中却正常,网上各种找答案不没有对症,最后这位网友的回答解决了我的问题. 原帖网址:http:/ ...

  7. (转)CentOS5.5 下搭建 PHP 环境(最佳的LAMP环境)

    本文详细阐述在 Linux 系统中搭建 PHP 环境,由于 PHP 就是由 C 语言编写的,最初也是运行在 Linux 系统中,所以Linux 是 PHP 的最佳环境. 关于本文中使用到的软件,请点击 ...

  8. PHP输出中文乱码的问题

    用echo输出的中文显示成乱码, 其实应该是各种服务器脚本都会遇到这个问题, 根本还是编码问题, 一般来说出于编码兼容考虑大多的页面都将页面字符集定义为utf-8 <meta http-equi ...

  9. MethodInvoker 委托

    MethodInvoker 提供一个简单委托,该委托用于调用含 void 参数列表的方法. 在对控件的 Invoke 方法进行调用时或需要一个简单委托又不想自己定义时可以使用该委托. 下面的代码示例演 ...

  10. poj 2253 Frogger (最短路变种,连通图的最长边)

    题目 这里的dijsktra的变种代码是我看着自己打的,终于把代码和做法思路联系上了,也就是理解了算法——看来手跟着画一遍真的有助于理解. #define _CRT_SECURE_NO_WARNING ...