ESDS Knowledge Base

16
Oct

Some SSH Commands For Linux VPS and Dedicated Hosting

Below mentioned are some of the commands that can be utilized for VPS Hosting and Dedicated Server Monitoring.

Command: top
Description: The top command is used to list all the running processes on the server, along with statistics of CPU usage, memory, I / O, load average, and so on … In the example below, we are indicating to the top command he should be updated every 1 second:
Example: top d 1

Command: ps
Description: Similar to the top command, it serves to list the running processes on the server. The example below followed aux option is to list all processes and any user.
Example: ps aux

Command: kill -9
Description: The kill is used to kill a server process by PID. You can find the PID of a process running the command pidof-x followed by the name of the process.
Example: kill -9 1234

Command: free
Description: This command is used to view the data of the physical memory of the server. Use it with-m for the data to be displayed in megabytes.
Example: free-m

Command: df
Description: This command is used to list the server partitions and their respective spaces / mount points. It is used with the option-h so that the spaces are listed so the user can understand (in kilobytes, megabytes, gigabytes, etc …)
Example: df-h

Command: w
Description: This command can be used to list the users connected to the server by the SSH service, besides the load average and uptime.
Example: w

Commands File Handling

Command: cd
Description: This command is used to navigate directories. It is used to go to the root directory, followed by the command to be accessed or followed by 2 points to go back one level.
Example 1: cd
Example 2: cd / usr
Example 3: cd ..

Command: cp
Description: This command is used to copy directories and / or files. It is used with the option-R to copy all subdirectories of a directory.
Example 1: cp test.txt test_final.txt
Example 2: cp-R / home / directory / root

Command: ls
Description: This command is used to list files and directories in a directory etc … eg. It is used with the option-l for the data to be listed on a single line.
Example: ls-l

Command: rm
Description: This command is used to remove files and directories. It is used with the-R option to remove it from all files in a directory.
Example 1: rm test.txt
Example 2: rm-R / home / directory

Command: mv
Description: This command is used to move files and directories to other locations or to rename them.
Example 1: mv test.txt new_test.txt
Example 2: mv / home / directory / root

Command: mkdir
Description: This command is used to create directories.
Example: mkdir Test

Command: chmod
Description: This command is used to change the permissions of files and folders. It is used with the desired permission.
Example: chmod 777 test.txt

Commands: vi or peak (or nano)
Description: These three commands are used to edit files, they are text editors.
Example: vi test.txt
Example: peak test.txt
Example: nano test.txt

Command: tar
Description: This command is used to compress / decompress files with .tar, .tar.gz
Example (compress): tar-zcvf filename.tar.gz test.txt directory1 diretory2
Example (unpack): tar-zxvf file . tar.gz

Command: zip
Description: This command is used to compress files with. zip
Example: zip zip file test.txt directory1 diretory2

Command: unzip
Description: This command is used to decompress files with. zip
Example: unzip zip file

Command: du
Description: This command is used to calculate the total space of a directory or file. It is used with the-h option to display space in Megabyte
Example 1: du-h
Example 2: du-h test.txt

Search Commands

Command: find
Description: This command is used to find files and directories.
Example 1: find-name test.txt
Example 2: find / home / directory-name *. txt

Command: locate
Description: This command is used to find files and directories.
Example: locate test.txt

Command: grep
Description: This command is used to get an expression within a file.
Example: grep word test.txt

Package Installation (programs)

Command: yum
Description: This command is used to install packages (programs) on the server. It is used with the install option and the name of the package you want to install. It can also be used to update the packages already installed on the server as kernel and others.
Example (install): yum install package-name
Example (update): yum update package-name
Example (update all): yum update

Several commands

Command: exit
Description: This command is used to log out of the terminal / session where you are logged.
Example: exit

Command: reboot
Description: This command is used to restart the server.
Example: reboot

Command: shutdown
Description: This command is used to restart / shutdown the server. It is used with the option-r now to restart or-h now to shut down the server.
Example (restart): shutdown-r now
Example (off): shutdown-h now

Quick Commands

Command: cat / proc / cpuinfo | grep ‘model name’
Description: Use it to find out the processor model

Command: service-name service restart
Description: Use it to restart a service like mysql for example. You can also use it in place of the restart to start or stop start, stop a service respectively.

Command: wget www.site.com/archive.zip
Description: Use it to download files into the server.

Command: wall
Description: Use it to send a message to another user connected to the server via SSH. Put the message to the front of the command you want to send.

Leave a Reply