Wednesday, December 29, 2010


Basically configuring servers in Linux/*nix include editing of configuration files and saving them. Once editing the files if any syntax error is there and when we start the service they will show some wearied errors which we cant resolve.
For counter attacking this type of issues for each service there will be one command to check this syntax errors before starting of the service/server, I have collected these commands from my experience and from some of my friends. Please feel free to comment on this if you know some other commands so that I will update my post.

SSHD server check for syntax error
sshd -t

FTP server check for syntax error

DNS server check for syntax error

For checking syntax errors in main configuration file..
#named-checkconf main-config-file

#named-checkconf named.conf
Syntax OK

#named-checkzone domain zonefile-loc

#named-checkzone /var/named/chroot/var/named/exaple-zone.frd

SAMBA server check for syntax error

APACHE server check for syntax error
httpd -t

For virtual hosts

httpd -t -D DUMP_VHOSTS

TCP Wrappers check for syntax error
tcpdchk -v

Postfox server check for syntax error
postfix check
postfix -vv

LIGHTTPD server check for syntax error
lighttpd -t -f /etc/lighttpd/lighttpd.conf

Squid server check for syntax error
squid -k check
squid -k parse

NAGIOS server check for syntax error
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Friday, December 24, 2010

Automatic Login through SSH

[root@server2~]#ssh-copy-id -i ~/.ssh/
root@'s password:
Now try logging into the machine, with "ssh ''", and check in:


to make sure we haven't added extra keys that you weren't expecting.

Last login: Thu Dec 23 18:25:19 2010 from
[root@server3 ~]#

Monday, December 6, 2010

How to connect, install and configure TATA Photon in Linux

This post explains how to connect your Tata photon dongle to a Redhat Linux system. It works on other Redhat distributions like Fedora, CentOS too.

The procedure is explained in step by steps below.

1. Connect / Plug your photon+ to the system and wait till it gets ditected.
2. Open a terminal, run a command "dmesg" and check it is showing the modem name as HUAWEI.
3. Run another command "sudo wvdial" and its will create a config file in /etc/wvdial.conf, something like shown below.
(if u dont have wvdial, you can download it from

by running "cat /etc/wvdial.conf"
or you can edit it using the commadn "vi /etc/wvdial.conf"

[Dialer Defaults]
Modem = /dev/modem
Baud = 115200
Modem Type = Analog Modem
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
[Dialer info]
Init9 = AT&V
[Dialer photon+]
Modem = /dev/modem
Baud = 115200
Modem Type = Analog Modem
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Phone =
Username =
Password =
Auto DNS = off

some of the field may be already filled.

4. In terminal, connect by "wvdial".
5. Using Network Manager applet is more easier and is automatic whenever you plug the card.
6. In Network Manager, U can create profile by configuring network -> analog POTS -> setup.
   Fill the data as you need. leave the IP & gateways as defaults. Type user's name/pass phrase and dial number
   (usually user name/pass phrase are your phone number & dial number is *777).
5. connect the profile and check its working.
6. Thats it. Now check your mails!

How to install and configure a mail server using Postfix + Dovecot + squirrelmail in linux

This post helps to install and configure a mail server with postfix as MTA[ (Mail Transfer agent), Dovecot as MDA (Mail Delivery Agent) and Squirrel mail as MUA (Mail User
Agent). This is a simple basic configuration without much advanced configurations. This is tested in Redhat linux and will also work in other redhat disrtos like
fedora, centos etc.

Assuming you have a configured yumserver. Else use the rpms.
#yum install postfix* dovecot* Squirrelmail*


1. Configure the DNS eg:

2. Select the defalt MTA as postfix. Most systems it will be Sendmail.

#alternatives     --config    mta
Select postfix.

3. open the configuration file of Postfix and edit the following.

#vi /etc/postfix/
edit the following

 1. my domain
 2. my hostname
 3. inet_interfaces

and reload the service.

4. Configure the Squirrel mail
#cd /usr/share/squirrelmail/config/

run the perl file

 1.Domain name name [FQDN]

5. Configure the dovecot
#vi /etc/dovecot.conf

protocols = imap

save it and restart the service.

#service dovecot restart
#chkconfig dovecot on

6. Add the MX entry to DNS. Dont fotget to give the priority.

7. Resolve the hostname in /etc/hosts.

8. Start the httpd [apache]

9. Thats it. you can now access the webmail through

User administration in redhat linux

User administration in Linux

In Linux there are three type of users.

1. Super user or root user
Super user or the root user is the most powerful user. He is the administrator user.

2. System users
System users are the users created by the softwares or applications. For example if we install Apache it will create a user apache. This kind of users are
known as system users.

3. Normal users
Normal users are the users created by root user. They are normal users like John, Ramu etc. Only the root user has the permission to create or remove a user.

In linux systems every user will have a unique user ID. It is known as UID. The Range of UIDs will be as follows:

1. Root user          UID will be "0"

2. Systems users      UID will be "1 - 499"

3. Normal users       UID will be "500 - 60000"
The range of MIN_GID and MAX_GID is specified in the file  "/etc/login.defs".

There are three important files a user administrator should be aware of.

1. "/etc/passwd"
2. "/etc/shadow"
3. "/etc/group"

Each of the above mentioned files have specific formats.

1. "/etc/passwd"

The first line will be like this.

There are seven fields in it with each separated by ":"
Fields are as follows,


1. User_name is the name of the user.
2. Pointer to shadow file is the pointer to the "/etc/shadow" where the encrypted password for that user is stored.
3. UID is the user ID.
4. GID is the goup ID for the user.
5. Comment is a field where we can add some info about that user. Suppose if the user is a group leader, we can specify it there.
6. Home_dir denotes the path of users home directory. By default for root user it'll be "/root" and for normal user it'll be "/home/user_name".
7. Default login shell will be "/bin/bash". If we want to change it to korn shell edit it to "/bin/ksh". If no login shell is required for that user then give

2. "/etc/shadow"

Shadow file contains the user's encrypted password and password aging options.

The first line will be like this

The fields are as  follows,

1. User_name
2. Encrypted password
3. Days since that password was last changed.
4. Days after which password must be changed.
5. Days before password is to expire that user is warned.
6. Days after the password is expires that the user is disabled.
7. Days since the account is disabled.
8. A reserved field.

3. "/etc/group"

Contains information about groups in the system.

The first line will be like this

The fields are as follows.

1. Group_name, the name of the group
2. The encrypted group password
3. GID, Group ID
4. User_list, all the group member's user names. Separated by commas.

How to create a user?

In linux a user can be created with specific UID, GID, comment, Home directory and login shell. The options are as follows.

The command to add a user is #adduser or #useradd. Actually useradd is the real command and adduser is a soft link to the useradd command. But the usage of
both are same.

A command to add a user with all the fields we mentioned before is as follows.
#useradd -u UID  -g GID/Group_name -c COMMENT -d Home_dir  -s LOGIN SHELL  User_name

An example:

#useradd -u 555 -g linux  -c Teamlead -d /teamleads/john -s /bin/ksh john
Prior to the executing of the above command you should create the group 'linux'.

You can also add -p for password and -G for secondary groups which we will see later.
If u want to add the password, u 've to give the password in encrypted form.

For example,
#useradd -p encrypted_password Joseph

How to create a group?

There are two kinds of users in linux. They are,

1. Primary group
2. Secondary group

When we create a user a group also will be created in the same name of the user. Suppose we creating a user abc with uid 540, then a group abc will be created
with same gid. And if the user abc creates a file xyz, it's owner will be user abc and group will be group abc. That is abc is its primary group. Thats normally
all the files and directories created by a user belongs to its primary group.

But what if the user needs access to the directories created by other groups? or a user has to supervise a number of groups? then comes the secondary group concept.
All the other groups are added as the secondary groups of that user.

The command to add a group is #groupadd


#groupadd group_name
#groupadd -g 540 linux

Suppose we want to create a user rahul with linux, java, hp, ibm as  secondary groups, it can be done as follows

#useradd  -G linux,java,hp,ibm  rahul
You have to specify all the secondary groups in single command, not one after one in different commands.

But you can appended the secondary groups to a user using the  -a option with usermod command.

For example,
A user john is a member of groups linux and java. We can append the group ibm to him as follows.

#usermod -a -G ibm john

Checking the groups of a user

#groups username
Will list all groups that the user belongs to.

How to set a password for a group?

#groupadd  linux
#gpasswd linux

the password will be saved in "/etc/gshadow".

To change the name of a group
#groupmod -n newname oldname

Switching users

sometimes we may need to switch between users.
The command for switching is #su

1. #su
Switches to root user. But only gets privileges.

2. #su -
Switches to root user. Gets privileges and home directory access.

1. su raju
Switches to user raju

2. su - raju
gets also home dir access of raju.

If you are logined as root user and switching to normal user, you wont be prompted for the password. But you'll be prompted for password if otherwise.

Creating more users and setting passwords using a for loop.

Suppose we have to create 5 users linux1 to linux5 whose primary group is linux. And password same as their username.

First you have to create a group linux.
#groupadd linux


for i in 1 2 3 4 5
useradd - g linux  linux$i
echo linux$i | passwd --stdin linux$i

Creating more than 10 users
Suppose we have to create 25 users linux1 to linux25 whose primary group is linux. And password same as their username.

First you have to create a group linux.
#groupadd linux


for i in $(seq 1 1 25)
useradd - g linux  linux$i
echo linux$i | passwd --stdin linux$i

Modifying existing users

We can also modify the existing user with #usermod command.
for example,

#usermod -u 555 -g linux  -c Teamlead -d /teamleads/john -s /bin/ksh john

We can change the login name of a user using the option  -l
Syntax is as follows

#usermod -l new_name  old_name

Locking and unlocking the users

#usermod -L username
Executing the above command will lock the user with username.

#usermod -U username
Executing the above command will unlock the user with username.

Removing a user
we can remove a user using #userdel command

For example,

#userdel user_name
the above command will remove the user but not his home directory. This is for taking back up of the files from it in case needed.

#userdel -r user_name
the above commad will remove the user as well as user's home directory.

Deleting the password of a user or allowing password less login for a user

#passwd -d u_name

How to install and configure Nagios Monitoring tool in redhat linux rhel5 or centos

This article will help you to install and configure Nagios monitoring tool in redhat linux or other redhat distributions like fedora, centos etc.

Nagios Installation :
Installing packages. Apache, PHP, GCC & GD

Installing Apache web server:
#yum -y install httpd*
set hostname in FQDN
#service httpd on

Installing PHP, GCC and GD:
#yum -y install php*
#yum -y install gcc*
#yum -y install gd*

Getting the package:
Get the latest packages from net. Mov it to some directory and untar them.

#mv nagios-3.2.0.tar.gz  /usr/local/src
#tar xvf nagios-3.2.0.tar.gz

#mv nagios-plugins-1.4.14.tar.gz/usr/local/src
#tar xvf nagios-plugins-1.4.14.tar.gz

Adding nagios user and setting password for that user:
#useradd nagios
#passwd nagios
usermod -a -G nagios apache              //To permit the commands through web interface.

Configuration of Nagios:
cd /usr/local/src/nagios-3.2.0

make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf

Admin account setting for nagios:
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin          /passwd  for web interface
give passwd
service httpd restart

Nagios Plugin installation:
install nagios - pluggin

cd /usr/local/src/nagios-plugins-1.4.14
make install

Creating entry in /etc/init.d/:
chkconfig --add nagios
chkconfig nagios on

Checking the configuration:
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios Alert Plugin - Mozilla Addon:
Name : Nagios Checker
[give name and url]

Configuring remotehost in nagios:
cp /usr/local/nagios/etc/objects/localhost.cfg  /usr/local/nagios/etc/objects/remotehost.cfg
[comment the hostgroup entries in order to prevent duplicate entries]
[change the localhost entries to the remote machine hostname and IP address.]

How to configure syslog server or a centralized log server in redhat linux rhel5 or centos

This article will explain installing and configuring a syslog log server in redhat enterprise linux. It'll work in other redhat distributions like centos, fedora etc.

Centralized log server (syslog server)

Suppose we have a server and 5 client machines. And we want to monitor the logs of all those client machines. In situations like this, we will use centralized server as a log server. Whatever events are happening in client machines, the logs will be sent to the server. So that we can monitor all the logs from a centralized server. We make use of syslog service for this.

Configuration of server machine(syslog server)

Service name: syslog
configuration file: /etc/sysconfig/syslog


1. Open the /etc/sysconfig/syslog file and add "-r" option to the variable SYSLOGD_OPTIONS as shown below.

[root@server ~]# cat /etc/sysconfig/syslog
# Options to syslogd
# -m 0 disables 'MARK' messages.
# -r enables logging from remote machines
# -x disables DNS lookups on messages recieved with -r
# See syslogd(8) for more details
# Options to klogd
# -2 prints all kernel oops messages twice; once for klogd to decode, and
# once for processing with 'ksymoops'
# -x disables all klogd processing of oops messages entirely
# See klogd(8) for more details
# set this to a umask value to use for all log files as in umask(1).
# By default, all permissions are removed for "group" and "other".
[root@server ~]#

2. Restart the syslog service.

[root@server ~]# service syslog restart
Shutting down kernel logger: [ OK ]
Shutting down system logger: [ OK ]
Starting system logger: [ OK ]
Starting kernel logger: [ OK ]
[root@server ~]#

Configuration for client machines

service name: syslog
Configuration file: /etc/syslog.conf


1. Open the configuration file /etc/syslog.conf and add an entry to redirect the logs to the remote server.

[root@vm1 ~]# cat /etc/syslog.conf
# Log all kernel messages to the console.
# Logging much else clutters up the screen.
#kern.* /dev/console

*.* @

# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.info;mail.none;authpriv.none;cron.none /var/log/messages

# The authpriv file has restricted access.
##authpriv.* /var/log/secure

# Log all the mail messages in one place.
mail.* -/var/log/maillog

# Log cron stuff
cron.* /var/log/cron

# Everybody gets emergency messages
*.emerg *

# Save news errors of level crit and higher in a special file.
uucp,news.crit /var/log/spooler

# Save boot messages also to boot.log
local7.* /var/log/boot.log

[root@vm1 ~]#

2. Restart the service

[root@vm1 ~]# service syslog restart
Shutting down kernel logger: [ OK ]
Shutting down system logger: [ OK ]
Starting system logger: [ OK ]
Starting kernel logger: [ OK ]
[root@vm1 ~]#


In server open a terminal and watch /var/log/messages and restart syslog service in client. You can see the log from clinet coming to server.

[root@server ~]# tail -f /var/log/messages

Oct 15 14:42:30 vm1 kernel: Kernel logging (proc) stopped.
Oct 15 14:42:30 vm1 kernel: Kernel log daemon terminating.
Oct 15 14:42:31 vm1 exiting on signal 15
Oct 15 14:42:31 vm1 syslogd 1.4.1: restart.
Oct 15 14:42:31 vm1 kernel: klogd 1.4.1, log source = /proc/kmsg started.

Fields in log from remote machine:

Date Hostname Name_of_the_application: Actual_log_message

Thursday, September 30, 2010

Samba :: Shutdown Windows System from Linux Terminal

[root@server2/data1]#net rpc SHUTDOWN -I IP -U User

Shutdown of remote machine succeeded

Thursday, September 9, 2010

Linux Interview Questions:Google

Q2) Write a command to find all of the files which have been accessed within the last 30 days.
A1) The Command is , find / -atime +30
A2) # find / -type f -mtime +30
A3) find / -type f -mtime -30
A4) find / -type f -atime -30 = accessed
find / -type f -ctime -30 = changed
find / -type f -ctime -30 = modified
Q3) How to schedule cron backup to run on 4th saturday of month??
A1) crontab -e
** ** ** ** /5
Q4) how to see unallocated hard disk space on linux
A1) simply type
cat /proc/partitions
A2) df -h /dev/devicename
device name could be hda,sda
Q5) find out what file systems supported by kernel?
A1) # fdisk /dev/hdx
option: t
it will show the supported FS in the kernel
A2) cat /proc/filesystems
will show all the file system types that the kernel can
handle currently. Be aware that kernel will load the
necessary modules automatically if it have, for a new file
system type present in a new device you plug into it and
then the output of the above command will vary.
A3) you can give following commands
then press t
this command will show all the file system with code
supported by the current linux kernel.
Q6) how do u extract files from iso cd images in linux?
A2) mount -o loop
A3) mount -t iso9660 -o ro,loop=/dev/loop0 /home/ste/cd.iso /mnt/iso
Q7) how do u find remote machine operating system and version?
A1) XProbe
A2) by ssh to that machine then give command
#uname -r
A3) for OS,
cat /etc/issue and version, uname –r
Q8) how do you port scaning with netcat command?
A1) nc -z
Q9) how do find all failed login attempts via ssh?
A1) check network connectivity check correct ipaddress
ping ipaddress
A2) 'who' or 'w' is the command used to find the users who logged in
The system and their attempts, with the help of some options
A3) Failed ssh logs are either written in /var/log/messages, or
/var/log/secure (configurable in /etc/syslog.conf). I am
assuming that the failed login attempts are recorded in
grep ' authentication failure' /var/log/secure | sed -e
's/^\(.*\)\(rhost.*\)$/\2/p' | tr -s " " | cut -f2 -d"=" |
cut -f1 -d" " | sort -n | uniq -c
Will show you the count, and the IP/hostname of machines that tried
to access the system via ssh
A4) The command is ,
cat /var/log/messages | grep "Failed password"
it will show all the user which is not able to login.
Q10) How do display error messages instantly when command fails?
A1) Suppose you are trying to cat a non existing file:
cat /etc/shado 2>/dev/null || echo “Failed to open file”
command 2 "echo" is executed only if command 1 "cat" returns
a non-zero exit status
# cat /etc/shado 2>/dev/null || echo "Failed to open file"
Failed to open file
Q11) How do find hard disk revolutions speed?
A1) A typical desktop hard disk rotate at 7,200 revolutions per
minute (RPM). A typical server hard disk spin at 10,000 or
15,000 rpm to achieve sequential media transfer speeds. You
can use hard disk model number to obtain disk RPM. For
example, a typical Seagat disk Model # ST373455SS can
provide following information:
* ST - Brand identity
* 3 - Form Factor (3 = 3.5")
* 73 - Disk size / Capacity in GB i.e. 73GB
* 4 - Reserved for future use
* 5 - RPM ( 5 = 15k and 0 = 10K)
* 5 - Generation
* SS - Indicates interface i.e Serial Attached SCSI
How do I find out hard disk model and serial number?
Use any one of the following command from shell prompt to
find out hard disk model number:
$ cat /proc/scsi/scsi
OR use scsi_id command to querys a SCSI device via the SCSI
INQUIRY vital product data (VPD) page 0x80 or 0x83 and uses
the resulting data to generate a value that is unique across
all SCSI devices that properly support page 0x80 or page 0x83.
$ /sbin/scsi_id -g -p 0x80 -s /block/sdd
$ sudo grep -i sdd /var/log/boot.log
OR use sginfo / scsiinfo command from sg3_utiles package, enter:
# sginfo -a /dev/sdd | more
Q12) when zombie process fully cleared?
A1) When the server gets restarted!
A2) Do a ps and identify the zombie processes
# ps -el | grep 'Z'
Occasionally, these processes are in such a state that the
only way to get rid of them is to reboot to clear them.
In most cases, you can get rid of a zombie by normal means,
"kill -15 zombie PPID", "kill -9 zombie PPID".
Q13) how do you configure linux system as a router?
A1) Give the following command
echo 1 > /proc/sys/net/ipv4/ip_forward
A2) above anwser also write,
but must me know this,
vi /etc/sysctl.conf
# Controls IP packet forwarding
net.ipv4.ip_forward = 1
save &
sysctl –p
Q14) Which priority has the process?how do u view?
A1) nice command is used to find the priority
A2) Each process has a niceness value associated with it, which
is what the kernel uses to determine which processes require
more processor time than others. The higher the nice value,
the lower the priority of the process. In other words, the
nicer” the program, the less CPU it will try to take from
other processes; programs that are less nice tend to demand
more CPU time than other programs that are nicer.
The priority is noted by a range of -20 (the highest) to 20
(the lowest). Using ps, you can see the current nice value
of all programs:
# ps axl
4 0 1 0 16 0 2648 112 - S ?
0:01 init [3]
1 0 2 1 34 19 0 0 ksofti SN ?
0:02 [ksoftirqd/0]
5 0 3 1 10 -5 0 0 worker S< ?
0:00 [events/0]
You can see that init has a nice value of 0, while other
kernel tasks associated with PID 2 and 3 have a nice value
of 19 and -5 respectively.
Typically, a program inherits its nice value from its
parent; this prevents low priority processes from spawning
high priority children
Q15) Any one example of uninteruptable sleeping process?
A1) init (PID 1)
Q16) how many limitations of under directories in ext2/3 linux
file system?
A1) Ext2 Limits
Max file size: 2-64 TiB
Max number of files: 10 raised 18
Max filename length: 255 characters
Max volume size: 16-32 TiB
Allowed characters in filenames: Any byte except NULL and '/'
Ext3 Limits
Max file size: 2 TiB
Max number of files: Variable, allocated at creation time[1]
Max filename length: 255 bytes
Max volume size: 2 TiB – 16 TiB
Allowed characters in filenames: All bytes except NULL
Q17) what is a superblock ?
A1) A superblock is a record of the characteristics of a
filesystem, including its size, the block size, the empty
and the filled blocks and their respective counts, the size
and location of the inode tables, the disk block map and
usage information, and the size of the block groups.
Q18) what is the command to check network interfaces in our system?
how to set etho to 10 full duplex speed?
A1) ifconfig, ifconfig -a, ip dev ls,
ethtool -s eth0 speed 10 duplex full
to watch the info on eth0 ( mii-diag --watch eth0 )
Q19) what is the UID and GID of root user? Can a normal user can
change the ownership of a file? what is the command to
change ownership of a file?
A1) the root UID/GID is 0 (zero). which is why he can able to
intervene in all normal users files even though he don't
had permission. A normal user will don't have the permission
to change ownership of file. The command to change ownership
is < chown user.user file >
Q20) what is soft mount and hard mount? i have to make permanent
nfs mount permanent what shall i do?
A1) to make permanent nfs mount, write it into /etc/fstab
Server nfsmount mountpoint filesystem defaults 0 0 /var/ftp/pub /mnt nfs defaults 0 0
A2) This is a UNIX terminology as to what the client does when
it can't talk to an NFS Server. If you just mount a file
system without specifying hard or soft, the default is a
hard mount. Hard mounts are preferable because of the
stateless nature of NFS. If a client sends an I/O request to
the server (such as an ls -la), and the server gets
rebooted, the client will wait until the server comes back
on line. This preserves data transfers in the event of a
server failure. There are disadvantages to this, as a simple
mount request could hang. A soft link will return with an
error and fail. This kills the wait time, but can cause
problems with data transfers.
To make permanent nfs mount, the above answer is right
Q21) what is major and minor?
A1) Major number
A number indicating which device driver should be used to
access a particular device. All devices controlled by the
same device driver have a common major device number.
Minor number
A number serving as a flag to a device driver.The minor
device numbers are used to distinguish between different
devices and their controllers.
# ls -l /dev/sda1
brw-rw---- 1 root disk 8, 1 2008-09-04 08:28 /dev/sda1
rigel:~# ls -l /dev/sda2
brw-rw---- 1 root disk 8, 2 2008-09-04 08:28 /dev/sda2
You can see the major and minor device number (8,1) and
(8,2) in the ls listing for /dev/sdax
# ls -l /dev/scd0
brw-rw---- 1 root cdrom 11, 0 2008-09-04 08:28 /dev/scd0
You can see the major and minor device number (11,0)in the
ls listing for /dev/scd0
Q22) what is the command to make a process to run in the
background from foreground?
A1) To make the command run in the background suppose the
Command is "command_name" then the syntax for the same will
be such as follows;
[root@neo root]# command_name &
Q23) 1.what is Kernel parameters? many cpu have use in your machine?
A1) Kernal parameters are nothing but all the parameters in
/etc/system hear we can edit according to our requrement.
to check the how many cpus in the machine jus type this command
to check the cpu speec #psrinfo –v
A2) 1.kernel parameters
parameters provide mechanisms to adjust the functiong of linux kernel.
the sysctl command used to view kernel parameters.
2.simply type in root
# cat /proc/cpuinfo
Q24) 1.I want to change runlevel but the Users shall not be disturbed?how?
2.Disk have 5gb disk utilization even though files unable to reate, why?
3.what are the internal and external command in linux?
4.sar command o/p? list the open files?
6.what is kernel compiling?
7.How do u See complete configuration in ur system? will u make a daily updates with cron daily?
9.which port is associated with ttys0?
10.specific some problems linux admin(if u are linuxadmin)faced
And how did u overcome it?
A1) 1. For changing the runlevel you should have to go in
/etc/inittab. There you can change the runlevel what you
want.It will not affecting current user. After restarting
system your system will boot in which run level you have set.
3. Internel command means whichever command are builtin the
system BIOS. And External command means Which are
nonbuiltin.It outside the shell. It require shell.
4. VMstat & sar are showing the free memory of the system.
5. ls command is use list a file & cat & vi is to open a file.
A2) 1) Same answer as above
2) Question not understood, may be ACLs
3) It is not BIOS,
A built-in (internal/resident) command is one that is
contained within the bash tool set and execute faster than
external commands.
An non-built-in (external/non-resident) command is a command
outside the shell and requires a $PATH (environmentvariable) to findit.
4)Displays the activity for the CPU
# sar
Linux 2.6.18-6-686 (server.domain.local) 09/16/2008
5) # lsof
6)The Linux kernel is a complex program which provides the
underlying services to the rest of a Linux distribution. But
it is easy to add new features or improvements to it,
requiring a kernel recompiling. There are three reasons for
a kernel compile. Firstly, you may have some hardware that
is so new that there's no kernel module for it in on your
distribution CD. Secondly, you may have come across some
kind of bug which is fixed in a revision of the operating
system. Lastly, you may have some new software which
requires a newer version of the operating system.
7)A vague question
8) Suppose we have a daily update script called
Copy the script to /etc/cron.daily/
# cp dailyupdate.script /etc/cron.daily/
Make the file executable
# chmod +x /etc/cron.daily/
9) COM1
10) Depends...
A3) 4) Detailed sar output
Linux 2.6.18-6-686 (server.domain.local) 09/16/2008
11:35:01 AM CPU %user %nice %system
%iowait %steal %idle
11:45:01 AM all 0.71 0.00 0.19
0.18 0.00 98.92
11:55:02 AM all 1.53 0.00 0.19
0.26 0.00 98.02
Average: all 1.12 0.00 0.19
0.22 0.00 98.47
A4) 1. use init , at runtime.
2. disk quota has been set and reached for the current user.
3. same as above
4. same as above
5. same as above
6. lay man definition, adding support for required hardware
and modules in the Linux kernel.
7. sysreport, question too generalized,
8. same as above
9. same as above
10. :)
Q25) what is user mode & kernel mode?
The kernel-mode programs run in the background, making sure
everything runs smoothly - things like printer drivers,
display drivers, drivers that interface with the monitor,
keyboard, mouse, etc. These programs all run in such a way
that you don't notice them.
When the computer boots up, Windows calls the KERNEL, the
main kernel-mode program that allows all the other programs
to run, even the user-mode programs.
These are the programs that you run when you want specific
programs - e.g., MS Paint, MS Word, and Calculator. These
are heavily restricted, as to not crash the system. Windows
uses memory-protection services offered by the processor to
prevent malicious programs from interfering with the rest of
the system and corrupting it.
A2) A process can run in two modes:
1.User Mode.
2.Kernel Mode.
1.User Mode:
=>A mode of the CPU when running a program.
=>In this mode ,the user process has no access to the
memory locations used by the kernel.When a program is
running in User Mode, it cannot directly access the kernel
data structures or the kernel programs.
2.Kernal Mode:
=>A mode of the CPU when running a program.
=>In this mode, it is the kernel that is running on behalf
of the user process and directly access the kernel data
structures or the kernel programs.Once the system call
returns,the CPU switches back to user mode.
When you execute a C program,the CPU runs in user mode till
the system call is invoked.In this mode,the user process has
access to a limited section of the computer's memory and can
execute a restricted set of machine
instructions.however,when the process invokes a system
call,the CPU switches from user mode to a
more privileged mode ­the kernel. In this mode ,it is the
kernel that runs on behalf of the user process,but it has
access to any memory location and can execute any machine
Instruction. After the system call has returned,the CPU
switches back to user mode.
Kernel mode, also referred to as system mode, is one of the
two distinct modes of operation of the CPU in Linux. When
the CPU is in kernel mode, it is assumed to be executing
trusted software, and thus it can execute any instructions
and reference any memory addresses (i.e., locations in
memory). The kernel (which is the core of the operating
system and has complete control over everything that occurs
in the system) is trusted software, but all other programs
are considered untrusted software.
User mode is the normal mode of operating for programs, web
browsers etc. They don't interact directly with the kernel,
instead, they just give instructions on what needs to be
done, and the kernel takes care of the rest. Kernel mode, on
the other hand, is where programs communicate directly with
the kernel. A good example of this would be device drivers.
A device driver must tell the kernel exactly how to interact
with a piece of hardware, so it must be run in kernel mode.
Because of this close interaction with the kernel, the
kernel is also a lot more vulnerable to programs running in
this mode, so it becomes highly crucial that drivers are
properly debugged before being released to the public
Q26) what is the diff b/w ext2 and ext3?
A1) ext3 is the advanced version of ext2
this journaling feature is very much useful while
retrieving data and writing data into a File System
Latest versions of all Linux flavors are coming with ext3
compatible file systems.
A2) ext 2 & ext3 are the two file systems in linux.ext 2 will
take more time while logon the system. this is bcoz ext2
will check all harddisk peripherals at the time of switch on
your sytem. But ext3 is less time consuming,bcoz instead of
checking all harddisk peripherals it will check only the
bootloader peripherals.
Q27) what is initrd image?
A1) initrd image is the initial ram disk image While the system
getting booted the kernel image will get loaded into the main
memory after POST to improve I/O performance.this initrd image
will contain the same version number of kernel and if we face any error
in booting regardingthis initrd we can reinstall it with 'mkinitrd' command
A2) initial RAM disk (initrd) is a temporary root file system
that is mounted during system boot to support the two-state
boot process. The initrd contains various executables and
drivers that permit the real root file system to be
mounted, after which the initrd RAM disk is unmounted and
its memory freed. In many embedded Linux systems, the
initrd is the final root file system
A3) initrd image is a image file which has initial modules which
are loaded in to the kernel while booting.
Q28) what is jumbi process? Oracle
A1) its a dead process it's parent process has been killed abruptly.
A2) zoombie process or defunct process. - Process that finish execution
Or we can say the process died but still it has entry in the
process table.
A process finished execution but parent of that process is
Not ready to accept the exit status from it . At that time
process go to zoombie state.
Q29) My machine is running half duplex mode how to change half
duplex to full duplex? ORACLE
A1) [root@ns2 ~]# mii-tool -V
mii-tool.c 1.9 2000/04/28 00:56:08 (David Hinds)
eth0: negotiated 100baseTx-FD flow-control, link ok
[root@ns2 ~]# ethtool -s eth0 duplex half autoneg off
[root@ns2 ~]# mii-tool -V
mii-tool.c 1.9 2000/04/28 00:56:08 (David Hinds)
eth0: 100 Mbit, half duplex, no link
[root@ns2 ~]# mii-tool -V
mii-tool.c 1.9 2000/04/28 00:56:08 (David Hinds)
eth0: 100 Mbit, half duplex, link ok
Q30) some one is asking my machine is slow what is your steps? ORACLE
A1) The increase in the size of SWAP partition may show you the
little effect in increasing the system speed and better run
in Single user mode rather than GUI mode
A2) use top command, then check which process use the most
resource and find the problem.
A3) Re-read all process
#killall –HUP
Q31) what is mean by system calls INFOTECH
A1) A system call is the mechanism used by an application
program to request service from the operating system.
On Unix-based and POSIX-based systems, popular system
calls are open, read, write, close, wait, exec, fork, exit,
and kill. Many of today's operating systems have hundreds of
system calls. For example, Linux has 319 different system
calls. FreeBSD has about the same (almost 330).
Tools such as strace and truss report the system calls made
by a running process.
Q32) What is trusted/untrusted operating system
A1) As per my perspective , I used to say any/all UNIX flavors
rather than MS WINDOWS
Because of
1. File/Directory permission (Action:Read/Write/Execute,
permissions can be given on behalf of the particular
2. All the unix configuration as files rather than
Registry (windows)
a. which cause the application to fail when a newer
or incompatible dynamic library is installed.
b. Some times you may need to restart the entire
system to update the changes with registry.
3. Linux Strong password protection. It won't get booted
(Drop you @ the GUI) without the successful
authentication (even though you don't have any more
users rather than admin/root).In Linux setting
password to the admin/root users is must during the
installation itself.
Where as in windows, let allow you to leave the
password as blank for admin/other user, System also
booting without authenticating.
4. Linux is open source, free under GNU. It doesn't mean
that its only free to install or use, but in fact you
can have these source codes and they are allowing you
to change it and redistribute it.
Windows is Lincesed os. Windows is developed by
5. Linux is more secure, windows is less secure than
linux in case of virus, worms.
Because in Linux all the files/directory won't get
executable permission, Perhaps you need to set it
manually. Though by default all the incoming trojen,
virus, malwares and worms won't affect the system.
6. Distribution
Linux : Linux has many distributors like Radhat,
mandrake, Corel etc
Windows : whereas windows has only Micrsoft.
7. Run Level
Linux works on both GUI & Console mode (Checkout the
various run levels runlevel 0 - runlevel 6 Generally
known as init level)).
Windows : Only GUI.
8. By default LINUX have multiuser, multitasking,
multiprocessing, multiprogramming features. Perhaps
this will not be available on windows(Except some
versions), In that case you need to PAY & BUY
the extra features in windows.
9. You can play around the Linux through LIVE CDS on a
Windows machine.
Only is a live CD that runs over windows, in RAM,
and doesn't change your system at all..the other is
an install disk. I've used the live CD on two XP
machines and they both ran flawlessly. When you
want to quit, just go to logout under system tools,
and shut down.
Linux will turn itself off, eject the disk, and turn
of your PC.
Remove the disk, boot up, and you're running your
Windows again.
This is the way we are checking the newly bought
NIC/others hardwares support with all the Linux
distributors. Once it got detected, its very easy to
get the device driver names and other details about
that new hardwares, then compile the new kernel
image (bzImage) on your own build version systems.
Q33) Working in Linux/Unix platform, if any command dose not
work, say # ls reports as command not found.
what to do? GOOGLE
A1) Need to check the path first body ....
A2) reinstall that shell
A3) Check whether PATH variable as got the entry /bin
It should be something like this
[root@bc ~]# echo $PATH
Q34) in unix how to change old name to new name
A1) mv // for rename the file in the same
mv // for rename and
move the file in other diretory.
A2) 1. open the file /etc/sysconfig/network and change the
parameter HOSTNAME= to new name.
2. restart the network services.
3. open the file vi /etc/hosts, and change the old name to
new name. localhost.localdomain
A3) mv
[root@localhost]# touch file1 //created a file named file1
root@localhost]# ls //displays the file created
[root@localhost]# mv file1 file2 //command to rename file1
[root@localhost]# ls //displays the renamed file
A4) see there is no rename command in unix ,
so what u can use is "move" (mv) command
mv "(absolute path) old file name" "new file name
A5) rename
Q35) what is the standard output in a file as well as disply it
on the terminal options like
A)pr B) tail C) tee D)nl
A1) tail as it display ten current line
tail -f
option with this
tail -f -n 100
A2) I think, framing the question should be like
"What is the command used to write to the standard output
as well as to a file simultaneously ?
Answer) tee
It is a command that deals with pipes in unix. It
redirects the output of a command to an other command and
at the same time it redirects to a file also.
Q36) what is command like " #(cd unixos; pwd) " tell me OUTPUT
A1) first it will change the directory to unixos and then gives
the output as //unixos
A2) it is two commands runnung one by one.first the cd unixos
command will be executed,then the present working directory
will the output will be showing the presentworking
dirctory that is unixos dir.
A3) WRONG when I hit this command no output or error is printed
Q37) in unix how to change old name to new name