Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Thursday, June 2, 2011

Getting Hardware Info in Linux

There are many ways to view the hardware configuration of the Linux system. Bulk of these ways derive information from the /proc directory
examples below
cat /proc/cpuinfo
cat /proc/meminfo

But if you want a detailed description of the hardware components, then this is the better way. It also gives the voltage of the CPU, type of RAM, serial number of the mother board, etc. check it yourself.
dmidecode

Thursday, August 26, 2010

Essential Linux Command Tips

extracting files:
for .bz2 files
# tar -xvjf myfile.tar.bz2

for .gz files
# tar -xvzf myfile.tar.gz

compressing files:
use the -c switch intead of -x
# tar -cvzf linux-2.6.30-2.tar.gz

if you want to specify a directory,
# tar -cvzf linux-2.6.30-2.tar.gz mydir

rpms on RHEL:
installing-
# rpm -ivh filename.rpm

removing-
# rpm -e filename.rpm

checking if a package is installed-
# rpm -qa | grep gcc
this will give you the versions of gcc if it is installed.

checking size of a directory:
# du -sh
this will give the size of the current directory
# du -sh /var/lib
this will give the size of the /var/lib directory. 's' will not display the contents i.e. silent mode and 'h' will print int in human readable form (MB)

viewing only directories:
# ls -d */

Redhat Version:
# cat /etc/redhat-release

kernel version:
# uname -a

displaying year in the ls output:
# ls -l --full-time

print filesystem features:
# debugfs -R features /dev/hdc1

getting count of the listing provided by ls:
# ls | wc -l

label a partition:
# e2label /dev/sda1 mylabel

tuning a filesystem:
# tune2fs -c 1 /dev/sda1
this will perform an fsck at every boot on partition sda1. other parameters can be given accordingly. RTM (missing a letter ;- )

re-setting a symbolic link:
# ln -f -s /var/lib/foo.sh bar.sh
bar.sh file's original link will be reset to the new one specified.