EDDYMENS

Last updated 2023-08-07 05:06:00

How To Save Command Line Outputs To A File

During web development, you will typically have a local server running. For example, in Laravel you will run $ php artisan serve to start an HTTP server.

With the server running, each time you load up a page you get an influx of logs within your terminal, thankfully all error and warning logs that show up within the terminal can also be found in the frameworks log file.

For some commands like wget by default only displays its logs within the terminal. Most of these logs are displayed in a fast-moving stream and are difficult to read. Even worse is the fact that most of the earlier logs can be lost if there are too many of them.

Solution

You can capture the output from command line tools and save them to a file to sieve through later.

$ wget -h > output.log

The > symbol after the wget command specifies that the output is to be written to the output.log file.

Here is another article you might like 😊 "Diary Of Insights: A Documentation Of My Discoveries"