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 295
  • 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 11
  • 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 265

  • -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

force unsupported i386 commands to work on amd64
The above was done using the i386 flashplayer plugin, and was installed on a AMD64 machine running an AMD64 kernel and AMD64 programs. the resulting plugin install ultimately didn't work for swiftfox (but worked for iceweasel) without also covering it with a nspluginwrapper which took a bit of fenangaling to get to work (lots of apt-getting) but it is a nice feature to be able to trick installers that think you need i386 into running on a amd64, or at least attempting to run on amd64. Enjoy

Gets the english pronunciation of a phrase
Usage examples: say hello say "hello world" say hello+world

Generat a Random MAC address
Generate a random MAC address with capital letters

Extract tarball from internet without local saving

Check whether laptop is running on battery or cable
The original proc file doesn't exist on my system.

Install pip with Proxy
Installs pip packages defining a proxy

Track X Window events in chosen window
After executing this, click on a window you want to track X Window events in. Explaination: "xev will track events in the window with the following -id, which we get by greping window information obtained by xwininfo"

dont execute command just add it to history as a comment, handy if your command is not "complete" yet

list files recursively by size

Get the IP address
gives u each configured IP in a seperate line.


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: