Posts Under Category: SSH

SSH is the fastest and easiest way to delete multiple files or a complete folder on a server. Please take maximum care while deleting a file or folder.

How to delete a file via SSH

Use rm command to delete a file.
Suppose you want to delete /home/filename.txt file. To delete this file, execute following command in SSH:

rm /home/filename.txt

How to delete a folder via SSH

Suppose you want to delete /home/foldername folder and all files/folders inside this directory.
For this execute following command in SSH:

rm -rf /home/foldername/

Our Recommended VPS Hosting

Nano is a small and easy to use text editor for Linux. By default nano might not be installed on your Linux / CentOS / RedHat / CloudLinux / cPanel servers.

How to install NANO

Login as root to your server via SSH, and execute following command:

yum install nano

How to un-install / remove NANO

If for any reason you want to remove nano text editor from your server, execute following SSH command.

yum remove nano

How to know current version of nano installed

Following SSH command will show the version of nano installed on your server.

nano –-version

Our Recommended VPS Hosting

Tail is a very useful SSH command to read a file. Its like cat command but it only reads a file. Tail command by default will show last 20 lines of a file.

Example

tail /var/log/messages

This will show the last 20 lines of /var/log/messages

tail -f /var/log/messages

This will show last 20 lines of /var/log/messages and will also update while it’s being changed / updated.

tail -100 /var/log/messages

This will show the last 100 lines of /var/log/messages

How to exit from tail command

Simply press following key on your keyboard.

ctrl + c

Our Recommended Dedicated Server

Sometimes you may need to kill all process of a particular user. This can be done using following SSH command.

pkill -u username

The above SSH command will all process by user username. Like if you want to kill all process by user ravi, change username to ravi.

ssh-pkill

You can also use killall command to kill all processes of a user.

killall -u username

Our Recommended Dedicated Server

Use below SSH command to find detailed memory information / usage of your server / VPS. It will show you total memory, free memory, used memory, cached memory etc.

cat /proc/meminfo

This command is very useful as it shows large amount of valuable information about the server RAM usage, like:

  • Total usable RAM
  • Free memory
  • Buffer memory
  • Cached memory
  • Swap used as cache memory
  • Total cache memory that is active
  • Total cache memory that is free
  • Total amount of memory in the high region
  • The total amount of non-highmem memory.
  • The amount of free memory of the low memory region.
  • Total amount of physical swap memory.
  • Dirt: The total amount of memory waiting to be written back to the disk.
  • Writeback: The total amount of memory actively being written back to the disk.
  • etc..

ssh-proc

Another useful command

Another very good SSH command to find detailed memory information is:

vmstat -s

Our Recommended Dedicated Server

You can check the centOS version installed on your dedicated server / VPS using any of the following SSH command.

cat /etc/*release*

cat /etc/redhat-release

cat /etc/centos-release

centos-version

Our Recommended VPS Hosting

Top command in SSH is used to display top process using high CPU.

To exit from top, just press following key on your keyboard.

q

Our Recommended Dedicated Server