Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hi please explain to me this command I found about formatting drives in linux:

yes | mkfs -T ext2 $(mount | grep "/ " | cut -d" " -f1)

share|improve this question
up vote 2 down vote accepted

It gets all file systems and their mountpoints (mount), selects the line with the partition mounted at / (root, grep "/ "), and interprets it as space delimited data, selecting the first column (i.e. the device, cut -d" " -f1).

Then it converts this partition to ext2 file system (mkfs -T ext2, see Wikipedia) and confirms all questions that might come up (yes).

In short, it makes the partition that is mounted as / into ext2.

share|improve this answer
thanks daniel beck – Raymond Go Ho Feb 22 '11 at 6:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.