To save results to a file in a Linux terminal, you can use output redirection. Here’s how you can do it:
-
Using
>to overwrite a file:command > filename.txtThis will run
commandand save the output tofilename.txt, overwriting it if it already exists. -
Using
>>to append to a file:command >> filename.txtThis will run
commandand append the output tofilename.txtwithout overwriting existing content.
Example:
If you want to save the output of an nmap scan to a file:
nmap localhost > nmap_scan.txt
This command will save the scan results to nmap_scan.txt. You can then view the contents of the file using:
cat nmap_scan.txt
Let me know if you need further assistance!
