13 May 2018

Some Linux basics

A little intro to /bin/uname command

  • uname -s Kernel name
  • uname -n Computer name/Hostname/Nodename
  • uname -r Kernel release
  • uname -v Kernel version
  • uname -m Machin name/Arch
  • uname -p Processor type/Same as -m or -i
  • uname -i Hardware platform/Same as -m or -p
  • uname -o Operating system
  • uname -a All information
[akshay_siwal@dev300 ~]$ uname -a
Linux dev369app13.int.temp.com 2.6.32-642.13.1.el6.centos.plus.x86_64 #1 SMP Thu Jan 12 11:45:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

cat /proc/version

Information shown by /bin/uname command comes from file /proc/version, basically it just displays fromtion of /proc/version in more user friendly way.

[akshay_siwal@dev300 ~]$ cat /proc/version
Linux version 2.6.32-642.13.1.el6.centos.plus.x86_64 (mockbuild@c1bm.rdu2.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC) ) #1 SMP Thu Jan 12 11:45:05 UTC 2017

cat /proc/cmdline

This file /proc/cmdline contains options which were supplied to the kernel at boot times.

[akshay_siwal@dev300 ~]$ cat /proc/cmdline
root=LABEL=ROOT ro consoleblank=0 console=ttyS0 crashkernel=130M@0M



Kernel Documentation

In CentOS or Red Hat , install the package kernel-doc .

yum install kernel-doc
ls -lrt /usr/share/doc/kernel-doc-2.6.32/Documentation

For example file /usr/share/doc/kernel-doc-2.6.32/Documentation/filesystems/proc.txt will give information about /proc directory.



Kernel FIles

Kernel Image

/boot/vmlinux

  • No compression

/boot/vmlinuz

  • Compressed with zlib or higher compression

Use file command to check Kernal Image Type

file /boot/vmlinuz-4.14.33-51.37.amzn1.x86_64 
/boot/vmlinuz-4.14.33-51.37.amzn1.x86_64: Linux kernel x86 boot executable bzImage, version 4.14.33-51.37.amzn1.x86_64 (mockbuild@gobi-build-60006) #1 SMP Thu May 3 20:07:43 UTC 2018, RO-rootFS, swap_dev 0x4, Normal VGA

Initial RAM Disk

The initial RAM disk is responsible for loading a temporary root file-system during the Linux boot process. It contains drivers to load real root file-system and to do initial integrity check on it.

Type of initial RAM disk

initrd

  • Used prior to kernel 2.6.13
  • Compressed file-system image mounted through /dev/ram
  • The file-system module used in initrd must be compiled into the kernel, often ext2 but some use cramfs

initramfs

  • Used with kernel 2.6.13 and onwards
  • This is cpio archive
  • Unpacked by the kernel to tmpfs during boot phase and becomes the initial ram disk
  • Does not required file-system or block device driveres to be compiled into kernel and provides fast bootup.

Tags: