From owner-freebsd-questions@FreeBSD.ORG Fri Dec 21 14:58:00 2007 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 74E1716A417 for ; Fri, 21 Dec 2007 14:58:00 +0000 (UTC) (envelope-from girishvenkatachalam@gmail.com) Received: from nz-out-0506.google.com (nz-out-0506.google.com [64.233.162.224]) by mx1.freebsd.org (Postfix) with ESMTP id 1B04F13C4D9 for ; Fri, 21 Dec 2007 14:57:59 +0000 (UTC) (envelope-from girishvenkatachalam@gmail.com) Received: by nz-out-0506.google.com with SMTP id l8so162961nzf.13 for ; Fri, 21 Dec 2007 06:57:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:received:date:from:to:subject:message-id:reply-to:mail-followup-to:references:mime-version:content-type:content-disposition:in-reply-to:user-agent; bh=8LOzj6dDrLpbxCjvA3P20Y/LdcoV8K0rPKBAlLU1ZVg=; b=vyqybD1dwF9riFaw5m4ubXsmDZIlegUSJh9kooQjexAyiSne5R9A31g76cXmJXYNMlCAR1TFxqQgeDMitrCBB4nU6GRSyfHTVwZnIJiw3cCiB7k+zwaS2tIndBB4uFVCwhjNnyNqAFIBcoymMC8GRjuQAtFhH6cyQ1OjccxhPok= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:subject:message-id:reply-to:mail-followup-to:references:mime-version:content-type:content-disposition:in-reply-to:user-agent; b=J6G94ht+uuTqg4TQh9GP1kKoYvXm2xYn11STQ/s9gN7NGg69xM2njSzcRZJK5SP5cuT4SH0JbV1FoU51jAoM6U17ltqnMXfzyLnLdtzeCDlTUfkKJDuYaBODTE0nNTGJKelxJHjxp9DFeOi9aHTXbYS/H6sxaIdpmX9gcdEeKAA= Received: by 10.141.22.1 with SMTP id z1mr773502rvi.282.1198249078929; Fri, 21 Dec 2007 06:57:58 -0800 (PST) Received: from brahma.susmita.org ( [59.92.25.77]) by mx.google.com with ESMTPS id k2sm853970rvb.36.2007.12.21.06.57.57 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 21 Dec 2007 06:57:58 -0800 (PST) Received: by brahma.susmita.org (Postfix, from userid 1002) id CB62FCCE5; Fri, 21 Dec 2007 20:27:53 +0530 (IST) Date: Fri, 21 Dec 2007 20:27:53 +0530 From: Girish Venkatachalam To: freebsd-questions@freebsd.org Message-ID: <20071221145753.GA8883@brahma.susmita.org> Mail-Followup-To: freebsd-questions@freebsd.org References: <51935.12.170.206.13.1198248568.squirrel@admintool.trueband.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <51935.12.170.206.13.1198248568.squirrel@admintool.trueband.net> User-Agent: Mutt/1.5.17 (2007-11-01) Subject: Re: Redirecting STDOUT X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: girishvenkatachalam@gmail.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2007 14:58:00 -0000 On 14:49:28 Dec 21, jhall@vandaliamo.net wrote: > I am in the process of debugging a script and I would like to have the > output of stdout redirected to a file. > > After reading about redirection on the Internet, I was under the > impression the following would redirect stdout to a file, but I cannot > seem to get it to work. > > tar -cvzf root.tgz /root > /dev/null 2>/home/jay/tarlog > > I'm sure it is something simple I am doing wrong, but I am not seeing it. Yes. Very simple indeed. This is highly shell dependent but on ksh, this command works. $ tar zcvf root.tgz /root >/home/jay/tarlog 2>/dev/null The above command will redirect stderr (fdes 2) to the bit bucket and stdout to /home/jay/tarlog. If you wish to redirect both stderr and stdout to a single file, you can try this command. $ tar zcvf root.tgz /root >/home/jay/tarlog 2>&1 -Girish