Questions & Answers Some One Liners
1) How do you find out what’s your shell? - echo $SHELL
2)What’s the command to find out today’s date? - date
3)How do you find out the current directory you’re in? - pwd
4)How do you find out your own username? - whoami/who am i
5)How do you send a mail message to somebody? - mail
surendra.anne@gmail.com -s ‘Your subject’ -c ‘test@gmail.com‘
6)What’s the command to find out users on the system? - who/users
7)How do you remove a file? - rm
8)How do you remove a - rm -rf
9)How do you count words, lines and characters in a file? - wc
10)How do you search for a string inside a given file? - grep string filename
11)How do you search for a string inside a directory? - grep string *
12)How do you search for a string in a directory with the subdirectories
recursed? - grep -r string *
13)What are PIDs? - They are process IDs given to processes. A PID can
vary from 0 to 65535.
14)How do you list currently running process? - ps
15)How do you stop a process? - kill pid
16)How do you find out about all running processes? - ps -ag
17)How do you stop all the processes, except the shell window? - kill 0
18)How do you fire a process in the background? - ./process-name &
19)How do you refer to the arguments passed to a shell script? - $1, $2 and
so on. $0 is your script name.
20)What’s the conditional statement in shell scripting? - if {condition} then … fi
21)How do you do number comparison in shell scripts? - -eq, -ne, -lt, -le, -gt,
-ge
22)How do you test for file properties in shell scripts? - -s filename tells you if
the file is not empty, -f filename tells you whether the argument is a file, and
not a directory, -d filename tests if the argument is a directory, and not a file,
-w filename tests for writeability, -r filename tests for readability, -x filename
tests for excitability
23)How do you do Boolean logic operators in shell scripting? - ! tests for
logical not, -a tests for logical and, and -o tests for logical or.
24)How do you find out the number of arguments passed to the shell script? -
$#
25)What’s a way to do multilevel if-else’s in shell scripting? - if {condition} then
{statement} elif {condition} {statement} fi
26)How do you write a for loop in shell? - for {variable name} in {list} do
{statement} done
27)How do you write a while loop in shell? - while {condition} do {statement}
done
28)How does a case statement look in shell scripts? - case {variable} in
{possible-value-1}) {statement};; {possible-value-2}) {statement};; esac
29)How do you read keyboard input in shell scripts? - read {variable-name}
30)How do you define a function in a shell script? - function-name() { #some
code here return }
31)How does getopts command work? - The parameters to your script can be
passed as -n 15 -x 20.Inside the script, you can iterate through the getopts
array as while getopts n:x option, and the variable $option contains the value
of the entered option.
Ø Few More Questions
& Answers
1) What is the difference between TFTP and FTP servers?
A) Both are file transfer servers but slight difference is TFTP server uses UDP
protocol and FTP uses TCP protocol. TFTP is good for slow connection paths.
2) What is the port no for FTP?
A) 20 for Data and 21 for Control (normally when an interviewer asks ftp port number just say 21.
3) What is the port no for TFTP?
A) 69
4) How to restrict users to their home directories?
A)By setting up "chroot_local_user=YES".
5)How to restrict total number of users accessing FTP server?
A1) If Vsftpd is running under xinted service, then you can use xineted to get per-
service per IP connection limits or
A2) If you run vsftpd in "standalone" mode with the "setting listen=YES", then
you can investigate the setting (e.g.) : "max_clients=10"
6)I want to copy multiple files with out prompting for any info, how can I do that
one?
A)Simply do "ftp -i ftpserver" this command will suppress any info displayed on ftp
server.
or you can just type prompt ftp prompt to suppress info messages have a look here.
7) Some times Local users cannot log in. How to resolve this issue?
A) Check "local_enable=YES" in your /etc/vsftpd/vsftpd. conf to allow local users
to log in.
8) How do we integrate with LDAP( Lightweight Directory Access Protocol )
users and login?
A) Use vsftpd's( Very Secure FTPD) PAM(Pluggable Authentication Modules)
integration to do this, and have PAM authenticate against an LDAP repository.
9) Can we host different ftp sites on single machine, I mean virtual hosting
concept like Apache?
A1) Yes. If you integrate vsftpd with xinetd, you can use xinetd to bind to several
different IP addresses. For each IP address, get xinetd to launch vsftpd with a
different config file. This way, you can get different behavior per virtual address.
A2) Alternatively, run as many copies as vsftpd as necessary, in standalone
mode. Use "listen_address=x.x.x.x" to set the virtual IP.
10) How to restrict different users with different permissions in vsftpd
A) By setting up "user_config_dir" entry in "vsftpd.conf".
11)How to change vsftpd default port?
A)By setting "listen_port" option in "vsftpd.conf".
12) Vsftpd is reporting times as GMT times and not local times!. How to resolve
this?
A) This behavior can be changed with the setting "use_localtime=YES".
13) How to disable certain FTP commands?
A) There are some individual settings (e.g. dirlist_enable) or you can specify a
complete set of allowed commands with "cmds_allowed".
14) How does vsftpd support per-IP limits?
A1) If you are running vsftpd standalone, there is a "max_per_ip" setting.
A2) Yes. If you are running vsftpd via xinetd, there is an xinetd config variable
"per_source".
15) How Does vsftpd can do bandwidth limiting?
A) settings such as "anon_max_rate" and "local_max_rate" can be used to set
this limits.
16) How to restrict some IP's not use my FTP server?
A1) vsftpd can integrate with tcp_wrappers (if built with this support). It is enabled
with the setting "tcp_wrappers=YES".
17) Does vsftpd support IPv6?
A) Yes, as of "version 1.2.0".
18) Help! I'm getting messages along the lines of "500 OOPS: vsf_sysutil_bind"
when trying to do downloads (particularly lots of small files).
A) "vsftpd-1.2.1" should sort this out.
19) Can we use vsftpd to hiding or denying certain files?
A) Yes. Look at the hide_file and deny_file options.
20) How you can check if there is any syntax error in vsftpd.conf file?
A) Just type vsftpd with out quoats.
Q: Describe briefly how POP-before-SMTP works to authenticate an SMTP
session.
MUA - Mail User Agent (email client)
- the user's interface to the protocols - "presentation layer"
- usually gives access to functionality of both MTA and MRA/MAA
- but may not itself implement any protocols (may read/write file
system)
"An e-mail client, also called a Mail User Agent (MUA), is a
computer
program that is used to read and send e-mail.
Originally, the MUA was intended to be a simple program to read
the user's
mail messages, which the mail delivery agent (MDA) in conjunction
with
the mail transfer agent (MTA) would transfer into a local
mailbox.
The most important mailbox formats are mbox and Maildir. These
rather
simple protocols for locally storing e-mails make import, export
and
backup of mailfolders quite easy.
E-mails to be sent would be handed over to the MTA, perhaps via
a mail submission agent [MSA], therefore an MUA would not have to
provide any transport-related functions.
*Since the various Microsoft Windows versions intended for home
use never
*provided an MTA, most modern MUAs have to support protocols like
POP3
*and Internet Message Access Protocol (IMAP) to communicate with a
remote
*MTA located at the e-mail providers machine."
- user agents (MUAs) are user-visible email clients of all
descriptions
- e.g. mutt, "mail", "Mail", "mailx", pine, elm
- e.g. KMail, Eudora, MS Outlook
- e.g. web-browser email (Netscape Messenger,Mozilla,Thunderbird)
- e.g. webmail, Horde, SqurrelMail
Q: Briefly describe the function of a mail system MUA.
MSA - Mail Submission Agent
http://tools.ietf.org/html/rfc2476
"acts as a submission server to accept messages from MUAs, and
either
delivers them or acts as an SMTP client to relay them to an MTA."
- enforce policy (no open relay)
- enforce standards (no forged headers, etc.)
- enforce filtering (SpamAssassin, etc.)
- may modify messages (section 8 of RFC)
Q: Briefly describe the function of a mail system MSA.
MTA - Mail Transfer Agent (mail server, mail exchange server)
"A process which conforms to [SMTP-MTA], which acts as an SMTP
server to
accept messages from an MSA or another MTA, and either delivers
them or
acts as an SMTP client to relay them to another MTA."
http://en.wikipedia.org/wiki/Mail_transfer_agent
"It receives messages from another MTA (relaying), a mail
submission agent (MSA) that itself got the mail from a mail user
agent (MUA), or directly from an MUA, thus acting as an MSA
itself. The MTA works behind the scenes, while the user usually
interacts with the MUA. The delivery of e-mail to a user's
mailbox typically takes place via a mail delivery agent (MDA);
many MTAs have basic MDA functionality built in, but a dedicated
MDA like procmail can provide more sophistication."
- transfers email between machines (other MTAs) via SMTP
- Internet-facing, open ports: security issues
- sendmail, postfix, qmail, exim
- may have MDA ability to transfer email to user's mailbox
Q: Briefly describe the function of a mail system MTA.
MDA - Mail Delivery Agent
"A Mail Delivery Agent (MDA) is software that accepts incoming e-
messages and distributes them to recipients' individual mailboxes
(if the destination account is on the local machine), or forwards
back to an SMTP server (if the destination is on a remote
server).
A mail delivery agent is not necessarily a mail transfer agent
(MTA),
although on many systems the two functions are implemented by the
same program."
- Unix/Linux: /bin/mail, procmail
Q: Briefly describe the function of a mail system MDA.
MRA/MAA - Mail Retrieval Agent / Mail Access Agent
http://tools.ietf.org/html/rfc1939 - POP3 port 110
http://tools.ietf.org/html/rfc3501 - IMAP-V4-R1 port 143
- often built-in to mail clients (MUAs)
- can be stand-alone
- e.g. fetchmail gets the mail; MUA reads mail from file system
Q: Briefly describe the function of a mail system MRA/MAA.
Mail server comparison
- see comparison near bottom
- PUSH protocols - sending email: MTA - SMTP
- PULL protocols - reading email: MRA/MAA - POP3, IMAP
MDAs write local mailboxes; they may not implement Internet
protocols
(unless they have to forward off-machine without benfit of an MTA).
Single-user PCs often don't run separate MTA or MRA/MAA programs.
Your chose of mail reader (e.g. Pine, Elm, Outlook) itself PULLs
your
incoming email from a remote server (acting as an MRA/MAA) and then
PUSHes your outgoing email to the remote server (acting as an MTA).
Q: What is the difference between a PUSH protocol and a PULL
protocol?
Q: T/F, SMTP is a PUSH protocol.
Q: T/F, POP3 is a PUSH protocol.
Q: T/F, HTTP is a PUSH protocol.
A History of MTAs
-----------------
I. Incoming - delivering your incoming email via SMTP:
* Sending email into Unix/Linux machines:
Unix/Linux was traditionally multi-user and ran its own MTA
(e.g. sendmail) that accepted incoming SMTP connections. Remote
systems
could use SMTP to drop off your email with your local MTA
(sendmail),
and the MTA would hand the email to an MDA (/bin/mail, procmail)
to put it in your mailbox in the local file system. Your MUA
(e.g. /usr/ucb/Mail) would read the mail from your inbox (no need
for POP3 or IMAP in any MUA). There are a few different
conventions
for inbox formats so that many different MUAs can read your email,
all without knowing POP or IMAP.
- sendmail (running as root!) has had many security patches
- the first Morris Internet worm (Nov 1988) used sendmail
security holes
Q: Why don't many Unix MUAs need to know how to run POP or IMAP?
Current single-user Unix/Linux PCs often have a local-only MTA
that handles the sending and delivery of local on-machine email but
doesn't accept SMTP from off-site. (Best to keep ports closed on
Internet-facing machines!)
On recent single-user Unix/Linux workstations, the MUAs mimic their
Windows counterparts and include MRA/MAA features. Your chosen MUA
(e.g. Elm, Pine, Mutt) is responsible for fetching your email via
POP3
or IMAP (this is an MRA/MAA function); or, you use an intermediate
MRA/MAA program such as "fetchmail" and your MUA reads the mail out
of the local file system after the MRA/MAA has put it there.
- no Internet-facing MTA means fewer open ports and fewer attacks
- don't run an Internet-facing MTA if you don't need it
* Sending email into MS Windows machines (or not):
Windows had (has?) no MTA - you can't send an email to a Windows PC
using SMTP. Your personal Windows MUA has to fetch the email
itself
via POP3 or IMAP and keep a copy in the local file system.
- no open ports for incoming email; no open mail port security
issues
* Note that MUAs that implement POP/IMAP typically store the email in
the local file system in a format that only that MUA can handle.
(Thunderbird can't use an Outlook mail folder, and vice-versa.)
The concept of a common inbox format usable by different MUAs was
lost.
Q: Why don't most Unix MUAs need to know SMTP?
Current single-user Unix/Linux PCs now have MUAs that mimic their
Windows counterparts - the MUAs ignore the file system and the
local
MTA and expect you to give the name of a remote "smart" MTA to
which
all email will be sent via SMTP for actual delivery.
The Algonquin Linux lab has both types of mail systems: Command-
line
email (e.g. the "mail" command) queues up mail for the local
MTA (sendmail) to send. (This is currently broken.) GUI MTAs
(e.g. Thunderbird, Mozilla) ignore the local file system and the
local
MTA and use a "smart" remote MTA (e.g.
outmail.algonquincollege.com)
to deliver the mail. (This supposedly still works.)
* MS Windows has no local MTA - no program exists whose job it is
just
to deliver queued email. Each MUA has to know how to do its own
SMTP connection and each MUA has to be configured (separately!)
with
the address of a smart MTA to which it connects. MUAs on Windows
machines all contain networking code to drop off email at some
"smart"
MTA that does the actual delivery. There is no local MTA queue and
much duplication of SMTP code in all the MUAs.
On Windows, it is up to each MUA to deal with what happens if the
message being composed can't be dropped off right away at the
remote
smart MTA. Better MUAs will queue the email for later
transmission.
Poor MUAs will tell you that your mail can't be sent.
Q: Why do MUAs on Windows all need to know how to talk SMTP?
Q: Unix/Linux mail user agents didn't need to know how to talk to
SMTP
servers - you never had to configure your "outgoing mail"
preferences.
All the Windows MUAs need to be configured with a mail server.
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
#fdisk
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?
A1) From ISO MAGIC
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
/var/log/secure:
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
OR
$ 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
F UID PID PPID PRI NI VSZ RSS WCHAN STAT TTY
TIME COMMAND
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
192.168.0.1 /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.
Eg:
# 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?
2.how 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
#psrinfo
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?
5.how list the open files?
6.what is kernel compiling?
7.How do u See complete configuration in ur system?
8.how 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.
6.
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
11:31:56 AM LINUX RESTART
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 dailyupdate.sh
Copy the script to /etc/cron.daily/
# cp dailyupdate.script /etc/cron.daily/
Make the file executable
# chmod +x /etc/cron.daily/dailyupdat.sh
9) COM1
10) Depends...
A3) 4) Detailed sar output
Linux 2.6.18-6-686 (server.domain.local) 09/16/2008
11:31:56 AM LINUX RESTART
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. :)
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?
5.how list the open files?
6.what is kernel compiling?
7.How do u See complete configuration in ur system?
8.how 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.
6.
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
11:31:56 AM LINUX RESTART
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 dailyupdate.sh
Copy the script to /etc/cron.daily/
# cp dailyupdate.script /etc/cron.daily/
Make the file executable
# chmod +x /etc/cron.daily/dailyupdat.sh
9) COM1
10) Depends...
A3) 4) Detailed sar output
Linux 2.6.18-6-686 (server.domain.local) 09/16/2008
11:31:56 AM LINUX RESTART
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?
A1) 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.
USER-MODE
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.
A3) KERNEL-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
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
ext2+journaling=ext3
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
Q25) what is user mode & kernel mode?
A1) 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.
USER-MODE
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.
A3) KERNEL-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
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
ext2+journaling=ext3
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
0 comments:
Post a Comment