Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

 
discard

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.