System Commands

LSMOD and modinfo- Listing Loaded Modules

To see which modules are currently loaded into the running kernel we can use lsmod command.
[root@Fedora /]# lsmod

To find information about any of the loaded modules, we can use the modinfo command.

[root@Fedora /]# modinfo -d snd-seq-oss

ð In this case the snd-seq-oss module is described as an OSS - compatible sequencer module. We can also use other options such as


to see the author of the module


to see the object file representing the module.

modprobe - Loading Modules

We can load any module that has been compiled and installed (to the /lib/modules/ directory) into your running kernel using the modprobe command. The most common reasons for loading a module are that we want to use a feature temporarily or to identify a piece of hardware that could not be auto detected.

[root@Fedora /]# modprobe parport

ð It will load the parport module. The parport module provides the core functions to share parallel ports with multiple devices.

[root@Fedora /]# modprobe parport_pc io=0x3bc irq=auto

ð Here, the parport_pc module lets us optionally define the addresses (I/O) and IRQ numbers associated with each device sharing the parallel port.

Note: The modprobe command loads modules temporarily. At the next system reboot, the modules you enter disappear. You can add this command line to one of the start-up scripts that are running a boot time.

insmod - Loading Modules

We can specify the complete module file name using the -o option. Other helpful options are the -p option, which lets us probe our system first to see if the module can be successfully loaded and -n option, which perform all takes except actually loading the module. The -v option lists all actions takes as they occur. In those rare case where we may have to force a module to load, we can use the -f option.
[root@Fedora /]# insmod -v sb

depmod - To create a dependency file

The depmod command generates a hierarchical listing, nothing what modules should be loaded first and in what order and store it in a file called modules.dep in the /lib/modules/ directory. Then to load the module, we use the modprobe command using that file, modprobe reads he file generated by depmod and loads any dependent modules in the current order, along with the module we want. Entering depmod -a creates a complete listing of all module dependencies.

[root@Fedora /]# depmod -a

[root@Fedora /]# vi /lib/modules//modules.dep

rmmod - Removing Modules
Unloaded a module currently loaded. Does not check for dependency.

/etc/modules.conf File

Notice that there is no device name for Ethernet devices in the /dev directory. This is because the device name is really an alias for a Ethernet network module that has been defined in the modules.conf file. If we were to add add another Ethernet card of the same type, we would place an alias for it in the modules.conf file. For a second Ethernet card, we would use the device name eth1 as the alias, example

root@Fedora /]# vi /etc/modules.conf

alias eth1 ne2k-pci

... ... ... ...

... ... ... ...

MKFS - To create a file system

It is possible to create a file system, for any supported file system on, a disk or partition that you choose. This is done with the mkfs command.

[root@Fedora /]# mkfs -t ext3 /dev/fd0

ð Using mkfs command to create a file system on a floppy disk.

LN - To make the link of a directory to a file

Create a link to the specified TARGET with optional LINK_NAME. If LINK_NAME is omitted, a link with the same basename as the TARGET is created in the current directory. When using the second form with more than one TARGET, the last argument must be a directory; create links in DIRECTORY to each TARGET. Create hard links by default, symbolic links with --symbolic. When creating hard links, each TARGET must exist.


ln [Option] [Target] [Point]


[root@localhost root]# ln -s /mnt/cdrom cdrom

[root@localhost root]# ls -l

lrwxrwxrwx root root 2 cdrom -> /mnt/cdrom

ð Here we use -s option to make a link of /mnt/cdrom directory to cdrom. Another option used to remove the link is -i.

[root@localhost root]# ln -i cdrom

[root@localhost root]# ls -l

-rw-r--r-- root root 0 cdrom

There are two types of link can be occurred by ln command which are explained below,

1) Symbolic (or soft) links:

Ø A symbolic link points to another file –

· ls –l displays the link name and the referenced file.

· File type: 1 for symbolic link.

· The content of a symbolic link is the name of the file that it refers.

Ø Syntax:

ln -s


[root@localhost root]# ln -s /etc/passwd password

[root@localhost root]# ls -l password /etc/passwd

2) Hard Link:

Ø One physical file on the file system.

Ø Each link references the file’s inode.

Ø File is present in the file system as long as at least one link remains.

Ø Can not span drives or partitions.

Ø Syntax:



[root@localhost root]# ln fedora redhat

fdisk Command

Disk drives are divided into partitions which are formatted with file systems, allowing users to store data. Some different type of file system are named below,

1. Default file system: ext3, the third Extended Linux File System.

2. ext2 and msdos (typically used for Floppies).

3. iso9660 (typically used for CDs).

[root@ localhost root]# fdisk /dev/hda

The number of cylinders for this disk is set to 4870.

There is nothing wrong with that, but this is larger than 1024,

and could in certain setups cause problems with:

1) software that runs at boot time (e.g., old versions of LILO)

2) booting and partitioning software from other OSs


Command (m for help): m

Command action

a toggle a bootable flag

b edit bsd disklabel

c toggle the dos compatibility flag

d delete a partition

l list known partition types

m print this menu

n add a new partition

o create a new empty DOS partition table

p print the partition table

q quit without saving changes

s create a new empty Sun disklabel

t change a partition's system id

u change display/entry units

v verify the partition table

w write table to disk and exit

x extra functionality (experts only)

[root@ localhost root]# fdisk -l

Disk /dev/hda: 40.0 GB, 40060403712 bytes

255 heads, 63 sectors/track, 4870 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/dev/hda1 * 1 1275 10241406 c W95 FAT32 (LBA)

/dev/hda2 1276 4870 28876837+ f W95 Ext'd (LBA)

/dev/hda5 1276 2174 7221186 7 HPFS/NTFS

/dev/hda6 2175 3073 7221186 7 HPFS/NTFS

/dev/hda7 3074 3972 7221186 7 HPFS/NTFS

/dev/hda8 3973 3987 120456 83 Linux

/dev/hda9 3988 4054 538146 82 Linux swap

/dev/hda10 4055 4691 5116671 83 Linux

/dev/hda11 4692 4870 1437786 83 Linux


[root@Fedora /]# lspci –v

ð It will display about PCI information.

[root@Fedora /]# setserial /dev/ttyS2 uart 16550a port 0xdff0 irq 5
[root@Fedora /]# setserial /dev/ttyS2
/dev/ttyS2, UART:16550A, Port:0xdff0, IRQ:5

[root@Fedora /]# dmesg

ð It will display that information which is gained at the system booting time.

KUDZU - Hardware Auto Detection Program

The kudzu program is a hardware auto detection and configuration tool that runs automatically at the boot time. If you need to configure new or existing hardware setting while Linux is running just type kudzu and press key. kudzu stores all collecting hardware information from the machine to the file named /etc/sysconfig/hwconf.

[root@Fedora /]# kudzu

[root@Fedora /]# vi /etc/sysconfig/hwconf


class: OTHER

bus: PCI

detached: 0

driver: unknown

desc: "ALi Corporation|M1533 PCI to ISA Bridge [Aladdin IV]"

vendorId: 10b9

deviceId: 1533

subVendorId: 10b9

subDeviceId: 1533

pciType: 1

pcidom: 0

pcibus: 0

pcidev: 7

pcifn: 0


class: MOUSE

bus: PSAUX

detached: 0

device: input/mice

driver: generic3ps/2

desc: "Microsoft Mouse"


class: CDROM

bus: IDE

detached: 0

device: hdc

driver: ignore

desc: "ASUS CD-S520/A4"


class: CDROM

bus: IDE

detached: 0

device: hdd

driver: ignore

desc: "ASUS CB-5216A"


class: MODEM

bus: PCI

detached: 0

driver: unknown

desc: "Conexant|HSF 56k HSFi Modem"

vendorId: 14f1

deviceId: 2f00

subVendorId: 14f1

subDeviceId: 2002

pciType: 1

pcidom: 0

pcibus: 0

pcidev: 9

pcifn: 0


class: VIDEO

bus: PCI

detached: 0

driver: Card:Trident 3DImage975 (generic)

desc: "Trident Microsystems|3DImage 9750"

vendorId: 1023

deviceId: 9750

subVendorId: 1023

subDeviceId: 9750

pciType: 1

pcidom: 0

pcibus: 1

pcidev: 0

pcifn: 0


class: FLOPPY

bus: MISC

detached: 0

device: fd0

driver: unknown

desc: "3.5" 1.44MB floppy drive"


class: HD

bus: IDE

detached: 0

device: hda

driver: ignore

desc: "SAMSUNG SP0411N"

physical: 16383/16/63

logical: 16383/255/63



bus: PSAUX

detached: 0

driver: ignore

desc: "AT Translated Set 2 keyboard"


class: IDE

bus: PCI

detached: 0

driver: unknown

desc: "ALi Corporation|M5229 IDE"

vendorId: 10b9

deviceId: 5229

subVendorId: 0000

subDeviceId: 0000

pciType: 1

pcidom: 0

pcibus: 0

pcidev: f

pcifn: 0


class: MOUSE


detached: 0

device: ttyS0

driver: generic

desc: "ECM|0002"

pnpmfr: ECM

pnpmodel: 0002

pnpcompat: PNP0F0A


class: PRINTER


detached: 1

device: lp0

driver: unknown

desc: "Canon BJC-265SP"

pnpmodel: BJC-265SP

pnpmfr: Canon

pnpmodes: BJ,LQ,BJL,BJRaster,BSCC

pnpdesc: Canon BJC-265SP

ð Kudzu compares current hardware information with the already stored database in the file hwconf and when it gets different information between both then a installed or removed dialog box will open for setting.

MKNOD - Command
We can use mkmod command to create a device file, either a character of block typ.

mknod options device_name device_type major_number minor_number

[root@Fedora /]# mknod -m 660 /dev/lp3 c 6 3

ð The -m option specifies the permissions, in the case 660. The device is character device so it indicated c argument. The major number is 6 and the minor number is 3. If we were making a device at /dev/lp4, the major number would still be 6 but the minor number would be 4. We can use the mknod command to create terminal devices. The permissions for a terminal device are 660. Terminal devices are character devices with major number of 4 and minor numbers usually beginning at 64.

/proc/interrupts - List of used IRQ number
[root@Fedora /]# vi /proc/interrupts

0: 1814024 XT-PIC timer
1: 2874 XT-PIC i8042
2: 0 XT-PIC cascade
4: 18392 XT-PIC serial
8: 1 XT-PIC rtc
14: 41050 XT-PIC ide0
15: 656 XT-PIC ide1
NMI: 0
ERR: 0

/proc/ioports - List of used I/O addresses
[root@Fedora /]# vi /proc/ioports

0000-001f : dma1
0020-0021 : pic1
0040-005f : timer
0060-006f : keyboard
0070-0077 : rtc
0080-008f : dma page reg
00a0-00a1 : pic2
00c0-00df : dma2
00f0-00ff : fpu
0170-0177 : ide1
01f0-01f7 : ide0
0213-0213 : ISAPnP
02f8-02ff : serial
0376-0376 : ide1
0378-037a : parport0
037b-037f : parport0
03c0-03df : vga+
03f6-03f6 : ide0
03f8-03ff : serial
0a79-0a79 : isapnp write
0cf8-0cff : PCI conf1
c000-cfff : PCI Bus #01
dff0-dff7 : 0000:00:09.0
ffa0-ffaf : 0000:00:0f.0
ffa0-ffa7 : ide0
ffa8-ffaf : ide1

/proc/dma - List of used DMA number
[root@Fedora /]# cat /proc/dma
4: cascade

/proc/pci - Information of PCI
[root@Fedora /]# vi /proc/pci

PCI devices found:
Bus 0, device 0, function 0:
Class 0600: PCI device 10b9:1541 (rev 4).
Master Capable. Latency=64.
Non-prefetchable 32 bit memory at 0xe0000000 [0xe03fffff].
Bus 0, device 1, function 0:
Class 0604: PCI device 10b9:5243 (rev 4).
Master Capable. Latency=64. Min Gnt=11.
Bus 0, device 7, function 0:
Class 0601: PCI device 10b9:1533 (rev 195).
Bus 0, device 9, function 0:
Class 0780: PCI device 14f1:2f00 (rev 1).
IRQ 10.
Master Capable. Latency=64.
Non-prefetchable 32 bit memory at 0xdffe0000 [0xdffeffff].
I/O at 0xdff0 [0xdff7].
Bus 0, device 15, function 0:
Class 0101: PCI device 10b9:5229 (rev 193).
Master Capable. Latency=32. Min Gnt=2.Max Lat=4.
I/O at 0xffa0 [0xffaf].
Bus 1, device 0, function 0:
Class 0300: PCI device 1023:9750 (rev 243).
IRQ 11.
Master Capable. Latency=64.
Non-prefetchable 32 bit memory at 0xcf800000 [0xcfbfffff].
Non-prefetchable 32 bit memory at 0xcfee0000 [0xcfefffff].
Non-prefetchable 32 bit memory at 0xcf400000 [0xcf7fffff].