10 Useful SSH Commands for VPS Servers

On with 0 Comment
SSH command prompt on a smartphoneWhether you're using a fully managed or an unmanaged VPS machine, familiarity with Linux/Unix command prompt is a must. Lots of useful administration and troubleshooting tasks are done through this shell prompt. Normally, we access this shell through a SSH client that gives us remote access to our VPS server's shell environment. Although there are thousands of commands at your disposal, only a handful of them is necessary to perform day-to-day tasks associated with your VPS server. If you're not familiar with Linux shell environment, I'll strongly advise you to first practice these commands on a local UNIX system. Most of the commands mentioned here will help you in finding more information about your VPS machine as well as will assist you in configuring simple but important and useful settings.

SSH command prompt on a smartphone
So let's get started and see some of the most useful and handy SSH commands that will help you manage your VPS server in an easy way.

Command → 'top' : While working on a shell prompt, users often use this command to watch and manage important resource hogging tasks on the server. Simply type top on the shell prompt and you'll get an interactive list of tasks which are consuming highest processor and system resources.

VPS users often use this command to not only inspect important processes but also for manipulating these tasks. You can easily change the priority of selective tasks as well as can kill a task through this command. If you find a process that's consuming alarmingly high system resources, you can easily identify and kill that process through this command.

Command → 'df -h' : This is yet another useful command to get details about the disk space available on different storage devices on your VPS server. There are several other similar commands like du or quota which more or less provide the same details, but I found this command - the most user-friendly.

If you're installing extra packages and applications on your server, it's always advisable to use this command to know about the available disk space beforehand. This way, you'll ensure that you have enough storage space on your server before you start the installation process.

Command → 'set | more' : This command is very useful for advanced VPS users who frequently write custom shell scripts to manage and customize their server's functionality. This command displays all the available environment variables and their values on your server.

Linux environment variables
You can use these variables to write more stable and powerful shell scripts for completing complex tasks in a simple and an automated way.

This command also lists the custom commands or shell scripts configured on your VPS server. Although you can get all the results without the appended more command, use of the same is highly recommended since the list is generally spread across multiple pages on a typical VPS server.

Command → 'vmstat' : Each VPS server is a virtual Linux machine with a fixed amount of resources sliced from a single powerful physical server. After signing up for a VPS plan, you may want to inquire about the raw system resources available on your server instance.

This command exactly does that and provides you with detailed information about the resources and system activity of your VPS server. You can use various switches available with this command to customize the information and the way it is displayed on the screen.

Command → 'netstat' : If you're building a network-centric application on your VPS server, then this command is made just for you. It displays tons of information related to all the active or inactive network connections on your server.

This command supports several switches which can be used to filter out the exact network information you're looking for. Generally, VPS owners use this command to detect network problems within their applications.

Command → 'cat /proc/cpuinfo' 'cat /proc/meminfo' : These two commands are also commonly used by VPS users. The first one displays information about the physical processors available on your server. Note, your own VPS container may use just a part of the combined processing power available from the listed processors.

The latter command displays detailed information about the available physical and virtual memory. It also displays information about buffers and other memory regions that are allocated to different resources on your VPS container.

Command → 'service <service_name> [start|stop|restart]' : As the name implies, this important command is used to manipulate several important services running on your VPS server viz., MySQL, cPanel or Apache. Through this command, you can start, stop or restart each of these services.

For example, if you want to restart the MySQL service, you'll use the following command → service mysql restart. Similarly, you can use start and stop keywords to halt or trigger any service.

Command → 'wget cachefly.cachefly.net/100mb.test' : This is one of the easiest and reliable commands to check the download speed of your VPS server. This command fetches 100 MB raw data from a content delivery network and saves it on your server.

wget Linux command
While the data transfer is in progress, this command constantly calculates the throughput for inbound stream and presents the average value of the same at the end of the data transfer. This way, you can easily get the accurate download speed of your VPS container.

Command → 'ifconfig' : This is yet another useful command to both setup and view information about all configured network interfaces on a VPS server. Users often use this command to retrieve the hardware address as well as to get the information about the IP address associated with a specific network interface.

Advanced users also use this command to set up new or additional network interfaces on a server. It also gives you the summary of data sent and received through a network interface from the time server was up and running.

Command → 'w' : And last but not the least, this single alphabet command is very useful for VPS servers where multiple users are working from remote locations. This command displays the list of users who've logged into a server including their activities and associated information.

This command is ideal for keeping an eye on the activities of different users working on your VPS server. You can use several switches supported by this command to filter out activities and login information associated with a specific user.


Post a Comment