35 Useful command to help you manage the VPS or Dedicated Server

These are 35 Most Useful command to help you manage the VPS (Virtual Private server) or Dedicated Server.

This should help you in daily work on  the server.  I have included command for all major Linux distribution like CentOS ,Ubuntu

1)How to connect to Server using putty

Download Putty here

a)Provide Hostname or IP address of the VPS or dedicated server

b) Choose SSH or telnet

c) For SSH, it will ask for verification of keys

d) Provide username and password and  login to the system

2) Check Linux Distribution

cat /etc/*-release

3) How to reboot the VPS

reboot

4) How to find uptime of the box
Uptime

5) How to check the filesystem space
df -k or df -h

6) How to check the CPU and memory

Use TOP command

7) How to update package

CentOS distribution

yum update

Ubuntu distribution

$ apt-get install

8) How to list the file

Use ls command

ls -lrt : it will list files in order of timestamp

ls -l: it will list file

9) How to locate the configuration files

locate my.cnf

locate httpd.cnf

10) How to start and Stop httpd service

how to start and stop httpd service

11) How to stop and start the mysql service

How to start and stop mysql on Linux

12) How to edit the file 

We can use either vi and Nano editor for it

check out below tutorials for vi

Unix Tutorial :vi editor Part -1

Unix Tutorial : vi tutorial -2

vi tutorial -3

for Nano,below command will be of help

nano <file name> : This will open filename for edit.

13) How to create directory

mkdir command is used to create directory

mkdir image

14) How to remove the file

rm command can be used to delete the file

rm <file name>

15) How to change password for the username

As root user

passwd <user name>

As user only

passwd

16) How to remove the directory

rmdir can be used to delete the directory. Directory must be empty for  deletion from this command

rmdir <directory name>

17) How to kill a process

Sometimes , you may want to kill a  stuck process. You can use kill command to do it. We need to get the PID of the process and then kill using below command

kill <pid>

18) How to search for a string across the files

You can use grep command to do it. Read below detailed article on it

How to use grep command in Unix and Linux with examples

19) How to backup the directory or folder

You may often want to backup directory or folder before performing changes on the system . We can use tar command for this. It is a very useful utility to perform backup

how to tar a directory in Linux

20) How to check the content of the file

We can use cat command for it

cat <file  name >

If the file is large , we can use more here to scroll as required

cat <file name>|more

21) How to download files from external locations

Use wget command.

wget http://wordpress.org/latest.tar.gz

22)  How to change ownership of the files or directory

chown can be used to do it

chown tech:tech <filename>

chown -R tech:tech <directory name> : It will change ownership in directory recursively

23)  How to change permission of the files

We can use chmod command for that

chmod 755 <file name>

24)  How to find the system name and version

uname -a

25) How to find the version of Ubuntu running on the system

cat /etc/issue

26) how to walk into the directories

We use cd command to walk into directories

cd <directory name>

To come out of directory, we use

cd ..

27) How to copy the files

Use cp command to do it

cp <file name1> <filename 2>

28) How to rename the files or directories

Use mv command

mv file1 file2

29) How to check for Port usage in the system

netstat -anp|grep <port no>

30) How to shutdown the box

Type shutdown command

31) How to check what all users are logged into the box

Use finger command

finger

32) How to check for running processes on the system

Use ps command

ps -ef|grep <process name>

ps -ef|grep mysql

33) How to check the used and free RAM on the box

Use free command

free

34) How to enable service start on reboot ?

We can use chkconfig or systemctl command for this

chkconfig mysqld on

systemctl mysqld enable

35) How to find files across directories

We can use find command

Useful find command in Unix with example

Leave a Reply