Commands tagged hardware (17)

  • Yields entries in the form of "/dev/hda1" etc. Use this if you are on a new system and don't know how the storage hardware (ide, sata, scsi, usb - with ever changing descriptors) is connected and which partitions are available. Far better than using "fdisk -l" on guessed device descriptors. Show Sample Output


    13
    hwinfo --block --short
    Schneckentreiber · 2009-04-24 11:13:31 10
  • Loop is needed if you have more then one card. Show Sample Output


    4
    for I in `/sbin/lspci |awk '/VGA/{print $1}'`;do /sbin/lspci -v -s $I;done
    houghi · 2010-10-26 19:02:26 6
  • This command lists the names of your USB devices connected and what file in /dev they are using. It's pretty useful if you don't have an automount option in your desktop or you don't have any graphical enviroment. Show Sample Output


    2
    ls -la /dev/disk/by-id/usb-*
    casidiablo · 2009-11-25 16:02:06 3
  • probably only works if you have one graphics card. used this: http://www.cyberciti.biz/faq/howto-find-linux-vga-video-card-ram/ as reference can be expanded, for example: lspci -v -s `lspci | awk '/VGA/{print $1}'` | sed -n '/Memory.*, prefetchable/s/.*\[size=\([^]]\+\)\]/\1/p' will just get the amount of prefetchable memory compare to: lshw -C display which does not give the size (it does give byte ranges and you could calculate the size from that, but that's a pain) Also uses a command which is not standard on linux; wheras lspci is a core utility provided by most systems Show Sample Output


    2
    lspci -v -s `lspci | awk '/VGA/{print $1}'`
    infinull · 2010-10-26 17:45:14 9
  • This command tell you if your hardware is 32 or 64 bits even if you install a 32bits OS on a 64 bits hardware. If your distro don't support the -q switch, try doing : grep &>/dev/null '\<lm\>' /proc/cpuinfo && echo 64 bits || echo 32 bits


    2
    grep -q '\<lm\>' /proc/cpuinfo && echo 64 bits || echo 32 bits
    sputnick · 2013-02-09 13:01:36 4
  • Find installed network devices. Show Sample Output


    1
    sudo lshw -C network
    cantormath · 2012-06-07 10:32:49 4

  • 1
    dbus-send --session --print-reply --dest="org.gnome.SettingsDaemon" /org/gnome/SettingsDaemon/Power org.gnome.SettingsDaemon.Power.Screen.SetPercentage uint32:30
    totti · 2013-02-04 11:21:07 4
  • CPU flags: rm --> 16-bit processor (real mode) tm --> 32-bit processor (? mode) lm --> 64-bit processor (long mode)


    1
    cat /proc/cpuinfo | grep " lm " > /dev/null && echo 64 bits || echo 32 bits
    agd · 2013-02-11 22:54:26 4
  • Formats the output from `ioreg` into XML, then parses the XML with `xmllint`'s xpath feature. Show Sample Output


    1
    ioreg -ad2 -c IOPlatformExpertDevice | xmllint --xpath '//key[.="IOPlatformUUID"]/following-sibling::*[1]/text()' -
    n8felton · 2018-08-18 21:19:47 347
  • Avoids cat abuse ;)


    0
    grep " lm " /proc/cpuinfo > /dev/null && echo "64-bit" || echo "32-bit"
    MrCode · 2013-02-19 21:40:44 4
  • Info about Bluetooth devices. Show Sample Output


    0
    hciconfig;hciconfig -a hci0;lsmod |grep bt;dmesg | grep tooth
    FadeMind · 2013-08-21 12:29:23 12
  • Gets the Hardware UUID of the current machine using system_profiler. Show Sample Output


    0
    system_profiler SPHardwareDataType | awk '/UUID/ { print $3; }'
    thealanberman · 2014-07-25 06:54:40 8

  • 0
    ioreg -d2 -c IOPlatformExpertDevice | awk -F\" '/IOPlatformUUID/{print $(NF-1)}'
    n8felton · 2018-08-18 21:18:20 316

  • -1
    ioreg -lw0 | grep IODisplayEDID | sed "/[^<]*</s///" | xxd -p -r | strings -6
    unixmonkey4003 · 2009-05-29 18:52:12 4

  • -1
    uname -m
    wee0x1b · 2013-02-15 17:23:44 4
  • Prints the type of computer you have. I think this should be used more in distros and other applications because it is so easy to get. This can also be asked by tutorials as an easy way to get your base hardware. Some alternatives: sudo dmidecode -s system-product-name and sudo smbios-sys-info-lite | sed -n 's/^Product Name: *\(.*\)/\1/p' Show Sample Output


    -2
    cat /sys/devices/virtual/dmi/id/board_name
    matthewbauer · 2010-04-22 03:21:40 9
  • CPU flags: rm --> 16-bit processor (real mode) tm --> 32-bit processor (? mode) lm --> 64-bit processor (long mode)


    -4
    if [[ lm = $(cat /proc/cpuinfo | grep " lm ") ]] ; then echo "64 bits" ; else echo "32 bits" ; fi
    agd · 2013-02-11 22:40:46 4

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands


Check These Out

Run a command only when load average is below a certain threshold
Good for one off jobs that you want to run at a quiet time. The default threshold is a load average of 0.8 but this can be set using atrun.

Convert spaces in file names to underscores

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

list folders containing less than 2 MB of data
This command will search all subfolders of the current directory and list the names of the folders which contain less than 2 MB of data. I use it to clean up my mp3 archive and to delete the found folders pipe the output to a textfile & run: $ while read -r line; do rm -Rv "$line"; done < textfile

Burn CD/DVD from an iso, eject disc when finished.
cdrecord -scanbus will tell you the (x,y,z) value of your cdr (for example, mine is 3,0,0)

Run a command for blocks of output of another command
The given example collects output of the tail command: Whenever a line is emitted, further lines are collected, until no more output comes for one second. This group of lines is then sent as notification to the user. You can test the example with $ logger "First group"; sleep 1; logger "Second"; logger "group"

ASCII art of yourself
Use libcaca to render ascii chars on the webcam input... or don't.

batch convert Nikon RAW (nef) images to JPG
converts RAW files from a Nikon DSLR to jpg for easy viewing etc. requires ufraw package

a function to create a box of '=' characters around a given string.
First argument: string to put a box around. Second argument: character to use for box (default is '=') Same as command #4948, but shorter, and without the utility function.

Backup all mysql databases to individual files on a remote server
It grabs all the database names granted for the $MYSQLUSER and gzip them to a remote host via SSH.


Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: