ComputersInformation Technology

The most useful SSH commands

The SSH commands are a very important tool for any system administrator or advanced webmaster who places sites not on regular hosting, but on a dedicated server. Configuring such servers is usually done through the console using Linux commands.

You can use various programs for connection, for example, PuTTY. SSH also handles the Bitvise SSH Client. In fact, they are one and the same. Therefore, most administrators use what they are just used to.

PuTTY SSH

Below in the photo you can see the PuTTY program console. When connecting to any program, you need to specify the host (IP address) of the server and the port on which this console is running. Usually this is the 22nd port.

Some shells to connect to the server offer to remember your login and password. This is not recommended. The maximum that you can remember is the login to simplify the work. But always re-enter the password. Such clients are sometimes hacked, and then attackers steal your data.

Bitvise SSH Client

Also, SSH Linux commands work well in Bitvise SSH Client. The console is exactly the same, but besides this, FTP is immediately opened in this program.

You can use anything. The main thing that you liked and everything worked. The principle is the same everywhere.

SSH commands for system monitoring

The SSH console commands allow you to monitor the server. To do this, simply type htop. The result is the image that you see below.

All computers will have different information. In this case, a weak server with one processor and only 671 MB of RAM is listed.

The Uptime graph shows how much time has passed since the system was restarted. If the job of administering the server and monitoring its state as a whole is done professionally, it will take a long time to work without reboots. After all, if everything works well, then why restart?

Here, a very important line is the Load Average with three values. The first shows the average load for the last minute, the second - for the last 5 minutes, the third - for the last 15 minutes. This load is not defined as in the standard Windows Task Manager.

The load can be more than 100. Even more than 200. The system works as follows: if the last minute reading is less than or equal to 1 and there is one core on the computer, the server copes with the load. That is, you need to take into account the ratio of the number of cores and digits on the screen. If everything is 1 to 1 or less, then it's good. The smaller the value, the faster the operating system as a whole.

If load 4 on a dual-core server, then the load exceeds twice the capacity for stable operation. Try to keep track of this figure. If the load is large, then try to optimize the server and what works there.

Load, as a rule, can work with files or with a database.

Anyone on the server can use the htop command. But only root can look at the load and requests of all databases of all users. To do this, log on to the server using SHH and enter the mytop command.

All current queries with detailed information are displayed here:

  • Request ID (the longer the server is running, the greater the number);
  • The user who is performing the request;
  • The host where the request is made;
  • database;
  • How long the request is made;
  • The request itself.

The most important thing here is the time of execution. The longest processes are at the bottom. If you see that a mysql request takes a couple of minutes, then it's not normal. Press the k button (from the word kill) and enter the ID. As a result, you can complete the request. Kill all long requests in this way and you can unload the server.

Next, to fix the problem (and it will appear again, and you can not always manually kick the problem lines), you need to see what kind of database it is and what query it is. Identify the longest and optimize them.

Basic Linux Commands

There are various commands for SSH. Everyone has a different purpose. For example:

  • To work with files;
  • To display system information;
  • For process management;
  • For archiving;
  • To work with the network;
  • To work with mysql;
  • For search;
  • To set permissions for files;
  • To install packages.

To consider all is optional. With most of them you will come across as you work with the console.

Now consider the basic commands that are needed always and everywhere. If you remember them, you will always remember.

Working with files

Pay attention to the fact that the paths in the teams should be written based on where you are. For example, the ls command will list the current directory. Transitions to folders by means of cd can be done immediately in the desired one, rather than one by one.

Always look at the paths that you write in the teams. You can also use "masks". For example, you can delete all txt files by typing the command rm * .txt. Under the asterisk is understood anything, the main thing is that in the end it was.

Archiving files

To view this issue, please review the photo below.

System Information

The main commands are shown in the photo.

Installing programs

Not all SSH commands work right after installing the operating system. Many utilities need to be installed. It's very simple.

For example, the htop and mytop commands are not included in the package. They need to be installed. To do this, type sudo apt-get install htop.

You need to install from the user root. Others have insufficient rights.

The principle of installation is the same for all programs. Simply at the end, it changes instead of htop to the utility you need (for further commands).

Similar articles

 

 

 

 

Trending Now

 

 

 

 

Newest

Copyright © 2018 en.unansea.com. Theme powered by WordPress.