Important

Netgate is offering COVID-19 aid for pfSense software users, learn more.

Command Prompt

The command prompt, available at Diagnostics > Command Prompt, executes shell commands, PHP code, and can download or upload whole files.

Warning

Exercise caution using any of these utilities. Executing commands and PHP code improperly can render the firewall unusable. Use of this tool is not recommended except under the guidance of a support representative or if there is sufficient knowledge on the part of the user.

Execute Shell Commands

To execute a shell command:

  • Navigate to Diagnostics > Command Prompt

  • Enter the command into the Command box under Execute Shell command

  • Click Execute

Commands are executed as if they were run from a console command line, and the page prints the results when the command terminates.

Warning

Commands must run and then stop or return.

Commands that run indefinitely, such as ping without a count or tcpdump without a limit set will never stop or return output, and will be left running indefinitely in the background until they are manually killed.

Interactive commands, such as vi will fail similarly, or may exit due to other issues with the terminal being non-interactive.

Previously used commands from this session can be recalled with the fa-angle-double-left and fa-angle-double-right buttons. The browser will forget the previous command list once it leaves the page.

Download

To download a file from the firewall filesystem:

  • Navigate to Diagnostics > Command Prompt

  • Enter the full path name in File to download

  • Click fa-download Download

Upload

To upload a file:

  • Navigate to Diagnostics > Command Prompt

  • Click Browse

  • Locate and select the file on the local client computer

  • Click fa-upload Upload

Note

Uploaded files are placed in /tmp/ and can then be moved to alternate locations by other functions (such as the Execute Shell Command feature).

PHP Execute

This page can also execute PHP code.

  • Navigate to Diagnostics > Command Prompt

  • Type or paste PHP code into the Execute PHP Commands text area

  • Click Execute

The GUI displays the output from the PHP code above the text area, or an error if the it could not run the code.