Linux Interview Questions For Experienced-1
Linux Interview Questions For Experienced-1
To enhance the security of system you should ensure that you are using the
latest versions kernel and software packages that contain the most recent
security updates.
Your FTP Server recently hacked. Due to the amount of damage, the
entire server needs to be restored. How should you restore the
original kernel system files?
You cannot restore the entire operating system from tap back up device. So
you should reinstall the core operating system, and then restore system
configuration files and user data from tape backup device.
Your company hire a contract employee for two months. What should
the Linux administrator do to enhance security on the employee's
account?
While creating new user account for this user, administrator should set the
expiration date for his account, so that if the employee leaves or does not
have their contract renewed, the account will be automatically disabled.
Which backup strategy only backs up files that have changed since
the last full backup?
Differential backup will backup files that have changed since the last full
backup.
What type of backup strategy can you use to fully back up a system
every night?
You can use full backup strategy that will always perform a full backup of all
files. This takes much more time and space than other methods, but is it the
most complete method and allows for easy file restoration.
You have just finished the installation of sever. This server is going to
be use as file server. Default installation have send mail service
running, while this server will never send any e-mails. How should
you deal with send mail service?
You should disable the send mail service if server is not being used for mail
purpose. Leaving them running can increase the chance of a security
vulnerability being exploited, and unauthorized use of sendmail relay.
What command can you use to back up an entire file system most
efficiently?
The easiest command to use to back up an entire file system is the dump
command. Files can be restored from a dump operation by using the restore
command.
What command can you use to make a tape archive file of a /home
directory, and send it to the /dev/tape device?
The correct command is tar -cvf /dev/tape /home.
The -xvf option is used to extract files from an archive.
Basic Questions:
When you try to boot a Linux system, you receive a message stating
that it canot mount the /home partition because of errors. While
debugging , you found that it occur due to data error. What can you
do to fix the problem?
You can use fsck utility that enable you to recover from the errors.
Which utility could you use to repair the corrupted file system?
You can use fsck to repair the corrupted file system.
A user complains you that his system was running fine, before he
rebooted. When it starts up, no display appears on the screen and the
system is beeping. What may this indicate?
Because the system was running fine before reboot and during the it got
problem even before the operating system is loaded, the problem is hardware-
based, and is most likely caused by a problem with the system board.
A user has sent an e-mail, but within minutes the e-mail is returned
stating that the address could not be found. What is the most likely
cause of the error?
If the e-mail was returned, all mail services are working properly, but the
destination e-mail address was wrong.
A user can not access a remote server. Which command he can use to
verify that remote server is up?
He can use ping command to check whatever remote server is up or not.
A Linux administrator is noticing odd system behavior. Which log file should
he check to find general system log messages?
The general log stored in /var/log/messages file.
You are tasked to examine a log file in order to find out why a particular
application keep crashing. Log file is very lengthy, which command can you
use to simplify the log search using a search string ?
You can use grep command to output the log file. You can specify the keyword of
desired application to look for, grep command than displays all instances of that word
in log file.
A user is trying to check his mail by using the pop3 protocol and port
143. But mail program could not connect to the mail server to retrieve
mail. What is the most likely cause of the problem?
User is using wrong port number. Port number 143 is used for imap, he should
use port 110 instead of 143.
A developer is constantly making changes in his applications source
file, then running application to see if is throwing any error. Which
command can he use to see the log file in real time, instead of
reopening the log file each time?
He can use tail command with -f options to see a file being updated in real
time. He do not need to reopen the file to see any changes.
When checking the partition information on your hard drive with fdisk,
you notice that one of the partitions is formatted as "Linux Swap" and
is approximately 512MB in size. What is the purpose of this partition?
The Linux swap file is used for virtual memory to store additional information
that cannot fit into current memory. This swap file allows information to be
cached on disk, and can be retrieved very quickly. Heavy use of the swap file
indicates a low memory condition.
What sort of kernel error can cause a Linux system to crash and write
a memory core dump?
Kernel panic error can cause a Linux system to crash. A kernel panic indicates
that a kernel process has crashed. This is a very serious error that causes the
entire Linux system to crash. These core dumps should be analyzed carefully
to find the root cause of the problem.
You noticed a kernel error message during the boot process, but it
scrolled before you could read this? What log file could you check to
find out that message?
The log file that contains kernel boot messages is /var/log/dmesg.
You execute a command that is going to take a long time. How can
you get back to your shell prompt to perform other task?
You can use bg command to send a running process to the background.
You need to kill all instances of Web Server? What command will you
execute to do this?
You can use killall httpd command to kill all httpd process. httpd process run
web server.
As a Linux admin you want to know what processes are being run by
user sumit. What command can you use ?
You can use #ps -au command to list all the process owned by user. Following
command will do the assigned task
#ps -au sumit
Which log file keeps track of all user logins and logouts?
/var/log/wtmp log file keeps track of all user logins and logouts.
What is the first process that is run when a Linux system starts, and
is responsible for starting all other system processes and services?
The init process is the first process to be run. It is the parent process of all
other Linux system processes, services, and daemons that are needed to run
the system.
A developer with username sanjay has told you that one or his
processes seem to be locked up and he cannot it. He reported that it
a bug in his code and may quickly use up all CPU and RAM resources
on the server. How will you tack the process and terminate it?
Your first step is to identify the process, use ps command
#ps -au sanjay
Now run top command to compare the process running, and verify which one
is using the most resources. After you have identified the problem process,
you can use the kill command to terminate it. Because the user was unable to
stop the process, you should probably force a kill signal to make sure that the
process stops:
#kill -9 [PID of process]
Now, to verify that it has stopped, run the ps command again on the user:
ps -au sanjay
What command would you use to shut down the system in 100
seconds?
#shutdown -h 100
What configuration file defines the default runlevel for the init
process?
/etc/inittab file defines the default runlevel for the init process.
Which command can you use to shut down and halt a Linux System?
The halt command will shut down a Linux system without rebooting
What init level should you set to bring the system to single-user
mode?
init 1 will bring the system to single-user mode
A user wants to restart the NFS server because they want to enable
changes made in the configuration file. What command accomplishes
this task?
#service nfs reload
The reload command will tell the system to stop the service, reload the
configuration file, and restart the service
What mode must you be in when using vi editor to input text into a
file?
To insert text in the vi editor, you must be in insert mode
One user from your company left the job without telling root account
password of his system. To reset root password, in which mode you
need to boot the system?
To reset the root password, we need to boot the system in single user mode.
What init runlevel should be set to shut down and reboot the system?
init runlevel 6 is used to shut down and reboot the system
What command would you use to add the user name vickey?
#useradd vickey
This command will add the user viceky with default options. But this will not
be able to login in system until you set a password for it. To set password use
following command
#passwd vickey
Which command should you use to change the user information listed
form finger command?
chfn command is used to change the information listed from finger command.
What runlevel does init 6 represent?
Runlevel 6 is used to reboot the system.
You are tasked to delete a user account with all his associated files
including his home directory and mail folder. How will you do that ?
#userdel -r [username]
Above command will delete user account as well all his associated files
including his home directory and mail folder.
A user comes to you and complain that his system was starting fine in GUI
mode, but from last reboot system is starting in command line interface. What
is the most likely cause of the problem?
In the /etc/inittab file, the default runlevel is probably set to 3, which tells it
to start the system in command line.
What command will display the directory path that is currently in use?
pwd command will display the directory path that is currently in use.
A user type 'cd ~ ' on command prompt, what this command will do?
This command will move user to his or her home directory. ~ represents home
directory in Linux.
A user comes to you and complain that his system start fine, but as
soon as it is almost loaded it reboot again. What is the most likely
cause of the problem?
In the /etc/inittab file, the default runlevel is probably set to 6, which tells it
to reboot right after the system has started.
Which command will list all the files and sub-directories in a directory
and include the access rights?
ls -l command will list all the files and sub-directories in a directory and include
the access rights.
Which command will list all the files in a directory including hidden
files?
ls -a command will list all the files in a directory including hidden files.
Which command will display the total size of all files, without listing
the files, in a user's home directory?
The command du -c -s /home/user will display the total size of all files, without
listing the files
What is gzip?
gzip is a compression utility created by the GNU project.
What is tar?
tar is an archive utility that is used to create tape backups.
While installing the new RPM what common steps should take ?
You should follow these common steps
Use RPM tools should be used to query or verify the installed packages to
confirm the installation of any previous packages.
Check the signature of new package
RPM should be installed or upgraded by first using the test mode to verify that it
works, and then it should be installed
At the end query the RPM and verify the installation of RPM
Which organization controls the official releases and updates of the X Window
System?
The X Consortium at www.x.org controls the official release and updating of the X
Window System
PPP is most often used to create?
PPP is most often used to create serial point-to-point connections.
With respect to a Linux systems RAM, how large should the swap file
be?
Generally the size of the swap file should be twice the size of installed RAM.
How would you create a backup of the fstab file to the /backup folder?
Use cp command to create the backup.
#cp /etc/fstab /backup
What key combination will exit from VI editor and not save the
changes made?
Esc + q +! Key combination will exit VI without saving the changes.
What command would you use to create a file system on a new hard
drive?
The mkfs command is used to create file systems.
What command can you use to verify the current active shell?
The env command will display the current active shell.
What is NNTP ?
NNTP is the common protocol which is used for news services. LeafNode and
INN are examples of news servers.
What is MTA?
MTA is a service of Sendmail server, which transfer mail from one network or
host to another network or host.
You company wants to run Web Server on their intranet. Which Linux
package should you use for this ?
To run a Web server, you should install the Apache Web server.
You company have slow internet connection. Which Linux service you
can use to manage internet connection ?
You should use Squid proxy server, which allows to manage the web contents
and also cache the web pages to decrease the amount of traffic going to
Internet.
You have tasked with implementing new Linux systems in your lab,
those will be used in training of Linux. What type of Linux distribution
should you choose?
For LAB environment you can use free Linux version of Linux distribution. In
test system at company or in a Lab environment where usually no real risk in
making mistakes you should use free version of Linux. While distribution itself
maybe free or nearly free, you will be required to pay for technical support.
In Lab environment where time permits you, instead of seeking helping hands,
try to solve the issue at your own, that could a great learning experience.
You have tasked with implementing a new Linux server in your
network that will store confidential information of company. Your lab
technician have fedora. Should you use it for your new server?
You could use it, but you should not use it for server. It is not recommended
to use an obscure, unsupported distribution for critical server. A well-know,
well-supported distribution like RHEL would be a better choice. If a technical
problem occurs at some point after the server has been installed, you need to
be able to call someone and get an answer immediately rather than searching
on internet to find a solution. You should be able to solve the issue and get
the server back into production as fast as possible.
You are installing a Linux system that will run a software that creates
very large log files. Which directory should you create separate
partition for ?
Create a separate partition at /var directory.
You are installing a Linux system that will provide file storage for a
number of network users. Which directory should you create separate
partition for?
Create a separate /home directory.
Which port should you open in your host firewall to run web server?
By default web server use port 80 and 443 which you need to open in firewall.
Which ports should you open in host firewall for an email server?
Your Linux system have two SCSI hard disk drives. The first drive is
assigned as SCSI ID 0, and the second drive is assigned SCSI ID 1.
How these will be refers in system?
/dev/sda point to the first SCSI drive.
/dev/sdb points to the second SCSI drive
Your Linux system have a single IDE hard disk drive. How partitions will be
refers on the IDE drive?
hd refers for IDE hard disk
a refers for first hard disk. If system have multiple hard disk use b for second,
c for third and so on till last hard disk.
1 refers for first partition, 2 for second partition and so on till last par tition.
For example
/
/boot
/home
Swap
You are tasked to build a new Linux workstation. User wants to install
a word processor and spreadsheets that offers a similar version for
Microsoft Windows system. Which office suite should you install?
You should use Apache OpenOffice. Its free and open source project. And
works fine on both Window and Linux systems.
A technician want to boot the system in CLI mode on start up. Which
runlevel should he assign and in which file ?
He could assign runlevel 3 as the default runlevel in /etc/inittab file.
What print command stops a spooling daemon after the current job
completes and disables printing?
The lpc stop command stops a spooling daemon after the current job
completes and disables printing
What command allows you to directly see what jobs are currently in
a printer queue?
The lpc command allows you to directly see what jobs are currently in a printer
queue
A technician wants to halt the Linux server. What command should he
use ?
He can use init 0 command to halt the Linux server.
What line printer command lets you remove print jobs from the printer
queue?
The lprm command will let you remove print jobs from the printer queue.
What is the default text editor of Linux which include almost every
version of Linux?
Default editor of Linux is vi editor that can used to edit any ASCII text.
What command is used for combining a large number of files into one
single file for archival to tape?
vi is a text editor that can be used to edit any ASCII text. It is especially useful
for editing programs.
What type of backup tape will only back up files that have changed
since the previous backup and clear the archive bit?
An Incremental backup will backup only files that have changed since the
previous backup and clear the archive bit.
What file contains a list of user names that is not allowed to log in to
the FTP server?
The ftpusers file contains a list of usernames that a Linux administrator has
previously set to not allow specific users to login to the FTP server. ftpusers
file is located in /etc/vsftpd directory.
As a technician you need to perform a scheduled shutdown that will
occur in 10 minutes. What should you use to shut down the server in
10 minutes.?
You can use -h argument with shutdown command which allows you to specify
the time in second. To shutdown the system in 10 minute you should run
shutdown -h 600 command.
What command will halt the system?
halt will halt the system.
As a technician you need to restart the Apache Web Server. What
command should you use.?
You could use following command to restart the Apache web server.
#service httpd restart
Which command will restart the FTP Server?
#service vsftpd restart
Above command will restart the FTP server.
What line printer control command is used to control the operation of
the line printer system?
lpc command is used with various argument to control the operations of line
printer system.
A technician wants to terminate an active spooling daemon on the
local host immediately and then disables printing for the specified
printers. What command should he use?
He should use lpc command with abort options. lpc abort lpc abort terminates
an active spooling daemon on the local host immediately and then disables
printing for the specified printers,
What print command stops a spooling daemon after the current job
completes and disables printing?
The lpc stop command stops a spooling daemon after the current job
completes and disables printing
What command allows you to directly see what jobs are currently in
a printer queue?
The lpc command allows you to directly see what jobs are currently in a printer
queue
A technician wants to halt the Linux server. What command should he
use ?
He can use init 0 command to halt the Linux server.
What line printer command lets you remove print jobs from the printer
queue?
The lprm command will let you remove print jobs from the printer queue.
What is the default text editor of Linux which include almost every
version of Linux?
Default editor of Linux is vi editor that can used to edit any ASCII text.
What command is used for combining a large number of files into one
single file for archival to tape?
vi is a text editor that can be used to edit any ASCII text. It is especially useful
for editing programs.
Where do all your configurations for your services, programs, and
daemons reside by default?
By default, all configurations for your services, programs, and daemons reside
in the /etc directory.
What type of backup tape will only back up files that have changed
since the previous backup and clear the archive bit?
An Incremental backup will backup only files that have changed since the
previous backup and clear the archive bit.
Which argument is used with tar command to create a new archive
file?
-c argument is used to create new archive file.
Which argument is used with tar command to extract the files from
archive ?
-x argument is used with tar command to extract the files form archive.
What is default name of super or administrator account name in
Linux?
Super or administrator account in Linux is known as root user.
A technician is going to install Linux on a workstation. The technician
wants to customize the installation. What type of installation will the
technician use to customize the installation?
Only a custom installation can be used to customize what is installed during
an installation. A custom installation will allow you to choose what packages
you want to install and what packages you dont want to install.
Where is the password file for Linux located?
The password file for Linux is located by default in the /etc/passwd location.
Which program is mostly used for remote login securely in Linux?
SSH is used for secure login. SSH is the replacement of old unsecure services
like telnet.
What file contains a list of user names that is not allowed to log in to
the FTP server?
The ftpusers file contains a list of usernames that a Linux administrator has
previously set to not allow specific users to login to the FTP server. ftpusers
file is located in /etc/vsftpd directory.
Which command can be used to schedule recurring tasks?
Cron command can be used to set scheduled recurring tasks.
In which directory Linux store crontab files for particular users?
The /var/spool/cron is the directory where users crontabs are saved with a
directory for each user in which all users cron jobs are stored.
What command should you use to activate a swap partition?
swapon command is used to activate the swap partition.
A technician is verifying the network configuration of a Linux server.
Which command he should used to accomplish this?
ifconfig is the proper command to examine network configuration.
A technician wants to assign IP addresses to all the systems that will
connect to the server automatically. What type of server he should set
up?
He should set up DHCP Server which assigns IP address to client automatically
on start up.
A technician wants to add a new user to the current domain. What
command will the technician use to accomplish this?
He should use useradd command followed by the username will create a new
user or update default new user information. You need to specify the password
separately with the passwd command.
What option a technician can use with usermod command to unlock
to user's password?
The -U option is used with usermod command to unlock the user's password.
What option of the mkfs command should you use to check the device
for bad blocks before building the file system?
The c option when used with the mkfs command will check the device for
bad blocks before building the file system.
What at command argument will send mail to the user when the job
has completed, even if there was no output?
-m argument with at command will send mail to the users when the job has
completed even if there was no output.
A user wants to verify the current active shell. Which command will
he use?
He should use the env command to verify the current active shell
What command can a technician use to search for a specific file?
He can use either find or locate command to search for a specific file.
How can you send the output of a file to another file?
The > option is used to send the output of a file to another file.
What is the -t option with fsck command used for?
The t option used with fsck is used to specify the type of filesystem to be
checked.
Which utility should you use to display the CPU processes?
top utility lets you see all on one screen how much memory and CPU usage
that you are currently using, and also the resource usage by each program
and process.
What command can you use to obtain information about your serial
port resource usage, such as IRQ and IO addresses?
setserial is a utility that you can use to obtain information about serial port
resource usage, such as IRQ and IO addresses.
A technician wants to delete the a user account. Which command
should he use?
The userdel command is used to delete a user from the system.
Which command is used to change from one directory to another?
cd command is used to navigate the Linux hierarchical file system structure,
use the cd command to change from one directory to another.
A user wants to copy a file from the /tmp directory to the his home
directory. Which command would he use?
He can use cp command to copy the files from one directory other directory.
What is the file extension of Red Hat Package manager?
.RPM extension is associated with the Red Hat Package manager
What command can you use to mount a CD-ROM drive?
mount command will mount the CD-ROM.
A technician wants to monitor connections to a Linux server. Which
command should the technician use?
He should use netstat command. Netstat is a perfect way to see and monitor
the both inbound and outbound connections. This command also be used to
view packet statistics so you can see how many packets have been sent and
received.
Which command a user can use to exit a login shell?
The logout or exit command will exit him from a login shell.
A technician is having problems connecting to a mail server. What
command can he use to test if the mail server is on the network?
He can use ping command to test connectivity between local system and
remote server.