Open In App

How To Open Gparted Terminal in Ubuntu?

Last Updated : 15 Nov, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Gparted is a GUI application that is useful for creating, editing, and deleting disk partitions. Gparted has a GUI interface which makes this tool easy to use for individuals who prefer GUI interfaces rather than the command line.

How to install Gparted on Linux

Step 1: Update the system

sudo apt-get update

Step 2: Now, run the below command to download Gparted

sudo apt-get install gparted

Screenshot-from-2023-10-08-20-42-42-min

Step 3: After successful installation, to run GParted open the terminal run the below command, and type the root password if asked for.

gparted

Screenshot-from-2023-10-08-23-15-57How to open Gparted in the terminal?

The above-mentioned steps show how you can use the GParted GUI interface but how to use GParted in the terminal?

A terminal version of gparted provides more power to the user to do different operations. Here’s how you run and use gparted in terminal means on the command line.

Using gparted on the command line

Step 1: Open your terminal and give the root privileges

sudo su

After executing this command, it will ask you to enter your root password just enter your root password

Step 2:

parted

Screenshot-from-2023-10-09-00-03-05

The ‘parted’ command is the command that is used to execute gparted on the command line and use gparted operations on the command line.

After this, you can now use GParted on the command line and do operations using parted commands.

Some useful commands to use are parted

Write these commands after entering the parted terminal window which will look like this:

Screenshot-from-2023-10-09-00-03-05

Now, here are some of the commands that will help you to work around with parted

1) List all commands

This command shows you all the necessary commands that are required to do disk operations like creating, deleting partitions, etc.

It will show all the commands and help you to use part of the command line and perform operations. This is useful if you are stuck and want to perform different operations.

(parted) help

Screenshot-from-2023-10-09-00-09-43-min

Note: just enter ‘help’ and hit enter it will show you all the commands.

2) To list the disk partitions

‘print’: this command lists all the partitions that are on the disk, just write ‘print’ and hit enter. Remember that you have to be in a parted terminal to successfully run the command.

(parted) print
Screenshot-from-2023-10-09-00-15-19

To print partitions in Linux

3) Select a partition in Linux

If you have more than one hard disk, you can easily select one of the disks and perform operations on that particular disk. As I have only one disk I will select that disk by using the below command. I will use ‘/dev/sda’ as my disk to perform operations.

To check your disk use ‘print’ command to check your disk and then you can select the specific disk for performing operations.

To select or switch between disks:

select /dev/sda
Screenshot-from-2023-10-09-12-42-54

switch partitions in Linux

4) Create a partition in Linux with a parted

Parted in the command line can be used to create primary and logical partitions. In, this article I will show you how you can create a primary partition and the steps are the same for creating a logical partition.

Before, creating a partition make sure you are using the right disk (select the right disk) to perform operations.

To check the partition use ‘print’

(parted) print
Screenshot-from-2023-10-09-13-19-14-min

Show current disk

As we can see, I’m using my drive which has an available space of 512GB. But first, we have to give a label type to the new disk and then we create a partition (provide size, etc).

The command which is used to label a new disk:

(parted) mklabel msdos

‘msdos’ is the common disklabel for PCs. This label is commonly used for creating label if you are going to create partition on your disk.

Now, to create a new partition use the ‘mkpart’ command:

The below command will ask some information before creating a partition.

(parted) mkpart
Screenshot-from-2023-10-09-14-10-47-min

Creating partition

The unit of size is in MB so 10000 =10GB is the size provided to the created partition.

  • Partition type: primary – type primary in partition type
  • start: 1 – means starting size of the partition
  • end: 10000 – ending size of the partition that is 10GB in this case

After this operation, the exit parted with the “quit” command. We will format our new partition in the ext4 file system using mkfs. To make this happen run the following command:

# mkfs.ext4 /dev/sdb1

Note: it is important to select the right disk and partition before executing the above command as it will format that partition and change the file system to ext4.

Now let’s see the results

Screenshot-from-2023-10-09-14-38-13-min

Successfully created a partition

Here we can see we have successfully created a partition using parted and this is how you can work with parted in the command line to perform disk operations.

Frequently Asked Questions

Q1. Which is better Parted or Gparted?

Both tools are great for managing disk on Linux. Parted is more powerful and provides more control as it is a command line whereas Gparted works the same and provides all the options as Parted for managing disk but it has GUI interface so that users who like to use GUI tools over command line can use gparted.

Q.2 Is parted available for Windows?

No. Parted and Gparted both are only for linux and for debian OS (Ubunut, fedora etc).

Q3. I’m new to linux which tool should i use Parted or Gparted?

If you are new to linux it is better to use Gparted because command line tool if not used correctly might cause harm in your system. In this case your data could be erased. That is why it is recommended to use Gparted to those who are new to Linux.

Q4 Can i create new partition with the help of Gparted?

Yes you can do disk management with Gparted and all the task which you can do with Parted. The key difference is Gaprted has GUI interface whereas Parted doesn’t.

Q5. Is there any alternatives other than Gparted and Parted?

Yes there are like fdisk, cfdisk, sfdisk. But however, Gparted is considered more helpful by many linux users.

Q6. Can i make bootable images using Gparted?

No. You should use gnome disk utility tool if you want to create bootable USBs.

Q7. Is GParted free and open source?

Yes, GParted is free and open source software, distributed under the GNU General Public License (GPL). This means you can use it, modify it, and distribute it freely.

Conclusion

Parted is useful and powerful command line tool for managing disks. However, it is better to get better knowledge of parted before using it as it can delete your whole data if something went wrong. That’s why use parted with caution and if you are new to linux use gparted instead of parted as gparted has Interactive GUI interface which will be helpful to perform certain operations on the disk with more easy and efficient control.



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads