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.

4 comments:

  1. Hi, nice post. This is an interesting and very informative topic. Thanks for sharing your ideas.
    pogo games technical support phone number usa

    ReplyDelete
  2. Thanks for sharing these.
    It’s always useful to get pointers to the good blogs out there.
    You might also be interested to know more about our company -
    Parana Impact, which is one of the leading database marketing,
    data intelligence and digital marketing service provider.
    Cardiologist Users Email List Suitable to small scale to large scale companies which will focus on driving more revenue and increase profitability.

    ReplyDelete
  3. 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