In this tutorial, we are going to cover 17 basic SSH commands that you should know about. By learning them, you will understand how to navigate and manage your VPS or server using the command line.
How to Access Remote Server
Before we begin, make sure that you have access to a remote linux based server.
Pro Tip
SSH stands for Secure Shell, a protocol used to securely connect to a remote server or system.
Now let’s start by accessing your remote linux server:
There are two recommended methods to establish an SSH connection:
Using an SSH client (PuTTY). It will require you to enter the server’s IP and the port number into the corresponding fields.
Using the built-in command prompt (Putty) or terminal shell (Linux, macOS). You will need to write:
ssh user@serverip
Remember to replace “user” with your real username and “serverip” with your server’s dedicated or shared IP address.
Once you click the Open button on PuTTY or enter the command on the terminal, you will be prompted for a password. If you are connecting to the server for the first time, you might get a warning message, telling you that the server is not recognized. Just hit Yes to continue.
That’s it. Now you’re connected to the server and can start executing SSH commands.
List of Basic SSH Commands
In this part, we will go through popular SSH commands, complete with their syntaxes and useful options.
Here’s a quick look of the basic SSH commands that we’ll cover in this article:
SSH Command
Explanation
ls
Show directory contents (list the names of files).
cd
Change Directory.
mkdir
Create a new folder (directory).
touch
Create a new file.
rm
Remove a file.
cat
Show contents of a file.
pwd
Show current directory (full path to where you are right now).
cp
Copy file/folder.
mv
Move file/folder.
grep
Search for a specific phrase in file/lines.
find
Search files and directories.
vi/nano
Text editors.
history
Show last 50 used commands.
clear
Clear the terminal screen.
tar
Create & Unpack compressed archives.
wget
Download files from the internet.
du
Get file size.
1. ls Command
This SSH command is used to list all files and directories. After entering ls, you will see an output that looks like this:
Comments