How to pipe kldstat output to a file in console

Thomas Mueller mueller6722 at twc.com
Thu Oct 24 02:48:03 UTC 2019


On 2019-10-23 20:54, Clay Daniels Jr. wrote:

> I can run kldstat in the console, but I need to save the output. I can't
> get to graphical xorg, just the console at command line. From the file, I
> can send that to a usb thumb drive and email the file, no problem, but
> getting it from the screen to a file is my problem. Surely there's a way?
        
> Shell redirect? For example:

Kurt Hackenberg responded:
        
> kldstat >/thumbdrive/foo
        
> There's also:

> kldstat | Mail clay.daniels.jr at gmail.com

My favorite way is, shell redirect csh or tcsh

kldstat |& tee outputfile.txt

You can use any file name and path you like in place of outputfile.txt .

For ksh, sh, bash:

kldstat 2>&1 | tee outputfile.txt

This way includes any error messages that might occur.

Tom



More information about the freebsd-questions mailing list