From owner-freebsd-questions@freebsd.org Thu Oct 24 06:45:04 2019 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A6720160550 for ; Thu, 24 Oct 2019 06:45:04 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mout.kundenserver.de (mout.kundenserver.de [217.72.192.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.kundenserver.de", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zHmb3b2mz4Zqp for ; Thu, 24 Oct 2019 06:45:03 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from r56.edvax.de ([94.222.8.167]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPA (Nemesis) id 1Mo6zF-1hdn7E2JQp-00ph1b; Thu, 24 Oct 2019 08:44:55 +0200 Date: Thu, 24 Oct 2019 08:44:53 +0200 From: Polytropon To: "Clay Daniels Jr." Cc: Kurt Hackenberg , "freebsd-questions@freebsd.org" Subject: Re: How to pipe kldstat output to a file in console Message-Id: <20191024084453.d9ae9d70.freebsd@edvax.de> In-Reply-To: References: <94a6b756-27bf-0363-b6f2-c711c33ab2c2@panix.com> Reply-To: Polytropon Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:zDf7JYv1mfA+rjdE95jghB8zabASqdILct6inwxPwCN3TsE8JbX SlI30NUT5QgUKm7d2f4Gj1qaOPoJ0Nvivunbe0MWt/0Nyb7X130gWkWXbDNTIiIWtJ21CXy mSWNKdbxlZN/pKma6TpVcfK1/m/dBw1fVy2G4/mXysuMaVof04gJuI7XWPmrHsh78Qk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Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of freebsd@edvax.de has no SPF policy when checking 217.72.192.74) smtp.mailfrom=freebsd@edvax.de X-Spamd-Result: default: False [3.58 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; HAS_REPLYTO(0.00)[freebsd@edvax.de]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; HAS_ORG_HEADER(0.00)[]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:8560, ipnet:217.72.192.0/20, country:DE]; RCVD_TLS_LAST(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[167.8.222.94.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.05)[-0.045,0]; REPLYTO_EQ_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[edvax.de]; AUTH_NA(1.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_LONG(0.93)[0.925,0]; MID_CONTAINS_FROM(1.00)[]; RCVD_IN_DNSWL_NONE(0.00)[74.192.72.217.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; IP_SCORE(0.30)[ip: (-0.72), ipnet: 217.72.192.0/20(0.24), asn: 8560(1.98), country: DE(-0.01)] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 06:45:04 -0000 On Wed, 23 Oct 2019 21:00:07 -0500, Clay Daniels Jr. wrote: > Bingo! > > create /root/kldstat_file with vi > #kldstat -v > /root/kldstat_file > It's all there! There is no no need to create the file beforehand. The > redirection will do one of the following automatically: a) file not there ---> file will be created b) file there ---> file content will be overwritten So a command like # kldstat -v > /root/kldstat.txt will work no matter if the output file is already there or not. This is the shell's default behaviour. Sidenote: If you want to append to a file, use >> instead of >. Sidenote 2: The easiest way to create an (empty) file is to use the "touch" program, for example if you want to add the output of several commands to a file: # touch /root/stuff.txt # ls / >> /root/stuff.txt # kldstat -v >> /root/stuff.txt # dmesg >> /root/stuff.txt Sidenote 3: In case you want to record a whole terminal session, including commands and their outputs, use the "script" program: # script /root/session.txt . . . your commands here . . . # exit This is very convenient if you want to document the command _and_ their outputs. -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...