{"id":9521,"date":"2020-05-29T11:43:30","date_gmt":"2020-05-29T11:43:30","guid":{"rendered":"https:\/\/www.milesweb.in\/hosting-faqs\/?p=9521"},"modified":"2020-05-29T11:43:30","modified_gmt":"2020-05-29T11:43:30","slug":"ssh-commands-for-wordpress","status":"publish","type":"post","link":"https:\/\/www.milesweb.in\/hosting-faqs\/ssh-commands-for-wordpress\/","title":{"rendered":"Popular SSH Commands for WordPress Users"},"content":{"rendered":"<p>When you use SSH with WordPress, it can be one of the most secure and convenient methods of accessing your website.<\/p>\n<p>SSH is a protocol that helps to access the files on your site which means \u2018Secure Shell\u2019. You can use it to access your site from wherever you are if you have your login credentials but make sure you are doing this securely.<\/p>\n<p>This post will help you learn about some of the most useful SSH commands to use with WordPress.<\/p>\n<p>Let\u2019s get started!<\/p>\n<h3>What Is SSH?<\/h3>\n<p>SSH, also called as \u2018Secure Shell\u2019, is a protocol that can be used to access files and directories on a remote server.<\/p>\n<p>You can use either the Terminal (on macOS or Linux) or a client such as PuTTY (on Windows) for accessing your site over SSH instead of using your browser.<\/p>\n<h3>How to Use SSH with WordPress?<\/h3>\n<p>An SSH will enable the access to the WordPress files themselves along with any files that have been added to the wp-content directory, either via the admin screens or directly.<\/p>\n<p>You will be using it in mostly the wp-content directory and sometimes in the root directory to access the files such as wp-config.php.<\/p>\n<p>For working with your site with SSH, open the Terminal or a client like PuTTY and access the server. You will need to insert the below information for this:<\/p>\n<ul>\n<li>Server address.<\/li>\n<li>Username.<\/li>\n<li>Password.<\/li>\n<li>Port.<\/li>\n<\/ul>\n<h3>What is PuTTY and How to Use It?<\/h3>\n<p>In MacOS or Linux, there is already an interface required to access your WordPress site via SSH. So, simply use the built-in Terminal to use SSH.<\/p>\n<p>But in terms of Windows, it is needed to install a client for using SSH.<\/p>\n<p>PuTTY is the most popular SSH client. Prior to accessing your site from Windows, you need to download and install it. Then use the same SSH commands in PuTTY as you used in Terminal.<\/p>\n<p>How Can I Automate SSH Commands with WordPress?<\/p>\n<p>When you use SSH to access your WordPress site, you can automate commands that you use frequently.<\/p>\n<p>Use WP-CLI or the WordPress command-line interface to do this. With this interface, you can get an access to a library of commands specifically related to WordPress that can be used over and above those offered by SSH.<\/p>\n<p>WP-CLI helps to automate WordPress management tasks such as installing plugins, updating your WordPress installation and configuring remote servers. The command line helps in enhancing the speed of the process and can help you become an highly efficient developer.<\/p>\n<h3>Benefits of Using SSH with WordPress<\/h3>\n<p>When you use SSH with WordPress, you get a number of benefits:<\/p>\n<p><strong>Security:<\/strong> It is possible to access your server remotely from any location until you are doing this on secure interface.<\/p>\n<p><strong>Convenience:<\/strong> You can access the server from anywhere you happen to be. There is no need of accessing the WordPress admin screens or even having a web browser running.<\/p>\n<p><strong>Speed:<\/strong> SSH commands can be much fast as compared to the WordPress admin screen or using SFTP to access files in many cases.<\/p>\n<p>Since you now know about SSH is and the way it works with WordPress, check the most popular SSH commands that can be used with WordPress.<\/p>\n<h2>26 SSH Commands to Use with WordPress<\/h2>\n<p>The SSH protocol comes with a wide range of commands. Check below the list of the most commonly used commands divided into categories for convenience.<\/p>\n<ul>\n<li>Directory Commands<\/li>\n<li>File or Directory Commands<\/li>\n<li>File Commands<\/li>\n<li>Terminal Commands<\/li>\n<li>Other Useful Commands When Working via SSH<\/li>\n<\/ul>\n<h3>Directory Commands<\/h3>\n<p>You will find a range of SSH commands that can be used for working with or manipulating the directories (or folders) in your WordPress site.<\/p>\n<p><strong>pwd \u2013 Displays Current Directory (Full Path to Your Current Location)<\/strong><\/p>\n<p>With the <strong>pwd<\/strong> command, the full path will be displayed that displays your current location in your server. When you type this while accessing your site for the first time, it\u2019ll tell help you know which server you are on.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9523\" src=\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/pwd-min.png\" alt=\"\" width=\"241\" height=\"35\" \/><\/p>\n<p>This command will help to move further into your folders, and you will see extra information about your exact location. With this you can check your location, because there is no visual representation that you would get while using a code editor or FTP client.<\/p>\n<p><strong>ls \u2013 Displays Directory Contents (List the File Names)<\/strong><\/p>\n<p>With the ls command, the contents of the current directory will get displayed.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-9545 size-full\" src=\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/ls-a-min.png\" alt=\"\" width=\"936\" height=\"87\" srcset=\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/ls-a-min.png 936w, https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/ls-a-min-300x28.png 300w, https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/ls-a-min-768x71.png 768w\" sizes=\"auto, (max-width: 936px) 100vw, 936px\" \/><\/p>\n<p>It is possible to use additional parameters for customizing or adding the information that the <strong>ls<\/strong> command returns:<\/p>\n<ul>\n<li>ls \u2013a: showcases the hidden files.<\/li>\n<li>ls \u2013l: displays the file details for directory contents, for example, ownership, permissions, date, etc.<\/li>\n<li>ls \u2013s: shows the listing of files\u2019 sizes in blocks.<\/li>\n<li>ls -s \u2013h: displays the size in a form that humans can read.<\/li>\n<\/ul>\n<p>Ensure that you type a space between the command and any parameters.<\/p>\n<p><strong>cd \u2013 Changes Directory<\/strong><\/p>\n<p>With the <strong>cd<\/strong> command, you will be able to move to next directory. It is possible to move into subdirectories of the current directory or move up or across with the correct parameters.<\/p>\n<p>The command below will take you from the root directory of your server to the public directory:<\/p>\n<pre class=\"lang:default decode:true \">cd public<\/pre>\n<p>For moving up the directory tree or going back where you came from, using one of these parameters:<\/p>\n<ul>\n<li>cd .. it takes you to the directory immediately above your current location.<\/li>\n<li>cd ..\/ the foldername will move you sideways into another folder within the folder right above you.<\/li>\n<li>cd \u2013 takes you to the previous directory.<\/li>\n<li>cd \/ takes you to the root directory.<\/li>\n<\/ul>\n<p>The below screenshot displays that you have been moved into the styles directory and listed out its contents. In case you have an experience with the contents of a WordPress installation, it will further look familiar to you:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9525\" src=\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/cd-styles-min.png\" alt=\"\" width=\"312\" height=\"106\" srcset=\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/cd-styles-min.png 312w, https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/cd-styles-min-300x102.png 300w\" sizes=\"auto, (max-width: 312px) 100vw, 312px\" \/><br \/>\n<strong>mkdir \u2013 Creates a New Directory<\/strong><\/p>\n<p>Using the <strong>mkdir<\/strong> command, it is possible to create a new directory in the current directory.<\/p>\n<p>So, in case you are inside the plugin\u2019s folder and you want to add a directory for stylesheet, you can use the below command:<\/p>\n<pre class=\"lang:default decode:true \">mkdir styles<\/pre>\n<p>With this, a new empty directory to the folder will get added to the folder that you are currently in. For adding a directory to a folder lower down in the structure, you type in the structure. So, you can type the below command from the wp-content folder:<\/p>\n<pre class=\"lang:default decode:true \">mkdir \/plugins\/myplugin\/styles<\/pre>\n<p><strong>rmdir \u2013 Removes Directory<\/strong><\/p>\n<p>With the <strong>rmdir<\/strong> command, a directory on your server will get deleted. Ensure that you take care while using this as it isn\u2019t possible to undo it!<\/p>\n<p><strong>rmdir<\/strong> can be used with <strong>mkdir<\/strong> for removing a directory in your current location:<\/p>\n<pre class=\"lang:default decode:true \">rmdir styles<\/pre>\n<p>Using <strong>rmdir<\/strong> you can remove a folder further down in the structure:<\/p>\n<pre class=\"lang:default decode:true \">rmdir \/plugins\/myplugin\/styles<\/pre>\n<p>Even rm can be used to remove directories, in case you add additional parameters.<\/p>\n<ul>\n<li>rm * foldername \u2013 delete all the files or content in a directory.<\/li>\n<li>rm -r foldername \u2013 delete the folder as well as the folders inside it.<\/li>\n<\/ul>\n<h3>File or Directory Commands<\/h3>\n<p>You can use the below command with either files or folders\/directories.<\/p>\n<p><strong>cp \u2013 Copy File or Folder<\/strong><\/p>\n<p>Use the <strong>cp<\/strong> command with both files and folders for copying them to another location. You\u2019ll need to mention the location of the file or folder to be copied to.<\/p>\n<pre class=\"lang:default decode:true \">cp filename.extension \/dir\/<\/pre>\n<p>With this, the name of the file to be copied (including its extension) and the location it will be copied to will get specified.<\/p>\n<p>For renaming the file (i.e. the new version will have different name from the original), then you can also mention the new file name.<\/p>\n<pre class=\"lang:default decode:true \">cp filename.extension \/dir\/filename.extension<\/pre>\n<p>Using this command you can use a number of parameters as below:<\/p>\n<ul>\n<li>cp \u2013r: it helps in copying all the contents of a folder.<\/li>\n<li>cp \u2013f: using this the destination file can be deleted, if there is already another file having the same name, and overrides it with the new one.<\/li>\n<li>cp \u2013i: warns you before copying.<\/li>\n<li>cp \u2013u: it helps in overwriting the file in the destination folder, only if the files comprise of different content.<\/li>\n<li>cp \u2013n: it ensures if the file already exists first and if so, it won\u2019t copy. There isn\u2019t any overwriting of the file.<\/li>\n<li>cp \u2013a: helps to archive the original file.<\/li>\n<\/ul>\n<p><strong>mv \u2013 Move File or Folder<\/strong><\/p>\n<p>Along with copying files and folders, it is also possible to move them. This can be done using the <strong>mv<\/strong> command.<\/p>\n<p>Using <strong>cp<\/strong>, you can either move a file or folder and keep the same name or move it and rename it.<\/p>\n<ul>\n<li>mv filename.extension \/dir\/ helps in moving a file and keeps the same name.<\/li>\n<li>mv filename.extension \/dir\/filename1.extension helps in moving and renaming the file.<\/li>\n<li>mv filename\/ .. helps in moving a file one folder up.<\/li>\n<\/ul>\n<p><strong>zip \u2013 Compress File or Folder<\/strong><\/p>\n<p>You can use <strong>zip<\/strong> command with folders or files which can be implemented for compressing a folder and its contents.<\/p>\n<p>It is required to include the name of the file\/folder that will be compressed as a zip file. It can be used with parameters that will specify whether you want to delete the original folder or not.<\/p>\n<ul>\n<li>zip -r filename.zip foldername: helps in compressing a folder but doesn\u2019t delete it.<\/li>\n<li>zip -m filename.zip foldername: helps in compressing a folder and deletes it. You will have just the zipped version of the folder.<\/li>\n<li>zip -d filename.zip foldername: helps in deleting a file from the existing zip archive that you specify.<\/li>\n<li>zip -u filename.zip foldername: It helps in updating a file within an existing zip archive: it can be useful if the original file is updated and don\u2019t want to delete the zip file and create a new one.<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9544\" src=\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/zip-min.png\" alt=\"\" width=\"587\" height=\"59\" srcset=\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/zip-min.png 587w, https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/zip-min-300x30.png 300w\" sizes=\"auto, (max-width: 587px) 100vw, 587px\" \/><\/p>\n<p>While listing out the contents of the folder, you will see the zip file and the original folder if you used zip -r, but if you used zip \u2013m, you will just see the new zip file.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9527\" src=\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/zip-m-min.png\" alt=\"\" width=\"811\" height=\"115\" srcset=\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/zip-m-min.png 811w, https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/zip-m-min-300x43.png 300w, https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/zip-m-min-768x109.png 768w\" sizes=\"auto, (max-width: 811px) 100vw, 811px\" \/><br \/>\n<strong>unzip \u2013 Decompress a Folder<\/strong><\/p>\n<p>With the unzip command, a zip file will get decompressed in your directory and its contents will get extracted for creating the folder or files from which it was originally compressed:<\/p>\n<pre class=\"lang:default decode:true \">unzip twentyseventeen.zip<\/pre>\n<p>If you haven\u2019t deleted the original folder don\u2019t use this command when zipping it. This is because the original folder won\u2019t be overwritten with it. You can use zip -m to delete the original folder when you want to zip it, or use rm to delete it prior to unzipping the zip file.<\/p>\n<p>Parameters can be added to unzip to customize its use:<\/p>\n<ul>\n<li>unzip filename.zip -x excludedfile.zip: This will exclude a file and ensure that it doesn\u2019t gets unzipped with the rest.<\/li>\n<li>unzip filename1.zip filename2.zip filename3.zip: This will unzip multiple files. It can be used with as many zip files as you want, and the process is faster as compared to doing this in an FTP client.<\/li>\n<\/ul>\n<p><strong>tar \u2013 Create and Unpack Compressed Archives<\/strong><\/p>\n<p>The tar command allows you to create and unpack .tar.gz archives, which is an alternate option to using .zip archives. The same command can be used to compress and decompress files or folders.<\/p>\n<p>Use tar cvzf for compressing a file or folder. To compress a folder, you can use the below syntax:<\/p>\n<pre class=\"lang:default decode:true\">tar cvzf archivename.tar.gz directoryname<\/pre>\n<p>The archivename represents the name of the archive file to be created and directoryname represents the name of the folder to be compressed.<\/p>\n<p>Use tar xvzf for decompressing the folder as below:<\/p>\n<pre class=\"lang:default decode:true \">tar xvzf archivename.tar.gz<\/pre>\n<p>The four letters represent the below things:<\/p>\n<ul>\n<li>c informs tar to compress files.<\/li>\n<li>x informs tar to extract files.<\/li>\n<li>v means verbose and informs tar to display the names of files affected by the command.<\/li>\n<li>z informs tar to uncompress the archive.<\/li>\n<li>f informs tar you are supplying the name of the archive.<\/li>\n<\/ul>\n<h3>File Commands<\/h3>\n<p>The most common SSH commands specifically for use with files are as below:<\/p>\n<p><strong>touch \u2013 Create a New File<\/strong><\/p>\n<p>The <strong>touch<\/strong> command is used to create a new empty file on your server as below:<\/p>\n<pre class=\"lang:default decode:true \">touch style.css<\/pre>\n<p>The file can be created only in the current directory and so, you will need to navigate to it prior to using the touch command.<\/p>\n<p><strong>cat \u2013 Show File Contents<\/strong><\/p>\n<p>The <strong>cat<\/strong> command helps to display the file\u2019s contents.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9530\" src=\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/cat-min.png\" alt=\"\" width=\"998\" height=\"418\" srcset=\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/cat-min.png 998w, https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/cat-min-300x126.png 300w, https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/cat-min-768x322.png 768w\" sizes=\"auto, (max-width: 998px) 100vw, 998px\" \/><\/p>\n<p>The complete contents of any file will be displayed within the Terminal or PuTTY.<\/p>\n<p><strong>grep \u2013 Search for a Specific Phrase<\/strong><\/p>\n<p>In case the file you need to examine is long and the contents you\u2019re looking for, use the grep command to search for specific content.<\/p>\n<p>In the below example, a search is done for the word \u2018asp_tags\u2019 in the php.ini file in a theme:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9531\" src=\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/grep-min.png\" alt=\"\" width=\"525\" height=\"333\" srcset=\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/grep-min.png 525w, https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/grep-min-300x190.png 300w\" sizes=\"auto, (max-width: 525px) 100vw, 525px\" \/><\/p>\n<p>With this command, all the lines containing the search term will get displayed<\/p>\n<p>If you want to search for a string containing more than one word, enclose it in speech marks:<\/p>\n<pre class=\"lang:default decode:true \">grep \"nav class\" footer.php<\/pre>\n<p>The grep command also comprises of multiple parameters that can be used to customize your search:<\/p>\n<ul>\n<li>grep -i \u201cstring\u201d : It searches for a string case-insensitively in the file.<\/li>\n<li>grep -c \u201cstring\u201d : It counts the number of instances of a string in the file.<\/li>\n<li>grep -l \u201cstring\u201d * : It lists the files containing the string.<\/li>\n<li>grep -n \u201cstring\u201d : It displays the line number(s) along with the result.<\/li>\n<\/ul>\n<p><strong>head \u2013 Read the First 10 Lines of a File<\/strong><\/p>\n<p>To simply read the opening lines of a file, use the head command as below:<\/p>\n<pre class=\"lang:default decode:true \">head filename.extension<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9532\" src=\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/head-min.png\" alt=\"\" width=\"981\" height=\"207\" srcset=\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/head-min.png 981w, https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/head-min-300x63.png 300w, https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/head-min-768x162.png 768w\" sizes=\"auto, (max-width: 981px) 100vw, 981px\" \/><\/p>\n<p><strong>tail \u2013 Read the Last 10 Lines of a File<\/strong><\/p>\n<p>The <strong>tail<\/strong> command and the <strong>head<\/strong> command work in the same way, but the tail command reads the last ten lines of a file:<\/p>\n<pre class=\"lang:default decode:true \">tail filename.extension<\/pre>\n<p><strong>find \u2013 Search Files and Directories<\/strong><\/p>\n<p>With the find command, you can search through files and directories and return those that fulfill the criteria that you specify. You can search the current directory for all files whose name includes \u2018index\u2019 using the below command:<\/p>\n<pre class=\"lang:default decode:true \">find . -name \u201cindex\u201d<\/pre>\n<p>The syntax is:<\/p>\n<pre class=\"lang:default decode:true \">find operator criterion string<\/pre>\n<p>You can use the below operators:<\/p>\n<ul>\n<li>\/ (slash) helps to search the whole system.<\/li>\n<li>. (dot) helps to search the working directory.<\/li>\n<li>~ (tilde) helps to search the home directory.<\/li>\n<\/ul>\n<p>So, if the above command is changed to this, <strong>str<\/strong> would search the whole system as well as the current directory:<\/p>\n<pre class=\"lang:default decode:true \">find \/ -name \u201cindex\u201d<\/pre>\n<p>The criteria you can use comprise of:<\/p>\n<ul>\n<li>-name \u2013 Represents the name of file.<\/li>\n<li>-user \u2013 Represents files belonging to a given user.<\/li>\n<li>-size \u2013 Represents files of a given size.<\/li>\n<li>-type -d \u2013 Represents the directory type. i.e. only search directories.<\/li>\n<li>-type -f \u2013 Represents the file type, i.e only search files.<\/li>\n<\/ul>\n<p>The search term can be any string that you want to use. But make sure you enclose it in speech marks.<\/p>\n<p><strong>du \u2013 Get File Size<\/strong><\/p>\n<p>To check the size of one or more files in your WordPress installation, use the du (Disk Usage) command as below:<\/p>\n<pre class=\"lang:default decode:true \">du -h wp-config.php<\/pre>\n<p>Here<strong> -h<\/strong> represents the disk usage to be displayed in human-readable format, instead of blocks.<\/p>\n<p>You can also use the below extra parameters:<\/p>\n<ul>\n<li>df \u2013h: The result will get displayed in a human-readable format.<\/li>\n<li>df \u2013m: The result will get displayed in MB.<\/li>\n<li>df \u2013k: The result will get displayed in KB.<\/li>\n<li>df \u2013T: This will display the file system type in an extra column.<\/li>\n<li>df -ht \/directoryname: It will enable you to view information about a specific directory.<\/li>\n<li>df help: It lists other options that can be used with their descriptions.<\/li>\n<\/ul>\n<p><strong>chmod \u2013 Change a File\u2019s Permissions<\/strong><\/p>\n<p>With the <strong>chmod<\/strong> command, you can change a file\u2019s permissions:<\/p>\n<pre class=\"lang:default decode:true \">chmod 464 filename.extension<\/pre>\n<p>In order to find which permissions to use, use the Unix Permissions Calculator and copy the number you get into the command.<\/p>\n<p><strong>nano \u2013 Edit a File with the Nano Text Editor<\/strong><\/p>\n<p>In case you have created a new file using the <strong>touch<\/strong> command, or maybe the <strong>cat<\/strong> command for displaying the contents of an existing file, you might want to then edit the file.<\/p>\n<p>This can be done using the nano text editor with the nano command as below:<\/p>\n<pre class=\"lang:default decode:true \">nano filename.extension<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-9533\" src=\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/nano-min-1024x390.png\" alt=\"\" width=\"1024\" height=\"390\" srcset=\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/nano-min-1024x390.png 1024w, https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/nano-min-300x114.png 300w, https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/nano-min-768x293.png 768w, https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/nano-min.png 1092w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<p>You can edit your files right from the command line using this syntax.<\/p>\n<div class=\"vlt-box vlt-blue\">\n<div class=\"box-title\">Note<\/div>\n<div class=\"box-content\">\n<p>It is very hard to undo your work as compared to using a code editor or a version control system. Just make minor changes, if you are confident about it.<\/p>\n<\/div>\n<\/div>\n<p>Using the cursor keys along with the keyboard shortcuts listed at the bottom of the screen to navigate the file. Use <strong>Ctrl-X<\/strong> to exit the file and return to the Terminal.<\/p>\n<p><strong>vim \u2013 Edit a File with the Vim Text Editor<\/strong><\/p>\n<p>The vim text editor works similar to the nano editor and it can be accessed using the vim command. Which one to use, depends on personal preference:<\/p>\n<pre class=\"lang:default decode:true \">vim filename.extension<\/pre>\n<p><strong>wget \u2013 Download Files<\/strong><\/p>\n<p>Using the wget command you can download files from the internet. The files will get downloaded to the directory that you are currently in. It is needed to include the full path to the file that needs to be downloaded:<\/p>\n<pre class=\"lang:default decode:true \">wget https:\/\/site.com\/filename.ext<\/pre>\n<p>With this the filename.ext file will get downloaded from site.com and it can be stored in your current directory.<\/p>\n<h3>Terminal Commands<\/h3>\n<p>This category includes some of the most commonly used commands for helping you to work with the Terminal (or PuTTY) interface.<\/p>\n<p><strong>clear \u2013 Clear Screen<\/strong><\/p>\n<p>In case screen is cluttered, just type in <strong>clear<\/strong> to clear it and see yourself at the top of a blank screen again. To have a clean working environment or hiding your work if you\u2019re in a public place use the below command:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-9534\" src=\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/clear-min-1024x391.png\" alt=\"\" width=\"1024\" height=\"391\" srcset=\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/clear-min-1024x391.png 1024w, https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/clear-min-300x114.png 300w, https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/clear-min-768x293.png 768w, https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/clear-min.png 1088w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<p><strong>reset \u2013 Remove Output from Terminal<\/strong><\/p>\n<p>With the <strong>reset<\/strong> command all of your commands will get removed along with the output from the terminal screen and will clear the screen.<\/p>\n<p><strong>history \u2013 Show last 50 used commands<\/strong><\/p>\n<p>The <strong>history<\/strong> command can be used to see your most recent task and repeat or undo something. It outputs a list of the most 50 recent commands used by you.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9535\" src=\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/history-min.png\" alt=\"\" width=\"651\" height=\"391\" srcset=\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/history-min.png 651w, https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/history-min-300x180.png 300w\" sizes=\"auto, (max-width: 651px) 100vw, 651px\" \/><\/p>\n<h3>Other Useful Commands When Working via SSH<\/h3>\n<p>The below commands don\u2019t fit under the headings but can be useful for working with your WordPress site via SSH:<\/p>\n<p><strong>netstat \u2013 Display Network Connections<\/strong><\/p>\n<p>Use the netstat command to see details of your network connection and status as below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-9536\" src=\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/netstat-min-1024x665.png\" alt=\"\" width=\"1024\" height=\"665\" srcset=\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/netstat-min-1024x665.png 1024w, https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/netstat-min-300x195.png 300w, https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/netstat-min-768x499.png 768w, https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/netstat-min.png 1500w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<p><strong>exit \u2013 Exit the Remote Server<\/strong><\/p>\n<p>After completing the work with your remote WordPress site, use the <strong>exit<\/strong> command to exit the server and return to your local machine.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9537\" src=\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/exit-min.png\" alt=\"\" width=\"515\" height=\"73\" srcset=\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/exit-min.png 515w, https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/exit-min-300x43.png 300w\" sizes=\"auto, (max-width: 515px) 100vw, 515px\" \/><\/p>\n<p>This should be always done when you finish working, so no one else can access your server via SSH.<\/p>\n<h3>Summary<\/h3>\n<p>When you can access your WordPress site via SSH, you get a secure and convenient way to work with the files on your site without the need to open a FTP client or a web browser.<\/p>\n<p>Fortunately the commands listed here help you to carry out most of the tasks required to do in WordPress over SSH and get more work done faster.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When you use SSH with WordPress, it can be one of the most secure and convenient methods of accessing your website. SSH is a protocol that helps to access the files on your site which means \u2018Secure Shell\u2019. You can use it to access your site from wherever you are if you have your login [&hellip;]<\/p>\n","protected":false},"author":16,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[121,1471,1472,78],"class_list":["post-9521","post","type-post","status-publish","format-standard","placeholder-for-hentry","category-wordpress-faq","tag-ssh","tag-ssh-commands","tag-ssh-commands-for-wordpress","tag-wordpress-2"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Popular SSH Commands for WordPress Users<\/title>\n<meta name=\"description\" content=\"The When you use SSH with WordPress, it can be one of the most secure and convenient methods of accessing your website. Check these SSH commands for it.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.milesweb.in\/hosting-faqs\/ssh-commands-for-wordpress\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Popular SSH Commands for WordPress Users\" \/>\n<meta property=\"og:description\" content=\"The When you use SSH with WordPress, it can be one of the most secure and convenient methods of accessing your website. Check these SSH commands for it.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.milesweb.in\/hosting-faqs\/ssh-commands-for-wordpress\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Hosting FAQs by MilesWeb\" \/>\n<meta property=\"article:published_time\" content=\"2020-05-29T11:43:30+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/pwd-min.png\" \/>\n<meta name=\"author\" content=\"Pallavi Godse\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Pallavi Godse\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"16 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/ssh-commands-for-wordpress\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/ssh-commands-for-wordpress\/\"},\"author\":{\"name\":\"Pallavi Godse\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/7e3952607fa9eb4e82fea9f7cad9c945\"},\"headline\":\"Popular SSH Commands for WordPress Users\",\"datePublished\":\"2020-05-29T11:43:30+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/ssh-commands-for-wordpress\/\"},\"wordCount\":3081,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/ssh-commands-for-wordpress\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/pwd-min.png\",\"keywords\":[\"SSH\",\"SSH commands\",\"SSH commands for WordPress\",\"WordPress\"],\"articleSection\":[\"WordPress FAQ\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.milesweb.in\/hosting-faqs\/ssh-commands-for-wordpress\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/ssh-commands-for-wordpress\/\",\"url\":\"https:\/\/www.milesweb.in\/hosting-faqs\/ssh-commands-for-wordpress\/\",\"name\":\"Popular SSH Commands for WordPress Users\",\"isPartOf\":{\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/ssh-commands-for-wordpress\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/ssh-commands-for-wordpress\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/pwd-min.png\",\"datePublished\":\"2020-05-29T11:43:30+00:00\",\"author\":{\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/7e3952607fa9eb4e82fea9f7cad9c945\"},\"description\":\"The When you use SSH with WordPress, it can be one of the most secure and convenient methods of accessing your website. Check these SSH commands for it.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/ssh-commands-for-wordpress\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.milesweb.in\/hosting-faqs\/ssh-commands-for-wordpress\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/ssh-commands-for-wordpress\/#primaryimage\",\"url\":\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/pwd-min.png\",\"contentUrl\":\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/pwd-min.png\",\"width\":241,\"height\":35},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/ssh-commands-for-wordpress\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.milesweb.in\/hosting-faqs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Popular SSH Commands for WordPress Users\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/#website\",\"url\":\"https:\/\/www.milesweb.in\/hosting-faqs\/\",\"name\":\"Web Hosting FAQs by MilesWeb\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.milesweb.in\/hosting-faqs\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/7e3952607fa9eb4e82fea9f7cad9c945\",\"name\":\"Pallavi Godse\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/3602d0ac1ab89332aea8205dcf474af4ff4eb319cfd584544038908cd5e4c966?s=96&d=blank&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/3602d0ac1ab89332aea8205dcf474af4ff4eb319cfd584544038908cd5e4c966?s=96&d=blank&r=g\",\"caption\":\"Pallavi Godse\"},\"description\":\"Pallavi is a Digital Marketing Executive at MilesWeb and has an experience of over 4 years in content development. She is interested in writing engaging content on business, technology, web hosting and other topics related to information technology.\",\"sameAs\":[\"https:\/\/www.milesweb.in\"],\"url\":\"https:\/\/www.milesweb.in\/hosting-faqs\/author\/pallavi\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Popular SSH Commands for WordPress Users","description":"The When you use SSH with WordPress, it can be one of the most secure and convenient methods of accessing your website. Check these SSH commands for it.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.milesweb.in\/hosting-faqs\/ssh-commands-for-wordpress\/","og_locale":"en_US","og_type":"article","og_title":"Popular SSH Commands for WordPress Users","og_description":"The When you use SSH with WordPress, it can be one of the most secure and convenient methods of accessing your website. Check these SSH commands for it.","og_url":"https:\/\/www.milesweb.in\/hosting-faqs\/ssh-commands-for-wordpress\/","og_site_name":"Web Hosting FAQs by MilesWeb","article_published_time":"2020-05-29T11:43:30+00:00","og_image":[{"url":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/pwd-min.png","type":"","width":"","height":""}],"author":"Pallavi Godse","twitter_misc":{"Written by":"Pallavi Godse","Est. reading time":"16 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/ssh-commands-for-wordpress\/#article","isPartOf":{"@id":"https:\/\/www.milesweb.in\/hosting-faqs\/ssh-commands-for-wordpress\/"},"author":{"name":"Pallavi Godse","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/7e3952607fa9eb4e82fea9f7cad9c945"},"headline":"Popular SSH Commands for WordPress Users","datePublished":"2020-05-29T11:43:30+00:00","mainEntityOfPage":{"@id":"https:\/\/www.milesweb.in\/hosting-faqs\/ssh-commands-for-wordpress\/"},"wordCount":3081,"commentCount":0,"image":{"@id":"https:\/\/www.milesweb.in\/hosting-faqs\/ssh-commands-for-wordpress\/#primaryimage"},"thumbnailUrl":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/pwd-min.png","keywords":["SSH","SSH commands","SSH commands for WordPress","WordPress"],"articleSection":["WordPress FAQ"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.milesweb.in\/hosting-faqs\/ssh-commands-for-wordpress\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/ssh-commands-for-wordpress\/","url":"https:\/\/www.milesweb.in\/hosting-faqs\/ssh-commands-for-wordpress\/","name":"Popular SSH Commands for WordPress Users","isPartOf":{"@id":"https:\/\/www.milesweb.in\/hosting-faqs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.milesweb.in\/hosting-faqs\/ssh-commands-for-wordpress\/#primaryimage"},"image":{"@id":"https:\/\/www.milesweb.in\/hosting-faqs\/ssh-commands-for-wordpress\/#primaryimage"},"thumbnailUrl":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/pwd-min.png","datePublished":"2020-05-29T11:43:30+00:00","author":{"@id":"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/7e3952607fa9eb4e82fea9f7cad9c945"},"description":"The When you use SSH with WordPress, it can be one of the most secure and convenient methods of accessing your website. Check these SSH commands for it.","breadcrumb":{"@id":"https:\/\/www.milesweb.in\/hosting-faqs\/ssh-commands-for-wordpress\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.milesweb.in\/hosting-faqs\/ssh-commands-for-wordpress\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/ssh-commands-for-wordpress\/#primaryimage","url":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/pwd-min.png","contentUrl":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/05\/pwd-min.png","width":241,"height":35},{"@type":"BreadcrumbList","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/ssh-commands-for-wordpress\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.milesweb.in\/hosting-faqs\/"},{"@type":"ListItem","position":2,"name":"Popular SSH Commands for WordPress Users"}]},{"@type":"WebSite","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/#website","url":"https:\/\/www.milesweb.in\/hosting-faqs\/","name":"Web Hosting FAQs by MilesWeb","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.milesweb.in\/hosting-faqs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/7e3952607fa9eb4e82fea9f7cad9c945","name":"Pallavi Godse","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/3602d0ac1ab89332aea8205dcf474af4ff4eb319cfd584544038908cd5e4c966?s=96&d=blank&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3602d0ac1ab89332aea8205dcf474af4ff4eb319cfd584544038908cd5e4c966?s=96&d=blank&r=g","caption":"Pallavi Godse"},"description":"Pallavi is a Digital Marketing Executive at MilesWeb and has an experience of over 4 years in content development. She is interested in writing engaging content on business, technology, web hosting and other topics related to information technology.","sameAs":["https:\/\/www.milesweb.in"],"url":"https:\/\/www.milesweb.in\/hosting-faqs\/author\/pallavi\/"}]}},"_links":{"self":[{"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/posts\/9521","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/comments?post=9521"}],"version-history":[{"count":9,"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/posts\/9521\/revisions"}],"predecessor-version":[{"id":9546,"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/posts\/9521\/revisions\/9546"}],"wp:attachment":[{"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/media?parent=9521"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/categories?post=9521"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/tags?post=9521"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}