UNIX is an open source operating system. It is a multiuser,
multitasking operating system and developed in 1969 at AT & T’s laboratory.
First, it was developed in assembly language but later it was recoded in ‘C’
language when this language developed by Dennis Ritchie. Actually, Unix is not
an operating system, it is trademark which we use to say, is it unix like
operating system or not. i.e. any operating follows the protocol which open
group created for unix, it can be called as Unix operating system. E.g. BSD,
HP-AX, Sequent, AIX.
Let’s talk about UNIX interview questions and its answers:
- What is the difference between Linux and UNIX?
Ans -- If any operating system follows the UNIX protocols
then we can say that it is a unix operating system. E.g. BSD, HP-AX etc. In
case of Linux, actually Linux is a kernel which is most important part of
operating system. Operating system comprised kernel, device drivers, desktop,
other application etc. so, Linux is not an operating system, it is just a
kernel which operating system uses like Red hat Linux, Open Suse etc. These
operating system uses Linux kernel so, we can say that these operating systems
are Linux.
- Which command can we use to rename the file in Unix?
Ans -- In unix, there is no separate command to rename the
file. We have to use ‘mv command’ to rename the file as below.
root@hello:~/hello/test#
ls
fil5 file1
file2 file3 file4 test1
root@hello:~/hello/test#
root@hello:~/hello/test#
mv file4 rename_file4
root@hello:~/hello/test#
ls
fil5 file1
file2 file3 rename_file4 test1
root@hello:~/hello/test#
|
Use of command:
mv source_file destination_file
- What is sed?
Ans -- Sed is a stream editor used to parse and transform
the text. Sed does specified operations line by line on each line of input file
or stream. Sed script either command line script or separate file.
- Is sed command edit file?
Ans -- Yes. Sed command can edit the file. But this feature
is available in Linux like operating only. This feature is not available in
Solaris.
- What is alias and how to do it? What is the use of it?
Ans -- Alias used to map some letters to specific command
and instead of running that command, just type those letters. Please see below
example to map ‘ls –l’ command to ‘ll’ letters.
root@01hw394566:~/ctier/test#
alias
alias ls='ls
--color=auto'
root@01hw394566:~/ctier/test#
root@01hw394566:~/ctier/test#
alias ll='ls -l'
root@01hw394566:~/ctier/test#
alias
alias ll='ls -l'
alias
ls='ls --color=auto'
root@01hw394566:~/ctier/test#
root@01hw394566:~/ctier/test#
ll
total 4
-rw-r--r-- 1
root root 0 2013-07-30 20:09 fil5
-rw-r--r-- 1
root root 0 2013-07-30 20:09 file1
-rw-r--r-- 1
root root 0 2013-07-30 20:09 file2
-rw-r--r-- 1
root root 0 2013-07-30 20:09 file3
-rw-r--r-- 1
root root 0 2013-07-30 20:09
rename_file4
-rw-r--r-- 1
root root 20 2013-07-30 20:09 test1
root@01hw394566:~/ctier/test#
|
- Which daemons are running for NFS service?
Ans -- There are many NFS service daemons are running when
we start the service. These daemons as follows:
Nfs
Nfsblock
Rpcbind
Rpc.mountd
Rpc.nfsd
Lockd
Rpc.statd
Rpc.rquotad
Rpc.idmapd
- What is NFS port number and main configuration file?
Ans -- NFS service is using 2049 port and its main
configuration file is /etc/exports.
- What is port number for https?
Ans -- Https port number is 443.
- How to strip all html tags from a file using sed command?
Ans – please find below example for stripping all html tags
from a file using sed command.
root@01hw394566:~/ctier/test#
cat test.html
<html>
<body>
<b>
Hello, Linux
Administrator...!!!
</b>
</body>
</html>
root@01hw394566:~/ctier/test#
sed -e 's/<[^>]*>//g' test.html
Hello, Linux Administrator...!!!
root@01hw394566:~/ctier/test#
sed -e 's/<[^>]*>//g' -e '/^$/ d'
test.html
Hello, Linux
Administrator...!!!
root@01hw394566:~/ctier/test#
|
If you have seen in above example, we see that after
stripping html tags, there are blank lines as it is. That’s why, we have used
sed again to strip all blank lines.
- What is inode?
Inode is a data structure found in unix file system. Each
inode stores all the information about a file system object except data content
and file name. We can see any file’s inode by command as “ls –i file name”.
Inode is a unique in a file system. Inode contains following information:
File Type
Permissions (read, write, execute)
Owner
Group
File Size
File access, change, modification time
File deletion time
Number of links
Access control list
- How do I see a inode number of file?
Ans – Please see below example.
root@01hw394566:~/ctier/test#
ls –li
total 8
1206521 -rw-r--r-- 1 root root 0 2013-07-30 20:09 fil5
1206512 -rw-r--r-- 1 root root 0 2013-07-30 20:09 file1
1206515 -rw-r--r-- 1 root root 0 2013-07-30 20:09 file2
1206516 -rw-r--r-- 1 root root 0 2013-07-30 20:09 file3
1206559 drwxr-xr-x 2 root root 4096
2013-08-05 21:39 how
1206517 -rw-r--r-- 1 root root 0 2013-07-30 20:09 rename_file4
1206556 -rw-r--r-- 1 root root 20
2013-07-30 20:09 test1
1206560 -rw-r--r-- 1 root root 72
2013-08-05 20:22 test.html
root@01hw394566:~/ctier/test#
|
- How to check port is open or not in Unix?
Ans— We can check port is open or not in Unix by netstat
command. Please see below example for checking for port 80.
root@01hw394566:~/ctier/test#
netstat
-aeen | grep -w 80
tcp 0
0 127.0.0.1:80 0.0.0.0:* LISTEN 0 8817
root@01hw394566:~/ctier/test#
|
If you see port 80 is tcp port. We have used double e option
to get more detailed information about this port.
If you want to read more interview questions for Linux
Administrator then click on below Link.
If you want to read more about shell scripting interview
questions then click on below link:
Shell scripting interview questions and answers
Perfect article actually ,keep up the good work .
ReplyDeleteRegards
Jacky
useful questions and answers...
ReplyDeleteThanks for the share. I need to prepare for all the questions.
ReplyDeleteHola,
ReplyDeleteThis is indeed great! But I think perhaps you are generally referring most asked question unix interview which is getting unsustainable.
Early versions # of Unix contained a development environment sufficient to recreate the entire system from source code. Is it possible to do so for the new released OS?
It was cool to see your article pop up in my google search for the process yesterday. Great Guide.
Keep up the good work!
Regards,
Irene Hynes
Nice and good article.I have suggested to my friends to go through this blog. Thanks for sharing this useful information. If you want to learn Linux course in online, please visit below site.
ReplyDeleteLinux Online Training
linux course
Linux Online Training in kurnool
Linux Online Training in Hyderabad
Linux Online Training in Bangalore
Linux Online Training in Chennai
online training
online education
online learning
best career courses
trending courses