How To Open Gparted Terminal in Ubuntu?
Last Updated :
13 Sep, 2024
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

Step 3: After successful installation, to run GParted open the terminal run the below command, and type the root password if asked for.
gparted
How 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

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:

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

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
To print partitions in Linux3) 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
switch partitions in Linux4) 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
Show current diskAs 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
Creating partitionThe 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
Successfully created a partitionHere 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.
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.
Similar Reads
How to Open Multiple Terminals in Ubuntu
As a programmer or developer, we may feel insufficient to use only one terminal or window. We need more than one terminal to easily navigate through code files or do another installation task. This problem is also faced by the system administrators as well as the DB administrators because we may nee
5 min read
How to Open a TextEditor in an Ubuntu Terminal
Ubuntu and other Linux distributions using the GNOME desktop environment come pre-installed with a default text editor known as the GNOME Text Editor, commonly referred to as Gedit. Gedit is a user-friendly, lightweight, and powerful text editor with rich features, making it an ideal choice for casu
3 min read
How to Open Terminal in Linux?
The Shell or Command Prompt are common name for the Linux Terminal. The terminal was designed as a Linux File Browser, and this function is still carried out using it. You may traverse your files and undo changes made by using the Terminal as a File Browser. However, the very first step will be to O
4 min read
How to Run C program in Ubuntu
Learning to run a C program in Ubuntu is a great first step for anyone starting their programming journey or switching to a Linux-based system. Ubuntu offers a clean and powerful environment to write, compile, and execute C code all from the terminal. In C, this guide will show you how to get starte
4 min read
How to install php70-gd on Ubuntu ?
Graphics Draw or GD library is an open-source library for dynamic creation of images. It is used to create and manipulate image files in a variety of different image formats, including GIF, PNG, JPEG, WBMP, and XPM. This package for PHP 7 can be installed via the PPA by Ondrej Surý. To install php7.
2 min read
How to open ISO files on Ubuntu Linux
ISO files are disc image archives commonly used to distribute software and operating systems. There are two main ways to access the contents of an ISO file on Ubuntu Linux: using the graphical user interface (GUI) or the command line. What is an ISO File?An ISO file or an ISO image is a single data
5 min read
How to Install Tilix Terminal Emulator in Ubuntu/Fedora/Arch Linux?
A terminal emulator is a software that helps in interacting with the computer machine and perform operations using commands. Tilix is a tiling terminal emulator formerly known as Terminix. It is an enhancement over a regular terminal and provides some important features. Features of Tilix Terminal E
3 min read
How to Install apt-file package on Ubuntu?
Apt-file is a software program that indexes the contents of packages in your accessible repositories and allows you to search for a certain file among all available packages. Apt-file is a command-line utility for searching files in APT packages. You may search for which package a file is in or show
2 min read
How to Install Gvim on Ubuntu
The text editor known as Vim, which stands for "Vi Improved," is a traditional one that is primarily used by programmers. It is commonly referred to as a "programmer's editor." It was created a long time ago, but it is still a well-liked editor that outperforms many rivals. It can be used for everyt
5 min read
How to Use Terminal in Sublime Text Editor ?
Well in Visual Studio Code we get a direct Option for opening Terminal, Unlike Sublime Text editor. Sublime is Simple and free to use, Light on memory, and can easily work with multiple projects. In this article, we will see how to use Terminal in a Sublime Text Editor. This article will answer all
3 min read