Q: How are device files represented in UNIX/Linux?
A: All devices are represented as files called special files and are located in the /dev directory.
Q: What is a inode?
The inode(Index node) is a fundamental concept in Linux/Unix file systems. Each object in the file system is represented by an inode. Each and every file in Linux/Unix file systems has the following attributes.
File type (executable, block, special etc)
Permissions (read, write etc)
Owner
Group
File size
File access, change, modification time, file deletion time
Extended attribute information such as append only or no one can delete file including root user (immutability)
Access control lists (ACL)
All the above information are stored in an Inode. Each inode is identified by a unique inode number within the file system.
Q: how can I see an inode no?
A: # ls –i /etc/passwd
Output: 32820 /etc/passwd
We can use the ‘stat’ command to find out inode number and it’s attributes.
What are the process states in unix/linux?
Process states in Linux are below
Running: process is running or ready to run.
Interruptible: a Blocked state of a process and waiting for an event or signal from another process
Uninterruptible: a blocked state. Process waits for a hardware condition and cannot handle any signal
Stopped: Process is stopped or halted and can be restarted by some other process
Zombie: process terminated, but information is still there in the process table.
Q: Command used to remove password assigned to a group?
Gpasswd -r
Q: How to find what shell we are using ?
Echo $SHELL
Q: How to find files which have been accessed within the last 30 days?
Find / -type f -atime -30 > output.txt
“-30” means that it was modified “less than 30 days ago”
“+30” means that it was modified “more than 30 days ago”
For modified we can use “mtime”
Q: What is a zombie?
process terminated, but information is still there in the process table
Q: How do I find a zombie process
A: use ‘top’ or ‘ps’
a process with Z is a Zombie process and it can be killed using “kill -9 <process id>”
Q: Which daemon is responsible for tracking events in the system?
Syslogd
Q: What is the role of a /boot directiory?
This directory has files related to the system bootloader (grub/lilo)
Given a typical CentOS or Fedora host, you will probably see something similar to the following in /boot:
$ cd /boot
$ tree
.
|– System.map-2.6.29.5-191.fc11.x86_64
|– System.map-2.6.30
|– config-2.6.29.5-191.fc11.x86_64
|– config-2.6.30
|– efi
| `– EFI
| `– redhat
| `– grub.efi
|– grub
| |– device.map
| |– e2fs_stage1_5
| |– fat_stage1_5
| |– ffs_stage1_5
| |– grub.conf
| |– iso9660_stage1_5
| |– jfs_stage1_5
| |– menu.lst -> ./grub.conf
| |– minix_stage1_5
| |– reiserfs_stage1_5
| |– splash.xpm.gz
| |– stage1
| |– stage2
| |– ufs2_stage1_5
| |– vstafs_stage1_5
| `– xfs_stage1_5
|– initrd-2.6.29.5-191.fc11.x86_64.img
|– initrd-2.6.30.img
|– vmlinuz-2.6.29.5-191.fc11.x86_64
`– vmlinuz-2.6.30
For each kernel release, you will typically see a vmlinuz, System.map, initrd and config file. The vmlinuz file contain the actual Linux kernel, which is loaded and executed by grub. The System.map file contains a list of kernel symbols and the addresses these symbols are located at. The initrd file is the initial ramdisk used to preload modules, and contains the drivers and supporting infrastructure (keyboard mappings, etc.) needed to manage your keyboard, serial devices and block storage early on in the boot process. The config file contains a list of kernel configuration options, which is useful for understanding which features were compiled into the kernel, and which features were built as modules.