What does 2>&1 mean?

OCC物理实现手撕指南:时钟树、门控与签核实战 时钟控制器(OCC)是数字IC后端设计中兼具功能复杂性与物理敏感性的关键模块,其本质远超简单时钟缓冲器——它融合动态门控、多源无毛刺切换、低偏斜复位等硬性约束。理解OCC需从时钟树综合(CTS)原理切入,关注skew/jitter的物理成因、clock gating cell在leaf level布局的必要性,以及电源噪声对时序裕量的实际压缩。技术价值在于保障芯片在宽温域、多PVT场景下的启动可靠性与高负载稳定性;典型应用于汽车MCU、高性能SoC的功耗管理与测试诊断子系统。本文聚焦OCC在物理实现层的真实 阅读详情

In a unix shell, if I want to combine stderr and stdout into the stdout stream for further manipulation, I can append the following on the end of my command:

2>&1

So, if I want to use "head" on the output from g++, I can do something like this:

g++ lots_of_errors 2>&1 | head

so I can see only the first few errors.

I always have trouble remembering this, and I constantly have to go look it up, and it is mainly because I don't fully understand the syntax of this particular trick. Can someone break this up and explain character by character what "2>&1" means?

up vote 202 down vote accepted

1 is stdout. 2 is stderr.

Here is one way to remember this construct (altough it is not entirely accurate): at first, 2>1 may look like a good way to redirect stderr to stdout. However, it will actually be interpreted as "redirect stderr to a file named 1". & indicates that what follows is a file descriptor and not a filename. So the construct becomes: 2>&1.

share | improve this answer
 

The numbers refer to the file descriptors (fd). Zero is stdin, one is stdout, and two is stderr. "2>&1" redirects fd 2 to 1. This works for any number of file descriptors if the program uses them.

You can look at /usr/include/unistd.h if you forget them:

/* Standard file descriptors.  */
#define STDIN_FILENO    0   /* Standard input.  */
#define STDOUT_FILENO   1   /* Standard output.  */
#define STDERR_FILENO   2   /* Standard error output.  */

That said I have written C tools that use non-standard file descriptors for custom logging so you don't see it unless you redirect it to a file or something.

share | improve this answer
 
 


====

http://stackoverflow.com/questions/818255/in-the-bash-shell-what-is-21

----

Run command "man bash" , it said:

Redirecting Standard Output and Standard Error
       This construct allows both the standard output (file descriptor 1) and the standard error output  (file  descriptor
       2) to be redirected to the file whose name is the expansion of word.

       There are two formats for redirecting standard output and standard error:

              &>word
       and
              >&word

       Of the two forms, the first is preferred.  This is semantically equivalent to

              >word 2>&1

----
"Batch,Batch,Batch":What does it really mean? 记录阅读Nvidia文章《"Batch,Batch,Batch":What does it really mean?》的一些心得 阅读详情

相关推荐

What does enctype=‘multipart/form-data’ mean?

在进行 POST 请求时,需要对请求体中的数据进行编码。(默认值)、和text/plain。此外,曾有计划添加编码方式,但该计划已被放弃。

qq_29715355的博客 921

what does “ 2>&1 ” mean?

File descriptor 1 is the standard output (stdout). File descriptor 2 is the standard error (stderr). Here is one way to remember this construct (although it is not entirely accurate): at first, 2&...

liushuainudt的博客 198

对《What does it mean to understand language?》的深度研究

这篇由哈佛大学、麻省理工学院(MIT)及佐治亚理工学院的研究团队联合发表的论文《What does it mean to understand language?》提出了一个关于人类语言理解的颠覆性理论框架,其核心论点被称为 “出口假设”(Exportation Hypothesis) 。该假设认为,真正意义上的深度语言理解,并非仅仅发生在大脑的核心语言系统内部,而是需要将信息从该系统 “导出”(export)至其他具有特定功能的脑区进行进一步处理 。论文指出,语言理解远不止于对词汇和语法的表层解码,其本质

步子哥的博客 108

What does > /dev/null 2>&1 mean?

转自:https://www.xaprb.com/blog/2006/06/06/what-does-devnull-21-mean/

307

What does spaces.Discrete mean in OpenAI Gym

在OpenAI Gym的上下文中,spaces.Discrete是指什么

suiusoar 591

别再折腾Windows了!Ubuntu 22.04下USRP X310 + RFNoC + Vivado 2021.1开发环境保姆级搭建指南

本文提供Ubuntu 22.04下USRP X310 + RFNoC + Vivado 2021.1开发环境的详细搭建指南,涵盖系统优化、UHD驱动编译、Vivado配置及硬件验证等关键步骤,帮助射频工程师高效构建稳定的开发环境,显著提升FPGA开发效率。

weixin_29168675的博客 255

In the shell, what does “ 2>&1 ” mean?

In a Unix shell, if I want to combine stderr and stdout into the stdout stream for further manipulation, I can append the following on the end of my command: 2>&1 So, if I want to use "head" ...

weixin_33962621的博客 129

CMOS 半加器和全加器&&数字集成电路&& Cadence Virtuoso

数字集成电路——半加器和全加器

计科小学生的博客 1万+

What does '>/dev/null 2>&1' mean in this article of crontab basics

> is for redirect /dev/null is a black hole where any data sent, will be discarded 2 is the file descriptor for Standard Error > is for redirect & is the symbol for file descript

zxx2403的专栏 525

电池管理系统(BMS)技术全景解析:从基础原理到智能未来

《BMS技术演进与核心功能解析》摘要: 电池管理系统(BMS)作为新能源系统的智能中枢,已从基础保护电路发展为具备预测能力的智能系统。文章系统梳理了BMS三大技术时代:1.0保护时代(1990-2000)采用硬件保护电路;2.0智能时代(2000-2020)引入SOC算法;3.0云脑时代(2020后)实现AI预测。详细解析了BMS三大核心模块:AFE感知系统(±2mV精度)、功率驱动模块(10μs级保护)和均衡技术(效率提升至85%),并对比了主动/被动均衡技术差异。同时阐释了SOC/SOH等关键参数定义与

bother3000的博客 2984

5、卡尔ibration中Denavit - Hartenberg与Hayati约定的转换

本文详细介绍了机器人运动学中Denavit-Hartenberg(DH)参数与Hayati参数的定义、适用场景及其相互转换方法。重点分析了两种参数在描述关节坐标系变换时的差异,特别是在处理平行或接近平行关节轴时的稳定性问题,并给出了从DH到Hayati及反向转换的具体数学公式与流程图。通过参数转换,可在不改变运动学模型的前提下提升建模精度与计算鲁棒性,适用于机器人标定与运动学分析等应用场景。

h0i1j2k3l的博客 121

Shell中 2>&1理解

分享请标明来自: https://www.css3.io/in-the-shell-what-does-21-mean.html背景Shell脚本中经常看到有人这么写ls foo > /dev/null 2>&1快速理解i/o重定向我们使用cat命令,默认地将在屏幕看到如下输出$ cat foo.txt hello world 我们也可以用>符号将输出结果定向到另外的地方去,这就是i/o重定向$ c

我仅仅是一个Coder 578

工业相机通用SDK封装实战:C#硬件抽象层(HAL)实现多品牌无缝切换

本文介绍了一种解决工业相机SDK碎片化问题的通用解决方案。作者基于多年工业视觉项目经验,提出通过硬件抽象层(HAL)和适配器模式封装不同品牌相机的SDK差异,实现统一的相机操作接口。文章详细分析了传统直接对接SDK方式的四大痛点:接口碎片化、维护成本高、业务耦合度高和稳定性差,并给出了分层架构设计方案。该方案采用三层架构(业务层、抽象层、实现层),遵循最小接口原则和高内聚低耦合等设计理念,定义了包括触发模式、像素格式等通用枚举类型,以及图像数据结构等核心抽象。最终实现的HAL层能够支持多种品牌相机,显著降低

这里只有干货:从 Modbus 通信到 MES 对接,从 YOLO 训练到工控机部署,带你搞定工业软件开发全流程。 576

What does “ 2>&1 “ mean?

在Linux或Unix系统中,程序通常会将输出发送到两个地方:标准输出(stdout)和标准错误(stderr标准输出用于正常的程序输出,而标准错误则用于输出程序运行过程中产生的错误信息。文件描述符是一个非负整数,用于标识一个打开的文件,其中0代表标准输入(stdin),1代表标准输出(stdout),2代表标准错误(stderr2>&1是一种输出重定向的语法,用于将标准错误输出重定向到标准输出的当前位置。

qq_29715355的博客 464

SerDes系列之 SSC扩频时钟技术

扩频时钟,又称展频(SSC-Spread Spectrum Clocking),当前PCIE、DDR、USB等几乎所有的高速接口都支持SSC的功能。电子工程师在日常的电气测试中经常与之接触,在电磁传导和辐射发射验证过程中,经常需要使用到芯片的SSC功能,它的物理表现形式,就是信号的比特率会在一个很小的范围内浮动,多见于周期性变化的时钟信号。

一只豌豆象的博客 3441

MediaPipe 教程:从安装到应用-全网最全

MediaPipe是Google推出的开源框架,专为构建机器学习管道设计,可以高效处理视频、音频等时间序列数据。本文教程从安装到应用逐步讲解: 安装步骤简单,只需通过pip安装mediapipe包并验证版本; 重点演示人体姿态检测功能,可识别33个身体关键点; 提供基础代码实现,包括视频捕获、关键点检测与可视化; 强调模块化开发,将功能封装成类以提高代码复用性。 教程适合初学者,通过清晰指引和实用代码示例,帮助快速实现计算机视觉应用。

FJN110的博客 1563

What does shot mean?

前言 最近看了一些论文,反复提到一个词:shot。那么shot究竟指的是什么?通过查阅资料和思考后,进行一下总结。 Shot都在哪里出现? 首先,根据牛津词典,shot的一种解释是the act of firing a gun,或者 an attempt to score a goal or point in a game。shot在目前火热的各个领域都有出现: 少样本学习(few-shot l...

乘风破浪2014 1125

节省人力成本40%!仓储物流AI机器人调度系统实战案例(含路径规划算法与系统架构图)

首先,我们需要定义一个Node类self.x = x # 节点x坐标self.y = y # 节点y坐标self.g = g # 从起点到当前节点的实际成本(g值)self.h = h # 从当前节点到终点的启发式成本(h值)self.f = g + h # 总成本(f值)self.parent = None # 父节点(用于回溯路径)self.task_id = task_id # 任务IDself.priority = priority # 任务优先级(1=最高,5=最低)

小程序开发 949

What does GT/s mean, anyway?

原文链接:http://www.edn.com/electronics-news/4380071/What-does-GT-s-mean-anyway- 关于PCIe 速度等级GEN1,GEN2,GEN3...单位GT/s的说明。 When announcing version 2.0 of the PCI Express (PCIe) standard in January, the

fugui_apx的博客 535

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

What does floating point error -1.#J mean?

What does floating point error -1.#J mean? up vote 4 down vote favorite share [fb] share [tw] Recently, sometimes (rarely) when we export data from our application,

杨帆的博客 1060

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

What does Cxty in Jacoco report mean?

cxty ----- > complexity

Chenglin(Ben) Yu's Miracle 2327

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

what does (a href javascript) mean

例如: <a href="javascript:;" onclick="add()" class="layui-btn layui-btn-normal radius"> <i class="Hui-iconfont">&#xe600;</i> 添加 </a> 目的是防止页面跳转 分类 1、点击链接,页面默认上滚到页的顶...

qq_36665653的博客 248

What does N+1 redundancy mean?

http://searchservervirtualization.techtarget.com/answer/What-does-N1-redundancy-mean In data centers, N+1 redundancy is used to express the idea that a system should be designed to withstand the lo

597

What does the determinant of a matrix mean physically

Each  n×nn×n  matrix describes a linear transformation  T:Rn→Rn.T:Rn→Rn.  If you take a figure S⊆Rn,S⊆Rn,  then that transformation maps it to its image, another figure T(S)⊆Rn.T(S)⊆Rn.    In the case...

#+! 544

In vmstat output, what does blocked process mean ( b = 1 ) ?

https://access.redhat.com/solutions/792683 SOLUTION UNVERIFIED- 已更新2014年八月11日10:28- English 环境 Red Hat Enterprise Linux 问题 Invmstatoutput analysis - In the "b" column, there is often a bl...

msdnchina的专栏@JiNan,ShanDong 261
上一篇: Ubuntu中安装tftp/tftp-hpa服务的方法
下一篇: etc/ld.so.conf的使用说明
Alan0521
博客等级 码龄19年 77粉丝 6原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值