Understand Filesystem) .: D. Kernel
Understand Filesystem) .: D. Kernel
GRUB has the knowledge of the filesystem (the older Linux loader LILO didn’t
understand filesystem).
Grub configuration file is /boot/grub/grub.conf (/etc/grub.conf is a link to this). The
following is sample grub.conf of CentOS.
d. Kernel
e. Init
o 5 – X11
o 6 – reboot
Init identifies the default initlevel from /etc/inittab and uses that to load all appropriate
program.
Execute ‘grep initdefault /etc/inittab’ on your system to identify the default run
level
If you want to get into trouble, you can set the default run level to 0 or 6. Since you
know what 0 and 6 means, probably you might not do that.
Typically you would set the default run level to either 3 or 5.
f. Runlevel programs
When the Linux system is booting up, you might see various services getting started.
For example, it might say “starting sendmail …. OK”. Those are the runlevel
programs, executed from the run level directory as defined by your run level.
Depending on your default init level setting, the system will execute the programs
from one of the following directories.
o Run level 0 – /etc/rc.d/rc0.d/
Please note that there are also symbolic links available for these directory under /etc
directly. So, /etc/rc0.d is linked to /etc/rc.d/rc0.d.
Under the /etc/rc.d/rc*.d/ directories, you would see programs that start with S and K.
Programs starts with S are used during startup. S for startup.
Programs starts with K are used during shutdown. K for kill.
There are numbers right next to S and K in the program names. Those are the
sequence number in which the programs should be started or killed.
For example, S12syslog is to start the syslog deamon, which has the sequence number
of 12. S80sendmail is to start the sendmail daemon, which has the sequence number
of 80. So, syslog program will be started before sendmail.
There you have it. That is what happens during the Linux boot process.
3) Which files are called for user profile by default when a user gets login
$HOME/.bash_profile, $HOME/.bash_bashrc
id:5:initdefault: to id:3:initdefault:
5) What command used for showing user info like Login Name, Canonical Name, Home
Directory,Shell etc..
An inode is a data structure on a traditional Unix-style file system such as UFS or ext3. An
inode stores basic information about a regular file, directory, or other file system object
Owner
Group
File Size
File access, change and modification time (remember UNIX or Linux never stores file
creation
time, this is favorite question asked in UNIX/Linux sys admin job interview)
Extended attribute such as append only or no one can delete file including root user
(immutability)
ls -i
Following command will show complete info about any file or folders with inode number
stat file/folder
Files/Folders can also be deleted using inode numbers with following command:
find out the inode number using ‘ls -il’ command then run below command
blockdev command
# Before test
256
2549+1 records in
real 0m6.845s
user 0m0.004s
sys 0m0.865s
# After test
2435+1 records in
real 0m0.370s
user 0m0.001s
sys 0m0.370s
CHAGE
usermod -L username
10) How many default number of Shells available and what are their names?
11) Which file defines the attributes like UID, PASSWORD expiry, HOME Dir create
or not while adding user
/etc/login.defs
authconfig
chattr
/etc/sysconfig/network-scripts/ethX
15) How can we change speed and make full duplex settings for eth0
OR
mii-tool -F 100baseTx-HD
mii-tool -F 10baseT-HD
/etc/resolve.conf
17) Main configuration file and command used for exporting NFS directories and it’s
deamons
/etc/exports and exportfs -av , deamons are quotad, portmapper, mountd, nfsd and
nlockmgr/status
netstat -antp
nmap
Soft Links => 1) Soft link files will have different inode numbers then source file
Hard Links => 1) Hard links will have the same inode number as source file
22) Restricting insertion into file if full permission are assigned to all
chattr +i filename
23) Display or Kill all processes which are accessing any folder/file
Display User who are using file/folder : fuser -u file/folder
killall -u username
25) How can we have daily system analysis and reports over mail
Use logwatch
26) How can we rotate logs using logrotate without performing any operation like move
and gzip’ng over original file and then creating new file (which is very lengthy process)
We can use “logrotate”‘s “copytruncate” option which will simply copy original file
27) Command to collect detailed information about the hardware and setup of your
system
dmidecode , sysreport
Ans lspci
Cron :
every minute)
2) Cron job can be scheduled by any normal user ( if not restricted by super
user )
5) Use cron when a job has to be executed at a particular hour and minute
Anacron :
1) Minimum granularity is only in days
2) Anacron can be used only by super user ( but there are workarounds to
and system is down during that time, it start the jobs when the system
minute
SSH 22, ftp 20/21, http 80, https 443, SMTP/SMPTS 25/465, POP3/POP3S 110/995,
IMAP/IMAPS 143/993
1) Create a file FILE1 and this should be read,write,executable for all user but Read only for
user USER1
Run test on device [TEST: offline short long conveyance select,M-N pending,N
http://www.thegeekstuff.com/2011/05/ext2-ext3-ext4/
or
SYN Flood : A SYN flood occurs when a host sends a flood of TCP/SYN packets, often with
a
fake/forged sender address. Each of these packets is handled like a connection request,
causing the
waiting for a packet in response from the sender address(response to the ACK Packet).
However,
because the sender address is forged, the response never comes. These half-open connections
saturate the number of available connections the server is able to make, keeping it from
responding to
http://www.thegeekstuff.com/2012/01/linux-unix-kernel/
Use “ssh-keygen -t dsa or rsa” at local system for creating public and private keys