commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
This was tested on Ubuntu 12.04 (Precise) LTS Server. It returns the name of the symlink within /dev/disk/by-id for the physical drive you specify. Change /dev/sda to the one you want, and replace ata- with scsi- or the appropriate type for your drive.
I used this to pre-configure grub-pc during a non-interactive install because I had to tell it which disk to install grub on, and physical disks don't have a UUID such as that blkid provides.
There are 6 alternatives - vote for the best!
Substitute for #11720
Can probably be even shorter and easier.
example of the use of zsh glob qualifiers:
"@" = the symlink qualifier
"" = first element
:t = remove leading path components, leaving the tail
Requires that bash has extglob enabled: shopt -s extglob
If you can do better, submit your command here.
You must be signed in to comment.