Have a Bash With This Linux Shell - page 2
Directing command output into a file is very useful. Some operations generate a lot of output; saving it in a file lets you study it at leisure. This command creates a new file, or replaces the contents of an existing file:
ls -al ~ > homefiles.txt
This creates a new file, or appends to the end of an existing file:
ls -al ~ >> homefiles.txtThis is a fast way to append lines to an existing file:
cat >> homefiles.txt testing, testing, new line
Hit CTRL + D to finish.
I like piping the output of make to a file, so I know what files were installed, and where. And to review any error messages. In this example, I'm installing JOE, Joe's Own Editor:
make install | tee joe-makeinstall.txt
The tee command is one of those odd little specialized Unix commands that come in handy at the strangest times. It both displays the command output on the screen, and stores it in a file. Use tee -a to append, instead of overwrite.
You doubtless noticed how most of the pieces of the above examples are not Bash features at all. The only Bash bits are:
cat < file1 > file2This works great when you're feeding a list, or other data in a file, to a script:
scriptname < filelist > outputfile.txt
Solid state disks (SSDs) made a splash in consumer technology, and now the technology has its eyes on the enterprise storage market. Download this eBook to see what SSDs can do for your infrastructure and review the pros and cons of this potentially game-changing storage technology.