Saturday, May 28, 2011

Check Hardware and few linux's commands

few handy linux command and check hardware

CPU info:

$ cat /proc/cpuinfo

Running kernel version

$ uname -r

Version of most installed applications:
$ gcc -v
$ gcc --version

What is the running kernel and compiler installed
$ cat /proc/version

X server, X Protocol, Build Operating System version and and Kernel command line:
$ X -showconfig

What pci cards are installed and what irq/port is used
$ cat /proc/pci

What kernel modules are loaded
lsmod

Memory and swap information
detail-> $ cat /proc/meminfo
short info-> $ free or $ free -m (output in megabits)

Hard drives partitiontion
$ fdisk -l

Free/used drive space
$ df -h

Show disk usage by current directory and all subdirectories
$ du | less or $du | more

What takes up so much space on your box
Run from the directory in question and the largest chunk shows up last
$ find $1 -type d | xargs du -sm | sort -g

What is the distribution
$ cat /etc/issue
$ cat /etc/issue.net

For finding or locating files
$ find <location to search (path)> -name <starting string of file name which you want to search>
$ locate <file name>
$ which <file name> (search in all path available in PATH)
$ whereis [-bmsu] [-BMS directory... -f] filename...
where b:Search only for binaries. m:Search only for manual sections.
s:Search only for sources. u: Search for unusual(not b:m:s) entries.

Use dmesg to view the kernel ring buffer (error messages)
$ dmesg | less or $ dmesg | more

Watch error messages as they happen (sysklog needed)
as root,
$ tail -f /var/log/messages (this will shows last 10 lines, use a number in front of f for more lines)

list all processes running
$ ps -A

Find a process by name
$ ps -ef | grep -i <plain text>
eg:
$ ps -ef | grep sendmail

See current environment list, or pipe to file
$ env | more
$ env > environmentvariablelist.txt

Show current userid and assigned groups
$ id

See all command aliases(shortcut command for a long command) for the current user
$ alias

rpms installed on current
$ rpmquery --all | less
$ rpmquery --all > <filename>
$ rpmquery --all | grep -i <plaintext>

Present Working Directory:
pwd

Get ls in less
ls --color=always | less -R

Notes:

The /proc/ directory contains a hierarchy of special files which represent the current state of the kernel — allowing applications and users to peer into the kernel's view of the system.

Look at man <command> or info <command> for other options you can use for bash commands.

5 comments:

  1. Being one of the widely used hardware, it is quite obvious that users may encounter a number of different issues with their printers; Bother printer users are in a similar situation can directly get in touch with Bother support team at +1-866-569-8043 and get resolution for all their issues.
    Brother Printer Contact Number

    ReplyDelete
  2. Thanks for this wonderful post. The information in this article is very helpful to me. Thanks a lot for sharing. Keep blogging. Internet Explorer support

    ReplyDelete
  3. Printer Technical Support Number
    http://www.printersupportnumbers.com/
    Printersupportnumbers.com is an independent tech support service provider of printer problems for all the third party products mentioned on the website. We are not affiliated with any third party company. Use of third party trademarks, brand names, products & services mention on website is for customer reference only

    ReplyDelete
  4. Thank you for posting such a great article. Keep it up mate.

    northeast net banking

    ReplyDelete