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
-a | to see the author of the module |
-n | 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/
[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/
[root@Fedora /]# depmod -a
[root@Fedora /]# vi /lib/modules/
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.
Syntax,
ln [Option] [Target] [Point]
Example,
[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
Example:
[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:
ln
Example,
[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
(e.g., DOS FDISK, OS/2 FDISK)
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
LSPCI
[root@Fedora /]# lspci –v
ð It will display about PCI information.
SETSERIAL
[root@Fedora /]# setserial /dev/ttyS2 uart 16550a port 0xdff0 irq 5
[root@Fedora /]# setserial /dev/ttyS2
/dev/ttyS2, UART:16550A, Port:0xdff0, IRQ:5
DMESG
[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
[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 - class: KEYBOARD 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 bus: SERIAL detached: 0 device: ttyS0 driver: generic desc: "ECM|0002" pnpmfr: ECM pnpmodel: 0002 pnpcompat: PNP0F0A - class: PRINTER bus: PARALLEL 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.
Syntax:
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
CPU0
|
/proc/ioports - List of used I/O addresses
[root@Fedora /]# vi /proc/ioports
0000-001f : dma1
|
/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:
|