How do you save the Terminal output to a file in vscode?

While VSCode does not have a built-in feature to save terminal outputs to a file, you can copy and paste the content into a file. If you are not getting the context menu by right-clicking, I am providing the steps to enable it. Once you have configured this, you can save the VSCode terminal output.

Terminal settings, enable context menu as the default behaviour

  • You can do this by going to the settings page: Configure Terminal Settings:
    • Go to the File menu
    • Preferences – Settings
    • Then enter: @feature:terminal
  • Scroll down to Right click behaviour, as shown in the below image
  • Select, Show the context menu as the default behaviour
  • After you enable this, you will be able to:
    • Right-click on your terminal
    • Select All Text
    • Right-click on the selection and click Copy ( or Ctrl +C to copy)
    • Paste the contents in a text editor (Ctrl + V), such as Notepad.
Demo: vscode save terminal output to file

We have tested this working in vscode on Windows 11. The same steps should work in other Windows/VScode combinations as well.

Conclusion

While VSCode does not have a built-in facility for saving terminal outputs to a file, you can copy and paste the text into a file. I have demonstrated enabling the context menu by right-clicking if you can’t find it. After setting this up, you can save the output from the VSCode terminal.

Related Articles: