How to create zip file of a folder using SSH


Step 1 Navigate to the directory where the folder is located. Let’s say we want to create zip file of following folder: /home/lophost/folder_name So, we will navigate to /home/lophost directory. cd /home/lophost Step 2 Now run following command to create zip file of folder /home/lophost/folder_name zip -r folder_name/ Done!!

How To Create Database Backup from SSH


Step 1: Login to your server via SSH as root user. Step 2 Use below command to create / export a database. mysqldump database_name > /backup/database_name.sql Where database_name -> The name of database of which you want to create backup. /backup/database_name.sql -> Location and file name of database backup file.

How to search some text in a file via SSH

Let’s say we want to search for text lophost in file /var/log/messages We can do this using command grep. Login to your server via SSH and run following command grep lophost /var/log/messages

How to rename a file via SSH

On a Linux server you can rename a file using mv command. Let say you want to rename file-one.txt to file-two.txt Use following command for this. mv file-one.txt file-two.txt Another example. Suppose we want to rename ravi.txt to lophost.txt located in /var mv /var/ravi.txt /var/lophost.txt

How to List All Open / Listening Ports on a Server

You should open only limited ports for incoming and outgoing traffic on a server. You can use firewall like CSF firewall to open only trusted ports on a server. If you want to check all open/listening ports that your server is using, run below command via SSH: netstat -an OR netstat -tulp OR netstat -tulpn […]

How to Start, Stop and Restart MySQL from SSH

Using below commands you can start, stop and restart MySQL from SSH. Login to your server as root via SSH, and run following commands. Start MySQL service mysql start OR /etc/init.d/mysql start Stop MySQL service mysql stop OR /etc/init.d/mysql stop Restart MySQL service mysql restart OR /etc/init.d/mysql restart Status of MySQL If you want to […]