From owner-freebsd-questions@FreeBSD.ORG Sun Oct 11 22:46:17 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E460106566B for ; Sun, 11 Oct 2009 22:46:17 +0000 (UTC) (envelope-from freebsd@optimis.net) Received: from mail.optimis.net (mail.optimis.net [69.104.191.124]) by mx1.freebsd.org (Postfix) with ESMTP id E75088FC15 for ; Sun, 11 Oct 2009 22:46:16 +0000 (UTC) Received: from marvin.optimis.net (marvin.optimis.net [192.168.1.3]) by mail.optimis.net (8.14.3/8.14.2) with ESMTP id n9BMkG2V054393 for ; Sun, 11 Oct 2009 15:46:16 -0700 (PDT) (envelope-from freebsd@optimis.net) Received: from marvin.optimis.net (localhost [127.0.0.1]) by marvin.optimis.net (8.14.3/8.14.3) with ESMTP id n9BMkGML076570 for ; Sun, 11 Oct 2009 15:46:16 -0700 (PDT) (envelope-from freebsd@optimis.net) Received: (from george@localhost) by marvin.optimis.net (8.14.3/8.14.3/Submit) id n9BMkGck076569 for freebsd-questions@freebsd.org; Sun, 11 Oct 2009 15:46:16 -0700 (PDT) (envelope-from freebsd@optimis.net) Date: Sun, 11 Oct 2009 15:46:16 -0700 From: George Davidovich To: freebsd-questions@freebsd.org Message-ID: <20091011224616.GA75228@marvin.optimis.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.19 (2009-01-05) Subject: Re: error output redirection X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Oct 2009 22:46:17 -0000 On Sun, Oct 11, 2009 at 11:36:52PM +0200, Stefan Miklosovic wrote: > if error output of some program appear on screen, it is possible to > print it also to some file simultaneously? Depends on the program, but generally, yes. http://en.wikipedia.org/wiki/Standard_streams http://en.wikipedia.org/wiki/Redirection_(computing) > e.g if I "cat" file which do not exist, error is on screen, I want to > add that error to some file (errors.txt) Replacing 'cat file_that_does_not_exist' with 'badcommand' # redirect STDERR to a file badcommand 2> errors.txt # append STDERR to a file badcommand 2>> errors.txt # fun with file descriptors to have it both ways badcommand 3>&1 1>&2 2>&3 | tee errors.txt -- George