KNOWNHOST KNOWLEDGE BASE

Hosting Question? Find the Solution - Browse our Guides, Articles, and How-To's

How to use SSH and 20 Basic Linux Commands?

Category: Guides
Tags: # # # # #

Linux has an SSH protocol that enables the remote users to connect and perform the operations, just like RDP is a protocol that works with Windows for the remote desktop. In this article, we will thoroughly explain how to use SSH and the basic commands of the SSH, and its usage.


What is SSH?

Secure Shell, also known as SSH, is a protocol that helps the administrators and users connect to the remote systems and lets you perform the server-level tasks with the ease of SSH command-line utility. You must remember that certain levels of permission administrators can configure for the users; if you would like to perform the admin level tasks on KnownHost’s Linux VPS, you must log in as a root user or root privilege assigned user account.

How SSH works?

Well, with the above definition, you might have already got an idea about SSH usage. Still, for a better understanding, refer to the below image,

How SSH works command line

How to connect via SSH?

We have covered an independent topic on How to connect with SSH? that will explain the procedure for connecting to the KnownHost’s Linux VPS/Server via SSH. Still, we are sharing the syntax of the SSH command, which you have to use while connecting to the remote server using the Linux system,

For custom SSH port.

ssh -p <Custom Port> username@ipaddress/hostname

For default SSH port i.e., 22.

ssh username@ipaddress/hostname

Basic Linux Commands

Linux is all about a command-line interface, and you have a set of common commands for the daily operations such as copy, move, rename, download, etc. We will be covering all of the basic commands which you will require in day-to-day life as a Linux user,

command line icon

man

Man is a built-in manual command that helps users understand the command’s usage with the possible arguments and syntax information. Example: man tarman mv, etc. To change the page press space bar and to exit from the manual press q.

command line icon

history

History command helps you to find previously executed commands on the Linux terminal. You can also wipe out the previous history using the clear command.

command line icon

top

The top command helps you track down all the processes running on the Linux system. This is the most helpful command used while troubleshooting the problems. There are several variations of the top command such as top c, top i, etc.

command line icon

mv

Mv command works for the two operations, a) To move the files; b) To rename directory/file. If you define the unique destination in the mv command, it will work for moving the files, and if you didn’t mention the unique destination, then the command will help you rename the directory/file.

command line icon

wget

To download the non-interactive files from the web you can take the help of the wget command. The syntax of the wget command is pretty straightforward wget <URL>. Also, get work with both HTTP and HTTPS.

command line icon

ping

There are two major reasons to use the ping command. First, Linux/Windows use the ping command to check the latency of the destination server. Second, Linux/Windows uses the ping command to check the availability of the destination server.

command line icon

kill

If one of the Linux server’s programs is stuck with the process, or you would like to kill all processes running under a Linux user, then you can take the help of the kill command. There are 64 signals which work with the Kill command. The syntax of the kill command is Kill <Signal ID> <PID/User>. The most command signal ID we use to terminate the process is -9 forcefully.

command line icon

ps

Ps command mostly gets in use while monitoring the Linux server. The primary task of the ps command is to monitor the selection of the active processes running on the Linux server. Administrators commonly use ps ax or ps axu command to check every process running on the linux system.

command line icon

cd

Cd command gets used while navigating through the files and directories on the Linux server. This is one of the most common commands the Linux users use daily. Suppose you would like to navigate from /home/host/KnownHost directory to /home/best/LinuxHost then you would use the command cd /home/best/LinuxHost.

command line icon

pwd

On Linux, you don’t want to work on the unwanted directory; to avoid such consequences, you must check the current working directory; to check the present working directory on Linux, use the pwd command.

command line icon

ls

To view the current working directory’s content, Linux has a command ls. Variation of the command helps you list the present files with their owner, group, permission, size, and date of modification details.

command line icon

mkdir

To create the directory on the Linux system, use the mkdir command. For example, if you want to create the KnownHost directory, simply run the mkdir KnownHost command. To create multiple directory you can use the syntax: mkdir <directory 1> <directory 2> <directory 3>.

command line icon

rmdir

Using mkdir, we learned how you could create the directories. To remove the directory use the command rmdir. For example, if you want to remote the KnownHost directory from the current working destination, simply run the rmdir KnownHost command. Note that, you can delete only empty directories using the rmdir command.

command line icon

rm

You use the rm command to delete every file and directory on the Linux system. Variation of the rm’s commands helps you remove the recursive directories and the files simultaneously. To remove single file or directory use rm <directory/file path>, to recursively delete the directories run the rm -r <directory/file path>, to forcefully and recursively remove the directories/files run the rm -rf <directory/file path> command.

command line icon

touch

You can use the touch command to create a plain new file on the Linux system. For example, to create a KnownHost.txt file at /home/admin directory, you could run touch /home/admin/KnownHost.txt.

command line icon

grep

Grep is another most commonly used command by Linux users to search/find through the text file. For example, if you have a KnownHost.txt file on the Linux system and want to search for a word best, then you could use grep best KnownHost.txt, and the result will show up the lines which have the best word in it.

command line icon

chmod

Another most commonly used command in Linux for changing read, write and execute permission for World, Group, and User. For example, if you would like to change the permission of the KnownHost directory to rwxr-xr-x i.e., 755 then you could use the chmod 755 KnownHost.

command line icon

chown

You can use it to change the ownership of the file/directory in the Linux chown command. For example, if you want to change the ownership of the KnownHost directory to john user, you could use the command, chown john KnownHost. Another example, suppose if you would like to change the owner of the KnownHost directory to lora and group to USA, then use chown lora:USA KnownHost command.

command line icon

jobs

This basic command will display all the jobs and their status opened by the shell on the Linux system. To monitor and check the job status, you could use this command.

command line icon

nano

Nano is a popular and more accessible text editor used on Linux systems. Due to its simple text editor feature and the GUI-like interface enabled beginners to edit the text files the easier—furthermore, many popular command-line text editors such as vi, vim, etc.


Conclusion

Now that we’ve gone over the basic understanding of SSH and how SSH works. Furthermore, we also covered the 20 Linux commands which Linux users often use.

KnownHost offers 365 days a year, 24 hours a day, all 7 days of the week best in class technical support. A dedicated team ready to help you should you need our assistance. You’re not using KnownHost for the best webhosting experience? Well, why not? Check with our Sales team to see what can KnownHost do for you in improving your webhosting experience.