To format a hard disk in Linux, you can use the "mkfs" command, followed by the type of filesystem you want to create and the device file for the hard disk.
For example, to create an ext4 filesystem on the hard disk at /dev/sda, you can use the following command:
sudo mkfs.ext4 /dev/sda
This will create a new ext4 filesystem on the hard disk, overwriting any existing data.
You can use other filesystem types with the "mkfs" command, such as "ext3", "xfs", or "ntfs". For example:
sudo mkfs.ext3 /dev/sda sudo mkfs.xfs /dev/sda sudo mkfs.ntfs /dev/sda
Note: Formatting a hard disk will erase all data on the disk. Make sure you have a backup of any important data before formatting the disk.