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.
No comments:
Post a Comment