4 commands to know data from our HDD or partitions

I haven't posted here in a long time, this doesn't mean I've forgotten DesdeLinux Far from it, not at all... it's just that some things have changed on a personal level and my time is now much less than it was before.

However, in this time I have learned some new commands, commands that I want to share with you 🙂

I will start with two that as the title of the post says, they show us data about our hard drives and partitions.

Command Sudo LSSCSI

The first is: Sudo LSSCSI (they need to install this package for the command to be available)

Related article:
With Terminal: Size and Space Commands

Command sudo lsblk -fm

The second is: sudo lsblk -fm

Here is a screenshot of the output of each one:

There are many other ways to obtain these and other data from our partitions and HDDs, they are not only these two commands ... but, as personally I have seen little mention of them, that is why I decided to share them 🙂

Likewise, I leave other commands that can provide you with a lot of similar data:

Command sudo fdisk -l

Here is the screenshot:

Another command is the typical df -h

how to
Related article:
How to kill processes easily

Command df -h

Here is the screenshot:

Anyway, I hope you find it useful 🙂

Do you know of any other command that provides data that these do not? ...

regards


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Carper said

    Thank you very much for the information, greetings.
    PS: you were already missed.
    XD

    1.    KZKG ^ Gaara said

      hahahahaha thank you 🙂
      Yes ... I'm quite offline lately, as Perseus said in a tweet ... "bro, you heard the sirens singing and we have lost you because of them, a minute of silence for the fallen friend TT"

      LOL !!!

      1.    Hugo said

        Ah, so was it the singing of the sirens that kept you busy? 😉

        1.    elav said

          Poor baby .. he doesn't have earplugs hahaha

          1.    Hugo said

            Well, the reaction is understandable, there are mermaids that anyone falls for, hehe

            1.    elav said

              I already tell you !! 😀


  2.   Hugo said

    The lsblk command seems very useful, thanks because at least I was certainly unaware of it.

    As for other commands, because in Linux, you can always find useful things:

    sudo blkid
    sudo cat /proc/partitions
    sudo cat /etc/mtab
    sudo lshw -short -class storage -class disk
    sudo lshw -class storage -class disk | less
    sudo hwinfo --disk | less
    sudo parted /dev/sda print
    sudo hdparm -I /dev/sda | less
    sudo smartctl -a /dev/sda | less

    For LVM-type partitions there are other useful commands:
    sudo pvdisplay
    sudo lvdisplay

    You can also find curious scripts, like this one that uses only standard tools like find and grep:

    for file in \
    $(find /sys/block/[sh][dr]*/device/ /sys/block/[sh][dr]*/ -maxdepth 1 2>/dev/null |
    egrep '(vendor|model|/size|/sys/block/[sh][dr]./$)'| sort)
    do
    [ -d $file ] && \
    echo -e "\n -- DEVICE $(basename $file) --" && \
    continue
    grep -H . $file | \
    sed -e 's|^/sys/block/||;s|/d*e*v*i*c*e*/*\(.*\):| \1 |' | \
    awk '{
    if($2 == "size") {
    printf "%-3s %-6s: %d MB\n", $1,$2,(($3 * 512)/1048576)
    } else {
    printf "%-3s %-6s: ", $1,$2
    for(i=3;i<NF;++i) printf "%s ", $i; print $(NF)
    }
    }'
    done

  3.   Hugo said

    By the way, df can display a bit more information invoked like this:

    df -hT

  4.   Hugo said

    Yet another command for the collection:

    sudo systool -c block -v | less

    1.    KZKG ^ Gaara said

      O_O… damn, thanks for such a lot of commands LOL !!!

  5.   RudaMale said

    Very good lsblk, thanks!

    1.    KZKG ^ Gaara said

      Thanks to you for commenting 🙂

  6.   dhunter said

    sudo parted -l

    1.    KZKG ^ Gaara said

      Great, I didn't know this one 😀
      Thanks

  7.   kike said

    Very good, I only knew "fdisk -l". The one that I liked the most is "lsblk", it is the one that best shows the information.

    1.    KZKG ^ Gaara said

      Thanks for commenting 🙂

  8.   ignorant said

    I always handled with df -h / and disk -l, the others I ignored.

  9.   anonymous said

    Weird that nobody knows that about:
    # blkid -o list
    gives the information well tabulated and of course lsblk that I have made an alias in my .bashrc
    $ cat .bashrc | grep -i aliases
    alias lsblk = »lsblk -o RM, RO, MODEL, NAME, LABEL, FSTYPE, MOUNTPOINT, SIZE, PHY-SEC, LOG-SEC, MODE, OWNER, GROUP, UUID

    Thanks for such contributions.

  10.   Raiden said

    Thanks for the commands, every day of at least 20 minutes of reading, is a day spent

    1.    KZKG ^ Gaara said

      Thanks to you for commenting 😀

  11.   Rodolfo said

    Very good, it would also be good if you recommend that for more details look at the man page of each command, greetings.

  12.   Victor said

    To know the temperature ...
    root @ darkstar: / home / salvic # smartctl -A / dev / sdc | grep '194' | awk '{print $ 10}'
    34

  13.   wow said

    great "lsblk", did not know! Very useful since whenever I want to access that information I end up using fdik -l which is more cumbersome, and for the UUID I do a "ls -lha / dev / disk / by-UUID" and I start to identify myself. With «lsblk» everything is united and clean in a single command and taking up little space in the terminal 🙂 Thanks for the contribution

  14.   Marcos_tux said

    Awesome

  15.   fedex5 said

    tremendous!

    useful and simple thanks

  16.   Edison quisiguina said

    Thank you very useful post 🙂

    Blessings.

  17.   Fausto Fabian Garcete said

    Excellent contribution. It really served me well. the shared article.

  18.   Michael Loyo said

    Thank you very much, the commands helped me.

  19.   Miguel said

    Thank you very much for sharing this information.

    It came to me great.

  20.   Predatux said

    Hello everyone, I would like to know if there is any command to identify the partitions of form (0,2), (4,3), etc.
    I have a little problem starting Remix OS from a sde6 hard drive partition, which I understand to be (4,6), but the boot always fails me saying that it is not correct.

    Thanks and regards.

  21.   Diego said

    Hello everyone, I wanted to ask you the following, I have a computer where I have a virtualized linux and one of the disks that it has mounted I had to externder the available space, that is ok but I have to extend the partition because from linux you can still see the previous space I had and not the new one, so I understand that you have to extend the partition so that it is reflected later when you mount it again in Linux. The point is that there I have backups and I should not lose the info there. Could you help me by telling me which is the correct command to expand the partition since it went from having 128 GB to 1 TB, and once this is done, mount it on linux. The type of partition appears to me to be ext3, I await your comments, Thanks in advance.

  22.   wolfgimp said

    A collaboration between Linux users is always appreciated.
    As my father used to say, if it's good and concise, it's doubly good.