Home > Help Center > Shared Hosting > Website > SSH - basic knowledge and commands

SSH - basic knowledge and commands

Basic knowledge and working with SSH

SSH (Secure Shell) is a tool for gaining access to a remote machine or hosting over the internet for the purpose of managing it. When communicating between two parties, it provides a high level of security through an encrypted connection.

Through SSH, you can upload files and personal information to the hosting account without worrying about whether it can be tapped or stolen.

SSH access is also useful for developers who want to directly edit program code or create a script directly on the server. The standard access is via port 22, but on shared hosting by HostPulse this port is changed to 22022 for achieving a higher security level.

To make a connection through SSH, you need to use the most popular SSH client (for Windows OS) - PuTTY.

After downloading and installing the SSH client, you need to enter the following contact details:

  • Connection type - enter SSH.
  • Host Name (or IP address) - enter the server name, your domain name, or the IP address of the machine.
  • Port - enter 22022.

After opening the session, you must enter a username and password. The data you need to use is the name and password to access your cPanel account.

In this article we will show you the basic commands that are needed when using SSH.

man - Shows the command help documentation.

man cat

cd - Navigates us to a directory.

cd /var/log

cd .. - Returns a directory up.

cd / - Returns us to the root directory.

ls - Displays a list of folders and files in the current directory.

cat - Displays information from a file.

cat /var/log/messages

grep - Displays information about a certain match in a file.

cat /var/log/messages | grep Logout

tail - we see the last 10 lines of a file.

tail /usr/local/cpanel/logs/access_log

tailf - Displays real-time changes to a file.

mkdir - Creates a directory.

cp - Copies a specific file.

cp /etc/passwd /var/

scp - Copy files via SSH over your hosting network.

scp /local/file <user@host.com:/path/to/save/file>

pwd - Displays information about which directory you are currently in.

chown - Changes the owner and group of a file or directory.

chown user:nobody /tmp/test.txt

chmod - Changes permissions of a file or directory.

chmod 755 /tmp/test.txt

history - Displays the commands you have used.

/usr/local/php71/bin/php - Use PHP version 7.1 under SSH.

Almost all SSH commands can be used with additional options that extend the use of the command. For example, the rm command is used to delete files and directories:

rm [options] ... file ...

The usage of the following options greatly extends the functionality of the rm command:

-f, --force - Ignores nonexistent files, never prompt.

-i - Prompts before every removal.

-I - Prompts before removing more than three files, or when removing recursively. Less intrusive than -i, while still giving protection against most mistakes.

--interactive [= WHEN] - Prompts according to WHEN: never, once (-I), or always (-i). Without WHEN, prompts always.

--one-file-system - When removing a hierarchy recursively, skip any directory that is on a file system, different from that of the corresponding command line argument.

--no-preserve-root - Do not treat '/' specially.

--preserve-root - Do not remove '/' (default).

-r, -R, --recursive - Removes directories and their contents recursively.

-v, --verbose - Explains what is being done.

--help - Displays this help and exit.

--version - Outputs information and exit.

At this URL address https://ss64.com/bash/ you can find a list of almost all SSH commands along with the available options and examples.

Still not finding what you're looking for?

Contact our support team with any additional questions or concerns.

Contact support