0 ratings0% found this document useful (0 votes) 380 views8 pages20 Linux Commands Interview Questions & Answers
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
LinuxTechi
Home
How To
Commands
Shell Scripting
Linux Interview
Linux ebooks
Write For LinuxTechi
Contact Us
About Us
Linux Interview as 6
20 Linux Commands Interview
Questions & Answers Bor You Emil Ib
by Pradeep Kumat- Published December 21, 2014- Updated lune 19, 2016
Q:1 How to check current run level of a linux server ?
‘Ans: ‘who -r' & ‘runlevel’ commands are used to check the current runlevel
of a linux box.
inti Linux Techi
Q:2 How to check the default gatway in linux ?
‘Ans: Using the commands “route -n* and “netstat -nr* , we can check
default gateway. Apart from the default gateway info , these commands also surtalones
display the current routing tables
apo rt oni nacconande cen gnc rm!(Q:3 How to rebuild initrd image file on Linux ?
‘Ans: In case of CentOS 5.X / RHEL 5.X , mkinitrd command is used to create
initrd file , example is shown below :
4 mkinitrd -f-v /boot/initrd-$(uname -1).img S(uname -1)
If you want to create initrd for a specific kernel version , then replace
“uname -r' with desired kernel
In Case of CentOS 6X / RHEL 6.X , dracut command is used to create initrd
file example is shown below :
dracut -£
Above command will create the initrd file for the current version. To rebuild
the initrd file for a specific kernel , use below command :
4 dracut -finitramfs-2.x.2x-%.016.x86_64.img 2.x.20-9%.016.x86_64
(Q:4 What is cpio command ?
Ans: cpio stands for Copy in and copy out. Cpio copies files, lists and extract
files to and from a archive (or single fie)
(Q:5 What is patch command and where to use it ?
Ans: As the name suggest patch command is used to apply changes ( or
patches) to the text file. Patch command generally accept output from the
diff and convert older version of files into newer versions. For example
Linux kernel source code consists of number of files with millions of lines ,
so whenever any contributor contribute the changes , then he/she will be
send the only changes instead of sending the whole source code. Then the
receiver will apply the changes with patch command to its original source
code.
Create a diff file for use with patch,
4 diff -Naur old_file new file >diff_file
ep dr cont nacconmande cen gnc!
Recent CommentsTags
Fedora 25 Workstation
Installation Guide with
Screenshots
How to Install and
Customize ONLYOFFICE
Fer
Desktop Editors on
Debian/Ubuntu/Linux Mint
—— Katello - Download Yum
Repositories and Register
= clients for patching
November 2, 2016
How to Manage Kernel Modules in
Linax:
How to Install Katello 5.2
on CentOS 7.x
November 14,2016
‘Top 10 Linux Distros for
Desktop /Laptop
November 4, 2016ep dr oni nacconmarde en gners
‘Where old file and new file are either single files or directories containing
files. The r option supports recursion of a directory tree.
Once the diff file has been created, we can apply it to patch the old file into
the new file:
patch < diff file
Q:6 What is use of aspell ?
Ans: As the name suggest aspell is an interactive spelling checker in linux
operating system. The aspell command is the successor to an earlier
program named ispell, and can be used, for the most part, as a drop-in
replacement. While the aspell program is mostly used by other programs
that require spell-checking capability, it can also be used very effectively as
stand-alone tool from the command line.
Q:7 How to check the SPF record of domain from command line ?
‘Ans: We can check SPF record of a domain using dig command. Example is
shown below :
linuxtechi@localhost:~$ dig TXT google.com
Q:8 How to identify which package the specified file (/etc/fstab) is
associated with in linux ?
Ans: # rpm -af etc/fstab
Above command will list the package which provides file “/ete/fstab”
Q:9 Which command is used to check the status of bondO ?
‘Ans: cat /proc/net/bonding/bondo
Q:10 What is the use of /proc file system in linux ?
Ans: The /proc file system is @ RAM based file system which maintains
information about the current state of the running kemel including details.
on CPU, memory, partitioning, interrupts, 1/O addresses, DMA channels,
and running processes. This file system is represented by various files
tober 50,2016
‘Multi Node Openstack
‘Newton’ Installation
= Steps on Centos 7
october 2, 2016
ERE vbuntu 16.10 (vakkety
© © Yak) Desktop Installation
— ide
(ctober 20,2016
Next»
Facebookwhich do not actually store the information, they point to the information
in the memory. The /proc file system is maintained automatically by the
system.
(Q:11 How to find files larger than 10MB in size in /usr directory ?
‘Ans: # find /usr -size +10M
Q:12 How to find files in the /home directory that were modified more
than 120 days ago ?
‘Ans: # find /home -mtime +120
Q:15 How to find files in the /var directory that have not been
accessed in the last 90 days ?
‘Ans: # find /var -atime -90
Q:14 Search for core files in the entire directory tree and delete them
as found without prompting for confirmation
‘Ans: # find /-name core exec 1m {}\;
Q:15 What is the purpose of strings command ?
Ans: The strings command is used to extract and display the legible
contents of a non-text file
Q:16 What is the use tee filter ?
Ans: The tee filter is used to send an output to more than one destination.
It can send one copy of the output toa file and another to the screen (or
some other program) ifused with pipe.
linuxtechi@localhost:~$ Il/etc [nl | tee /Amp/ll.out
In the above example, the output from Il is numbered and captured in
‘Amp/llout fil. The output is also displayed on the screen.
Q:17 What would the command export PSI =
"SLOGNAME@ ‘hostname*\SPWD: do?
ep dr oni nacconmande en gn‘Ans: The export command provided will change the login prompt to display
username, hostname, and the current working directory.
(Q:18 What would the command II | awk ‘{print $3,"owns",$9)' do ?
Ans: The Il command provided will display file names and their owners.
Q:19 What is the use of at command in linux ?
Ans: The at command is used to schedule a one-time execution of a
program in the future. All submitted jobs are spooled in the /var/spool/at
directory and executed by the atd daemon when the scheduled time arrives.
Q:20 What is the role of Ispei command in linux ?
Ans: The Ispei command displays information about PCT buses and the
devices attached to your system. Specify -v, -vv, or -vwv for detailed output.
With the -m option, the command produces more legible output.
ep dr oni nacconmande en gnRelated Posts
[irswdhes) LinuxTecht
‘server Cinux Unix
Interview Interview [iad
usstons & Questions &
Answers ne
Server Interview Virtualization command examples
Quasions &Inteniew famples for beganas in nue
Answers Questions & beginners
Slim Shell How toinstall—_2Sintenew
seeptng Docker om CentOS. Questions for
(Quetions te Aministrto Job
‘Tags: nx commands interview questions
€ Fedora 21 Desktop Installation} Install VLC Multimedia player >
Steps with Sereenshots fon Ubunty 14.10
pve rst con cornea. macesven ‘Una Comma Hever Aras
3 Responses
Comments 3 - Pingbacks 0
Ray © December 25,2014 at 459 pm
Inthe answer to Q14, the find command also has a ‘delete’ option.
find /-name core -dolete
Reply
dham © January 29, 2015 at 1:58am
‘There is no option to ada “deete”
find /-name core -execrm {)\;
Reply
Pradeep Kumar © January 0, 2015 at 11:48
* Mian,
delete option is ther, for your reference just do "man find” and
search delete word,
Reply
Leave a Reply
Comment
Name * mai
pw dr contnacconande teen eines!Website
ight « =56 Oo
Aa
Linaechi Lino Tutors & Guides © 2016. A ight Reserve
o
Thiswrkis cesed nde Cetve Gammon Atriuion-NenCommeri 40
International License.
Content of this site cannot be republished either online or offline without our permissions.
apo rt oni nacconande cen gnc rm!