Posts Under Category: 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 file_name.zip folder_name/

Done!!

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.

Yum command is one of the most used and important command on a Linux system. Here is how you can see the history of Yum command on a Linux server.
read more

If you want to know the version of yum installed on your Linux server, here is how you can find.
read more

The main user / administrator of a Linux server is root. Here is how you can create a new user on your CentOS server / VPS.

Login to your server as root as run following command to create a new user named ravi.

/usr/sbin/adduser ravi

Now set password for new user ravi

passwd ravi

Screenshot

add-new-user

Done!!

read more

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

read more

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

read more

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

The command will print a list of all open ports, protocol using the port, local address and foreign address (IP).

Our Recommended VPS Hosting

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 know the status of MySQL on your server, run below command.

service mysql status

read more

Use following command to know the hostname of your server.

hostname

You should run above command in SSH as root user.

Our Recommended VPS Hosting