How to Display Linux Commands in WordPress

Most of us use WordPress as it is easy to use and freely available to the public. Having said that, you can enhance the functionality of your WordPress page a lot by customizing it with various extensions.

One of the most useful extensions for WordPress is the Command plugin. The plugin allows you to execute various Linux commands on the server hosting your blog. You can use this extension to take advantage of all the server resources available to you.

In this article, we’ll discuss how to display Linux commands in your WordPress page so that your visitors can see what command you are using to manage your server.

Install And Configure The Command Plugin

The first step to getting command execution in your WordPress page is to install and configure the Command plugin. You can download it from the WordPress repository or install it manually from the plugin directory.

Once you have installed the plugin, you will need to click the “Activate” button to make it active. Doing this will make the commands available to you in the WordPress admin area.

Now, you need to open up the WordPress admin area and navigate to the plugins directory. From here, you can deactivate or uninstall the plugin if you no longer need it. You should also configure your server to allow the execution of external commands if you are going to use this functionality.

When you are done configuring the Command plugin, you can click the “Save” button to lock in your settings.

Enable The Execute Commands From Plugin Button

The second step in getting command execution in your WordPress page is to enable the plugin’s “Execute Commands From Plugin” button. To do this, navigate to the WordPress admin area and click the “Plugins” tab.

Enabling this button will make a green checkmark appear next to the Command plugin. Once you have clicked on this button, you can click the “Save” button to save your settings.

Configure The Executed Commands

After you have installed the Command extension and enabled the “Execute commands from Plugin” button, you can configure which commands to execute. This is done by navigating to the WordPress admin area and clicking the “Settings” tab. You can see an example of a configured command in the image below.

To add a command, click the “+” button next to the “Remote Commands” section. You will then see a popup similar to the one below with all the command options available to you. Simply type in the command you would like to use and then click the “Add Command” button to add it.

You can also search for existing commands using the “search field” at the top of the page.

Once you have added the command, you can test it by clicking the “Execute” button next to it. If all the parameters for your command are correct, you will see the output at the bottom of the browser window.

Use The Commands To Execute Serverside Scripts

The last step in getting Linux command execution in your WordPress page is to use the commands to execute serverside scripts or programs. To do this, you must have a Linux server available to you. Then, on your WordPress page, you can use the SSH command to log into your server. Doing this will give you direct access to the command line.

When you are logged in, you can use whatever text editor you want to edit the script or program. To show you an example, let’s say you have a script called “update-website.sh” saved on your server. You can execute this script using the following command:

<!--?php
	$output = shell_exec("/path/to/update-website.sh");
	echo $output;
?>

If you are not familiar with serverside scripting, this may seem like a lot of steps to take just to execute a single command. However, if you use this technique, you can access many different commands and have full control over your server.

WordPress is a free and open-source software, which is widely used by bloggers, website owners and others to run their digital businesses. Now that you know how to use the Command plugin in WordPress to execute Linux commands, you can take advantage of all the server resources available to you.