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. 修改myeclipse的jsp模板

    在myeclipse的安装目录下: C:\Users\Seeker\AppData\Local\MyEclipse Professional\plugins 找到com.genuitec.eclips ...

  2. error:LNK2005 已经在*.obj中定义

    为什么会出现这个错误??“error LNK2005: 已经在*.obj中定义”  编程中经常能遇到LNK2005错误——重复定义错误,其实LNK2005错误并不是一个很难解决的错误,弄清楚它形成的原 ...

  3. linux 删除某种规则命名的文件

    由于android开发需要删除以IMG_开头命名的图片文件,因此用到此命令 命令格式: rm IMG_*

  4. ubuntu 安装git

    问题描述:         ubuntu安装git 问题解决:     (1)ubuntu下载git 注:           使用命令apt-get install git安装     (2)查看g ...

  5. WinForm员工信息表

    先搞一个panel,然后里面放label.

  6. SQLServer 触发器 同时插入多条记录有关问题

    由于 SQL Server 的触发器, 没有 FOR EACH ROW (ORACL中有)的选项, 有时候不正确的使用 inserted 与deleted 可能会有点麻烦. 下面来一个简单的例子 -- ...

  7. Unity3D脚本中文系列教程(十七)

    http://dong2008hong.blog.163.com/blog/static/469688272014032332976/ ◆ Static function PrefixLabel(to ...

  8. Java垃圾收集器

    概述 说起垃圾收集(Garbage Collection,GC),大部分人都把这项技术当做Java语言的伴生产物.事实上,GC的历史远远比Java久远,1960年诞生于MIT的Lisp是第一门真正使用 ...

  9. 2014多校第一场 I 题 || HDU 4869 Turn the pokers(费马小定理+快速幂模)

    题目链接 题意 : m张牌,可以翻n次,每次翻xi张牌,问最后能得到多少种形态. 思路 :0定义为反面,1定义为正面,(一开始都是反), 对于每次翻牌操作,我们定义两个边界lb,rb,代表每次中1最少 ...

  10. POJ2513Colored Sticks

    http://poj.org/problem?id=2513 题意 : 一些木棒,两端都涂上颜色,求是否能将木棒首尾相接,连成一条直线,要求不同木棒相接的一边必须是相同颜色的. 思路 : 这个题的话就 ...