Secure Shell, or SSH, is a way of using the command line to connect to your webspace. For power users, this is a feature that is really important since you can run commands and manage files. You must use an SSH client to connect to the server in order to use SSH. Within a terminal application, you can run commands by hand once you are connected.
To connect to the server, you use a terminal or Shell client with SSH. You can download an SSH client such as PuTTY if you are using Windows. On the other hand, you can use Terminal if you’re on Linux and macOS.
You can type ssh if you have a command prompt, followed by the shell username (cPanel username) you have, an @ sign, and then the name of your server. For instance:
You can run PHP commands, move files, edit files, and much more once you have logged in. Key-based authentication is supported by our system, which is a lot more secure than just having a password. In addition, you will save time, and you won’t have to type it every single time. Just create a private key and your computer, and then upload the public key’s contents part of it to a file with the name .ssh/authorized_keys. Don’t hesitate to contact us if you need any help with this.
After you’ve logged in, there are some basic commands you should know about.
To navigate your hosting space, there are two major commands that you should use. These commands are the following:
ls -lah – the files in the folder you currently are in will be listed with this command, along with some extra info about the files such as permissions, time and date it was created/last modified, and size. Pwd – this is a command which will help you not get lost since it will list he path you’re currently in.
In order to create a new file, use touch [filename.ext]. Keep in mind that the extension should be put at the end, such as .txt, for instance.
In order to create a new directory in the location you’re currently in, use mkdir [directoryname].
Less experienced users use default nano to modify files. For instance, you can open the file in nano by using nano [filename].txt, and by pressing Ctrl+G or F1, you can read the full information on how to use it.
vim can be used to edit files; however, users that are more advanced typically use this editor.
For instance, vim [filename].php
To find text inside of a file, you can use cat in combination with grep. You will be able to find the requested text easier since it will be outlined.
For instance, cat [filename.txt] | grep “Oct 20 11:02”, which means to display the contents of [filename.txt] break grab and outline text matching “Oct 20 11:02”.
Updated 3 months ago