I am a command line junkie as it helps me stay productive and move around faster than using a mouse. I try and use the keyboard quite often and familiarize myself with shortcuts that help me save time doing things. Since I began using Linux around 6 years ago I have always tried and made use of its rich set up commands.
This post is about how you can use Linux commands to easily install and update plugins without making use of a visual uploading software like Filezilla or WinSCP.
Since I began using WordPress I have been regularly using themes and plugins. To install a plugin or theme you have to follow certain steps
- Download the plugin from the author’s site.
- If it is a zip file unzip it to our local directory.
- Upload the files to the web server in plugins directory.
- Activate the plugin using wordpress.
This is a normal process and though it is not flawed you can cut on some time using shell. You can cut down this process to 2-3 steps and not have to use a GUI to upload your files to your server
- Download the file on the server.
- If it is a zip file then unzip it.
- Activate the plugin.
You will require a SSH client to perform the steps. You can either use the famous Putty or Poderosa which I use, you even use Cygwin to do that (I will do a more in depth Cygwin tutorial in coming days). You can read more about why I like to use Poderosa here.
You will also have to have SSH (Secure Shell) access to your server. Most hosting service provide you with one, you may need to activate it using your hosting control panel though.
Once you have downloaded your SSH client you will have to create a connection with your server using the client below are screen shots of how you can do that using either Putty or Poderosa.
To create a new connection with Poderosa select File -> New Telnet/SSH Connection and enter the details of your server in the fields and click on Ok. It will create a Secure Shell connection with your server.
To create a new connection using Putty; double click on the application icon you will get a new screen where you have to enter the server and select the SSH check box. After you have done that click on Open, it should open upon another screen where you will be asked for your username and password to get access to your server.
Once you have successfully logged into the server you will be shown a welcome message and a command prompt where you can start typing in your commands.
The first thing you will require is a link to the plugin. You can get that by right clicking on the link for the plugin download and copy link location. Once you have the link get back to the terminal and navigate to the plugin or theme directory
To do that you may have to key in the following command;
Once you are in the plugins directory to download the file to your server run the following command;
Wget is a non-interactive network downloader to download files and webpages to Linux machines using command line. Running the above command will download the file to your plugins directory. Once the file has been downloaded you need to run the unzip command to unzip the files. Depending on the archive type run the following command.
For zip files:
For tar.gz files:
tar -xvf someplugin.tar.gz
Running either of the commands will decompress the files to the folder. The tar command has additional parameters xvf passed to it.
Here x tells the command to extract the files, v is short form for verbose which means show output on console and f means archive.
That’s it once you have done that you simply need to go to your wordpress plugin page and activate the plugin to use it.You can also backup the zip file you downloaded to a different folder using the following command;
mv someplugin.zip ~/mypugsbackup
I have created the mypugsbackup folder in the home directory for my user so the absolute folder path is something like this /home/username/mypugsbackup but using instead of typing in the entire path I am using ‘~’ which points to the home directory /home/username and saves me few words to type.
There are few more posts I have planned which will help you to easily upload your changes to your server in windows without using a FTP client.
Do let me know if you use any different way to install your plugin and as always you are free to contact me with your doubts and I would be glad to help you out with that.