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

Synchronizing Google Tools with Kontact

Hello :)

Introduction
Using online tools has many advantages. One of the most important of them is the information is accessible from anywhere and at any time.
One need that was occurred after using this tools is Synchronizing information with other applications and devices. such as Synchronizing contacts between Mobile, Web and PC.

* The following guide is tested on Kubuntu 9.10 with KDE 4.3.3 environment.

Synchronizing Google Tools with Kontact
Step 1
Installing akonadi-kde-resource-googledata package. The package is available in Ubuntu 9.10 and Debian repositories.

sudo aptitude install akonadi-kde-resource-googledata

Step 2
After installing akonadi-kde-resource-googledata package, you need to add Google resources to Akonadi. Open Akonadi Console:

akonadiconsole

Click Add on Agents tab. Add a `Akonadi Google Calendar Resource` for Google Calendar and add `Akonadi Google Contacts Resource` for Google Contacts.

Add Google Resources to Akonadi Console

Add Google Resources to Akonadi Console

Enter your username without `@gmail.com` in the next window.

Enter your username

Enter your username

Step 3
After adding a resources open Kontact application :

kontact

Add Contacts
Go to Contact section and add `Akonadi Google Resource` to address books:

Add `Akonadi Google Resource` to Address Books

Add `Akonadi Google Resource` to Address Books

Add Calendar
Go to Calendar section and add `Akonadi Google Resource` to calendars:

Add `Akonadi Google Resource` to calendars

Add `Akonadi Google Resource` to calendars

done :P

P.S.
Ubuntu 9.10 release party held in Tehran, Iran.

Have a good time :)

  • Share/Bookmark

How to extract embedded images from .xls, .ods or .odt

icon_openoffice
Hi :)

It’s simple. Just 4 steps:

  1. Save a copy of the file as ODS (OpenOffice.org Spreadsheet).
  2. Change the filetype of the copy to ZIP (for example rename File.xls to File.zip).
  3. Open the ZIP.
  4. In the directory called Pictures will be the images, just as in the original.
  • 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

Install Oracle Instant Client and PHP OCI8 module

If you want to connect to an Oracle database with PHP, you can use Oracle’s Instant Client and the oci8 module from pear.

Download the Basic and the SDK packages from oracle.com. At the time of this writing, the filenames are instantclient-basic.zip and instantclient-sdk.zip.

Unzip these files in a new directory, e.g. /opt/oracle/instantclient.

Code:

sudo su
mkdir -p /opt/oracle/instantclient
cd /opt/oracle/instantclient
unzip instantclient-basic.zip
unzip instantclient-sdk.zip
echo /opt/oracle/instantclient >> /etc/ld.so.conf
ldconfig

The previous two lines are supposed to create symlinks named libclntsh.so and libocci.so which we will need later. In my case these symlinks were not created by ldconfig, so I created them manually.

Code:

ln -s libclntsh.so.11.1 libclntsh.so
ln -s libocci.so.11.1 libocci.so

In the next step we will download the oci8 module with pear. Pear is in the php-pear package.

Code:

apt-get install php-pear

Also, you need php5-dev and build-essential packages for compiling oci8 module.

Code:

apt-get install php-pear php5-dev build-essential

“Normally” we should be able to just use pecl install oci8 now, but apparently pear is not able to figure out where the instantclient libraries are. So we will just download the oci8 module and build it on our own.

Code:

mkdir -p /usr/local/src
cd /usr/local/src
pecl download oci8
tar xzf oci8-1.3.4.tgz
cd oci8-1.3.4
phpize
./configure --with-oci8=shared,instantclient,/opt/oracle/instantclient
make
make install

The oci8-1.3.4.tgz filename will of course change for newer releases.

To enable the oci8 module in the php.ini (/etc/php5/apache2/php.ini and /etc/php5/cli/php.ini), add a line
Code:

extension=oci8.so

(put this line after the examples starting with ;extension).

Now stop and start Apache. You should see the oci8 module in the output of phpinfo().

Good luck

  • Share/Bookmark