Sunday, October 1, 2023

Resize EBS volume without rebooting in AWS ?

 This article guides you to resize the EBS volume without rebooting

1. Modify volume in AWS EC2 UI

After login to AWS console, navigate to EC2 -> Elastic Block Store -> Volumes. Click on the volume that you wist to resize, then select Actions -> Modify Volume. It will open a popup.

i) Enter the new size in the size field. Lets says we are resizing from 8 GB to 150 GB.

ii) Click Modify button

iii) Click Yes button in the confirm popup.

Now the volume has been resized, but it won't reflect in the system. We need to do some more steps to make it work.

2. Resize the partition

Lets ssh into the machine.

i) List block devices attached to the machine.



loop0     7:0    0   91M  1 loop /snap/core/6350

loop1     7:1    0   18M  1 loop /snap/amazon-ssm-agent/930

loop2     7:2    0 89.4M  1 loop /snap/core/6818

loop3     7:3    0 17.9M  1 loop /snap/amazon-ssm-agent/1068

xvda    202:0    0  150G  0 disk

└─xvda1 202:1    0    8G  0 part /

You can see that xvda1 is still 8 GB. Lets increase the partition to disk size.

ii) Install cloud-guest-utils

apt install cloud-guest-utils

iii) Grow the partition

growpart /dev/xvda 1

iv) Let's check the partition size (you can see /dev/xvda1 is now 150 GB):



loop0     7:0    0   91M  1 loop /snap/core/6350

loop1     7:1    0   18M  1 loop /snap/amazon-ssm-agent/930

loop2     7:2    0 89.4M  1 loop /snap/core/6818

loop3     7:3    0 17.9M  1 loop /snap/amazon-ssm-agent/1068

xvda    202:0    0  150G  0 disk

└─xvda1 202:1    0  150G  0 part /

3. Resize the file system

i) Check the file system size. (Still it shows only 8 GB)

df -h

Filesystem      Size  Used Avail Use% Mounted on

/dev/xvda1      7.8G  4.9G  2.6G  62% /

ii) Resize the filesystem

resize2fs /dev/xvda1

iii) Check after resizing

df -h

Filesystem      Size  Used Avail Use% Mounted on

/dev/xvda1      146G  4.9G  141G   3% /

So we have increased the EBS volume without rebooting and zero downtime.

Monday, February 7, 2022

How to Install ranger in Ubuntu 18.04?

How to Install ranger in Ubuntu 18.04?

ranger - visual file manager

Ranger is a free and open-source command-line file manager for Linux. It comes with a minimalistic text-based user interface and VI key bindings support. The main design goal of this file manager is switch directories and browse files in a quick and easy way. Some of the main features are preview the selected file or directory and automatically determining file types and running them with correct programs. It supports VIM like hotkeys, UTF-8, multi-column display, mouse support, builds in Tabs, and bookmarks support.

Features of Ranger

  • Multi-column display

  • Common file operations (create/chmod/copy/delete)

  • Preview of the selected file/directory

  • VIM-like console and hotkeys

  • A quick way to switch directories and browse the file system

  • Tabs, Bookmarks, Mouse support

  • Video thumbnails previews

Install Ranger File Manager on Ubuntu

sudo apt-get update

sudo apt install ranger -y

Type command 


To change directories, you can use the arrow keys: Press Right to go into the currently selected directory, or Left to go into the parent directory. Similarly to select items in the middle panel, use the Up and Down arrow keys. There are number of commands you can use to perform different operations on the files but here are some of the most common commands.

For navigation

  • <Ctrl>-f = Page down

  • <Ctrl>-b = Page up

  • gg = Go to the top of the list

  • G = Go to the bottom of the list

  • H = Go back through navigation history

  • h = Move to parent directory

  • J = Page down 1/2 page

  • J = Move down

  • K = Page up 1/2 page

  • k = Move up

  • L = Go forward through navigation history

  • Q = Quit

Working with files

  • i … Display the file

  • E|I … Edit the file

  • r … Open file with the chosen program

  • cw … Rename file

  • / … Search for files (n|p jump to next/previous match)

  • dd .. Mark file for cut

  • ud … Uncut

  • p … Paste file

  • yy .. Copy/yank file

  • zh … Show hidden files

  • <space> = Select current file

  • :delete = Delete selected file

  • :mkdir … Create a directory

  •  :touch … Create a file

  •  :rename … Rename file

For More options use

man  ranger


Thursday, December 23, 2021

RabbitMQ How to Purge All Queues ?

 There are some situations where you may need to clear or purge all messages from a queue. 

Using Command Line:

You can purge or clear a queue with the following command:


$ rabbitmqctl purge_queue queue_name

Purge Queue from the Web UI

Click on the Queues tab.

Click on the name of the queue that you want.

Expand the “Purge” section.

Click the “Purge Messages” button.

Click “OK”.

Purging all queues 

$ rabbitmqadmin -f tsv -q list queues name > list1.txt

$ for i in `cat list1.txt`; do rabbitmqctl purge_queue "$i" ; done 

Tuesday, April 27, 2021

How to Install XAMPP on linux ?

 What is XAMPP?

XAMPP is the most popular PHP development environment.

XAMPP is a completely free, easy to install Apache distribution containing MariaDB, PHP, and Perl.

Download the latest version from here


After download change the permission :

chmod 755

sudo ./

If it linux server Press all Yes during installation. 

If it is the desktop version of linux press next during installation. 

Now need to change the permission for htdocs :

cd /opt/lampp/

chmod -R 777 htdocs

cd htdocs

create one demo.php file and write code :


echo “Welcome to linux for freshers” 


To start the XAMPP service :

sudo /opt/lampp/lampp start

Starting XAMPP for Linux 7.4.16-0...

XAMPP: Starting Apache...ok.

XAMPP: Starting MySQL...ok.

XAMPP: Starting ProFTPD...ok.

To run the php file:




To stop the XAMPP service:

sudo /opt/lampp/lampp stop

Stopping XAMPP for Linux 7.4.16-0...

XAMPP: Stopping Apache...ok.

XAMPP: Stopping MySQL...ok.

XAMPP: Stopping ProFTPD...ok.

Friday, April 23, 2021

how to send broadcast messages to all currently logged on users in linux ?

 Wall displays the contents of a file or, by default, its standard input, on the terminals of all currently logged-in users. The command will cut over 79 character long lines to new lines. Short lines are white space padded to have 79 characters. The command will always put the carriage return and new line at the end of each line.

Only the super-user can write on the terminals of users who have chosen to deny messages or are using a program that automatically denies messages.

Reading from a file is refused when the invoker is not a superuser and the program is suid or sgid.

Usually, system administrators send messages to announce maintenance and ask users to log out and close all open programs. The messages are shown to all logged-in users with a terminal open.


wall [-n] [-t timeout] [message | file]

The most straightforward way to broadcast a message is to invoke the wall command with the message as the argument:


wall "The system will be restarted in 10 minutes."


Broadcast message fromroot@linuxforfreshers (pts/0) (Mon Jan  4 13:22:07 2021):

The system will be restarted in 10 minutes.

The message will be broadcasted to all users that are currently logged in.

To suppress the banner and show only the text you types to the logged-in users, invoke the command with the -n (--nobanner) option:


wall -n "The system will be restarted in 10 minutes."


The system will be restarted in 10 minutes.

If you want to write multi-line messages, invoke the command without an argument:


The wall command will wait for you to enter text. When you’re done typing the message, press Ctrl+D to end the program and broadcast the message.

You can also use the here-string redirection or pipe the output of another command to wall. Here is an example showing how to use the echo command to broadcast multi-line messages:


echo "The system will be restarted in 10 minutes. \nPlease save your work."  | wall


Broadcast Message from root@linuxforfreshers                                       

        (/dev/pts/1) at 13:36 ...                                              


The system will be restarted in 10 minutes. \nPlease save your work.        

Broadcasting a Message From a File 

If you are regularly sending the same messages, you can write each one of them to a file, so that you don’t need to re-type the same text. wall reads from the file only when invoked as root.

To broadcast the contents of a file, invoke the wall command followed by the file name:

cat message1_file.txt

The system will be restarted in 10 minutes.


wall message1_file.txt


Broadcast message from root@linuxforfreshers (pts/0) (Mon Jan  4 13:30:07 2021):

The system will be restarted in 10 minutes.