Workshop On Free/Open Source Software
Workshop On Free/Open Source Software
● Introduction to FOSS/Linux
● An overview of Development Tools in Linux
● Introduction to Using Command Line & Shell
Scripting
● An introduction to Scripting Languages
● (Optional) Hands On
Introduction to FOSS
● Why F/OSS?
● Who Uses F/OSS?
Why F/OSS
● For an Individual
– No Upfront Cost of Operating System
– (Mostly) all Applications Available with Linux
are F/OSS
– (in General) Very Secure, so Less Money,
Time and effort needed
– Good Support for Old Hardware
Choice
512 Bytes
Boot Loaders
● Lilo
● Grub
● Uboot (Embedded Systems)
– Boot monitors (acts both as 1st and 2nd Stage)
– Also can download kernel to the target
– Performs error checking and initialization
● Dissecting MBR
– # dd if=/dev/hda of=mbr.bin bs=512 count=1
– # od -xa mbr.bin
Anatomy Of BootLoader
● Compressed image
● At the head a small program that Performs
some minimal hardware setup
– (./arch/i386/boot/head.S)
● Loads kernel and ramdisk to memory and
decompress the kernel
– [ decompress_kernel (located in
./arch/i386/boot/compressed/misc.c) ]
● yet another startup_32 function,
– but this function is in ./arch/i386/kernel/head.S.
Kernel Start
Partition Table
● What is journaling?
● Rationale
– Optimizations
● Physical
● Logical
FileSystems
● What?
– Blocksize
● Ext2/3/4
● FAT/NTFS
ext2
BLOCK BLOCK GROUPS
Decided when FS is Created 1,2,3,4,8K size Cluster of Blocks To reduce Fragmentation
Smaller blocks, less wastage of space Stored immediately after Super Blocks
but more accounting overhead First 2 Blocks reserved for bitmap and
Inode Information, size of bitmap=1block
Size, And next comes inode data, and
then data
● Journaling
– Writeback mode
● No journaling of data, only meta-data
– Ordered mode
● Logically groups meta-data and and data-
blocks as a single group of transaction, on
write data-blocks are written first
– Journal mode
● Slowest to write, replay of journal
● Fastest to read
Ext4
● Commands as steps
● Variables
● Variable interpolation
● Loops and Conditions
● Shebang line
● Script permissions
● Sed
● AWK
● Grep
● Find
globbing
● filename matching, doesn't match /
● man glob
● uses special characters such as * and ?
– * == any or no characters
– n* == any filename starting with an n followed
by 0 or more other characters
– ? == any single character
● ls /tmp/intermediate_bash/?on.txt
– note that on.txt is not matched
regular expressions
– $( echo pwd )
● don't use backticks unless you need /bin/sh
compatability
– `echo pwd`
● $() syntax allows nesting, fixes quoting issues
– j=$( ls -d $( pwd ) ); echo $j
Proc FileSystem
● Mounted on /proc
– proc on /proc type proc (rw)
– /proc/cpuinfo
● Gives CPU Info
– /proc/meminfo
● Gives Memory Info
– /proc/uptime
● Individual Numbered directories are for
processes
Inside process directory
● Cmdline
– The command with which this process was
started
● Status
– Name of the program, status, Virtual Memory
size, threads etc..
● More at
– http://www.redhat.com/docs/manuals/linux/RH
L-7.2-Manual/ref-guide/ch-proc.html
Exercises