Posts Tagged ‘Sysadmin’

finding PCI devices

Thursday, July 22nd, 2010

Some times you need to find out the device name and other details . U can use the command

lspci    =    Which list all PCI devices

lshw    =    List hardware

lshw -C network  = List device which are under group network

To find PCI devices , let us say network

lspci -v | grep Ethernet -A 1

18:00.0 Ethernet controller: Broadcom Corporation NetLink BCM5787M Gigabit Ethernet PCI Express (rev 02)
Subsystem: Hewlett-Packard Company Device 30c0

##

To find the  info about network devices

it is “ifconfig”

Finding the size of a directory

Monday, July 12th, 2010

$du
Typing the above at the prompt gives you a list of directories that exist in the current directory along with their sizes. The last line of the output gives you the total size of the current directory including its subdirectories. The size given includes the sizes of the files and the directories that exist in the current directory as well as all of its subdirectories. Note that by default the sizes given are in kilobytes.

$du -ch | grep total
This would have only one line in its output that displays the total size of the current directory including all the subdirectories.

$du –exculde=doc
The above command would display the size of the current directory along with all its subdirectories, but it would exclude all the files having the given pattern present in their filenames. Thus in the above case if there happens to be any doc files within the current directory or any of its subdirectories, their size would not be included while calculating the total directory size.

$du -ch | sort -rn
Listing the disk space used for a directory and its subdirectories, sorted by disk usage

Finding files which has been created few days back

Wednesday, June 9th, 2010

find . -iname “*.PNG” -mtime -4 -print

-iname option is to search ignoring the case