Saving Linux Program Output Into a File Rather Than Standard Output
When output is really long or if you need t o analyze or search through the output, we will often want to save the output string into a text file. Here’s the syntax:
[YOUR COMMAND] > yourFile.txt
Here are some examples:
ifconfig > ifconfigOutput.txt sudo ls -la /path/to/dir > lsOutput.txt
Then you can open the output with a text editor such as nano:
sudo nano ifconfigOutput.txt
Pro tip: to search for text content in a file with nano editor, press ctrl+w and type your search phrase when prompted and hit enter to jump to the next match