How to find hardware information from command line on Linux

linux

linux

Hi

In this post you can see some useful command to find and show hardware information on Linux.

Default commands

ALL devices

dmesg

dmesg will show you the kernel messages which can show you all the devices the kernel has found (hard disks,cdroms,etc)

CPU

# cat /proc/cpuinfo

Memory

# cat /proc/meminfo
$ free

PCI (including usb bridges,agp cards etc)

$ lspci

USB devices (mice,etc)

$ lsusb

Hard drives

# fdisk -l
$ df -h

Additional Command

lshw

lshw is a Linux command which provides details of all the hardware in your PC. The details provided by the lshw command run the gamut of processors, memory, slots, onboard sound, video chipset and more.

Install lshw

Arch:

# pacman -S lshw

Debain, Ubuntu or any of its derivatives:

$ sudo aptitude install lshw

Redhat, fedora, CentOS:

# yum install lshw

Gentoo:

# emerge lshw
Run lshw
# lshw
# lshw -short

To get the output in HTML, you use the -html option as follows:

# lshw -html > hardware-info.html

• See lshw command – List hardware information in Linux

dmidecode

dmidecode command reads the system DMI table to display hardware and BIOS information of the server. Apart from getting current configuration of the system, you can also get information about maximum supported configuration of the system using dmidecode. For example, dmidecode gives both the current RAM on the system and the maximum RAM supported by the system.
dmidecode is installed by default on many linux distribution like debain, ubuntu and fedora.
• See How To Get Hardware Information On Linux Using dmidecode Command

have a good time :)

  • Share/Bookmark

How to posting to Identi.ca from the CLI

terminal - cli
Hi :)

Identi.ca is an open source social networking and micro-blogging service.
I like Ideni.ca. It’s good service.

I use CLI (command line) everyday. I like to dented from it. It’s simple.
Just install cURL:

$ sudo apt-get install curl

And type:

$ curl -u username:password -d status="message" http://identi.ca/api/statuses/update.xml

You will receive a response containing the XML coding for your post which acts as a confirmation that your post was submitted.

Also you can create a shell file for this
Open a new text document and add the following, save it as identica.sh (or anything ending in sh):

#!/bin/bash
curl -u username:password -d status=″$1" http://identi.ca/api/statuses/update.xml

Make sure you change the chmod to 777 using the following command.

$ chmod 777 /path/to/file/

When you located the file (or add a bash prompt) it makes it simplier to identi.ca the rules. For example you can type the following to command to link to the file.

$ ./path/to/idetica.sh "Message"
  • Share/Bookmark

How to get special lines data from file (Linux)

If you want to get file’s head lines, you can use:

$ head FILE

If you want to get file’s footer lines, you can use:

$ tail FILE

If you want to print some line that they not in first part or last part of file, you can use:

$ more +num10 FILE | head -n20

The above command print from line 10 to 30 (20 lines) of FILE

  • Share/Bookmark

Root Terminal in Ubuntu

terminal_icon_48_48.jpg
Hi
Ubuntu has the root account disabled.
You use sudo to run commands as root. if you need root access for some work:

  • To start a root shell, but keep the current shell’s environment, use:
    sudo -s
  • To start a root shell (i.e. a command window where you can run root commands), starting root’s environment and login scripts, use:
    sudo -i

There is also a root terminal that is in the Applications menu. You have to right-click to edit the menu’s and add a check to the root terminal in System Tools items.

Don’t forget to type ‘exit’ (or press Ctrl+D) to switch back to your normal user when you are done.

More information about sudo in Ubuntu wiki

  • Share/Bookmark