I want to mount my USB to a mount point which holds the UUID name. But I don't know how to express this in a command line!
Can someone help me how to do it?
I have searched and found that I have to run:
blkid
then a command which searches for a USB flash or hard disk drive, then something like
blkid | tail -n 1 | cut -f4 -d' '
but tail
is wrong because I don't know the number of USB I have!
Is there a way to tell it to just get me the lines with USB type?
Best Answer
Reading the man page shows you can use options to get what you want:
gives (for me):
You can extract the UUID with
cut -d'"' -f2
:The
blkid
options are preferable because a USB drive can have e.g. a label which would give a different output of with plainblkid
invocation.EDIT: further reading of the man page shows
blkid
can do what you want on its own: