The first thing you need to do after installing a new SSD or hard disk is to partition it. A drive needs to have at least one partition before you can format it and store files on it.
In Linux, there are several tools that you can use to create partitions, with
fdisk being the most commonly used one.
In this article, we will talk about the
fdisk is a menu-driven command-line utility that allows you to create and manipulate partition tables on a hard disk.
Be aware that
fdisk is a dangerous tool and should be used with extreme caution. Only root or users with
[sudo](https://linuxize.com/post/sudo-command-in-linux/) privileges can manipulate the partition tables.
To list the partition table of a device, invoke the
fdisk command with the
-l option, followed by the device name. For example to list the
/dev/sda partition table and partitions you would run:
fdisk -l /dev/sda
When no device is given as an argument,
fdisk will print partition tables of all devices listed in the
fdisk -l Disk /dev/nvme0n1: 232.91 GiB, 250059350016 bytes, 488397168 sectors Disk model: Samsung SSD 960 EVO 250GB Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: gpt Disk identifier: 6907D1B3-B3AB-7E43-AD20-0707A656A1B5 Device Start End Sectors Size Type /dev/nvme0n1p1 2048 1050623 1048576 512M EFI System /dev/nvme0n1p2 1050624 34605055 33554432 16G Linux swap /dev/nvme0n1p3 34605056 488397134 453792079 216.4G Linux filesystem Disk /dev/sda: 465.78 GiB, 500107862016 bytes, 976773168 sectors Disk model: WDC WD5000AAKS-0 Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x0001cca3 Device Boot Start End Sectors Size Id Type /dev/sda1 2048 976771071 976769024 465.8G 83 Linux
The output above shows the current partition tables of all devices that are attached to your system. Generally, SATA device names follow the pattern
/dev/sd[a-z], while NVMe device names have the following pattern
To start partitioning the drive, run
fdisk with the device name. In this example we’ll work on
The command prompt will change, and the
fdisk dialogue where you can type in commands will open:
Welcome to fdisk (util-linux 2.34). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help):
Changes you make to the partition table won’t take effect until you write them with the
w command. You can exit the
fdisk dialogue without saving the changes using the
Dig Command Line Options and Examples
Here is the frequently used command line options and example’s of dig command.
1. Basic Dig Command
A basic dig command accept domain name as command line parameter and prints Address record.
2. Query With Specific DNS Server
The default dig command queries to dns server configured on your system. For example, the Linux systems keep default DNS entry in /etc/resolv.conf.
3. Print Short Answer
Use +short command line option to print result in short form. This is basically useful with the shell scripting and other automation tasks.
4. Print Detailed but Specific Result
Use +noall with +answer to print detailed information but specific. This will print only answer section including few more details as a result.
#linux commands #command #dig #dig command #useful examples #linux
mv Command Examples
Below is the basic mv command examples on Linux terminal.
#linux commands #command #mv #useful example #mv command #linux
date Command Examples
Show date time in UTC/GMT
View past dates on specific days
View future dates
View date in other timezone
Print date in specific format
View file modification time
#linux commands #command #date #linux
#linux commands #terminal #funny commands #linux
In this remove or delete directories and files linux tutorial guide, you will learn how to remove empty directory and non empty directory linux using command line. And as well as how to remove/file files linux using command line.
So, this tutorial guide will show you you how to use the
rmdir commands to remove or delete files and directories in Linux with and without confirmation.
#how to delete directory in linux #how to remove non empty directory in linux #remove all files in a directory linux #linux delete all files in current directory #linux delete all files in a directory recursively #delete all files in a directory linux