Continuing the Interview Series, we are giving 10 Questions here, in this article. These questions and the questions in the future articles doesn’t necessarily means they were asked in any interview. We are presenting you an interactive learning platform through these kind of posts, which surely will be helpful.
Upon the analysis of comments in different forums on last article 11 Basic Linux Interview Questions of this series, it is important to mention here that to bring up a quality article to our readers. We give our time and money, and in return what we expect from you? Nothing. If you can’t praise our work, please don’t demoralize us from your negative comments.
If you find nothing new in a post, don’t forget that for someone it was helpful, and for that he/she was thankful. We can’t make everyone happy in each of our article. Hope you readers would take pain to understand this.
Q.1: Which command is used to record a user login session in a file?
- macro
- read
- script
- record
- sessionrecord
Let’s record the user’s login session with script command as shown.
[root@tecmint ~]# script my-session-record.txt Script started, file is my-session-record.txt
The content of log file ‘my-session-record.txt’ can be views as:
[root@tecmint ~]# nano my-session-record.txt script started on Friday 22 November 2013 08:19:01 PM IST [root@tecmint ~]# ls ^[[0m^[[01;34mBinary^[[0m ^[[01;34mDocuments^[[0m ^[[01;34mMusic^[[0m $ ^[[01;34mDesktop^[[0m ^[[01;34mDownloads^[[0m my-session-record.txt ^[[01;34$
Q.2: The kernel log message can be viewed using which of the following command?
- dmesg
- kernel
- ls -i
- uname
- None of the above
[root@tecmint ~]# dmesg Initializing cgroup subsys cpuset Initializing cgroup subsys cpu Linux version 2.6.32-279.el6.i686 ([email protected]) (gcc version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC) ) #1 SMP Fri Jun 22 10:59:55 UTC 2012 KERNEL supported cpus: Intel GenuineIntel AMD AuthenticAMD NSC Geode by NSC Cyrix CyrixInstead Centaur CentaurHauls Transmeta GenuineTMx86 Transmeta TransmetaCPU UMC UMC UMC UMC Disabled fast string operations BIOS-provided physical RAM map: ...
Q.3: Which command is used to display the release of Linux Kernel?
- uname -v
- uname -r
- uname -m
- uname -n
- uname -o
[root@tecmint ~]# uname -r 2.6.32-279.el6.i686
Q.4: Which command is used to identify the types of file?
- type
- info
- file
- which
- ls
[root@tecmint ~]# file wtop wtop: POSIX shell script text executable
Q.5: Which command locate the binary, source and man page of a command?
[root@tecmint ~]# whereis /usr/bin/ftp ftp: /usr/bin/ftp /usr/share/man/man1/ftp.1.gz
Q.6: When a user login, which files are called for user profile, by default??
[root@tecmint ~]# ls -al -rw-r--r--. 1 tecmint tecmint 176 May 11 2012 .bash_profile -rw-r--r--. 1 tecmint tecmint 124 May 11 2012 .bashrc
Q.7: The ‘resolv.conf’ file is a configuration file for?
[root@tecmint ~]# cat /etc/resolv.conf nameserver 172.16.16.94
Q.8: Which command is used to create soft link of a file?
- ln
- ln -s
- link
- link -soft
- None of the above
[root@tecmint ~]# ln -s /etc/httpd/conf/httpd.conf httpd.original.conf
Q.9: The command ‘pwd’ is an alias of command ‘passwd’ in Linux?
[root@tecmint ~]# pwd /home/tecmint
[root@tecmint ~]# passwd Changing password for user root. New password: Retype new password:
Q.10: How will you check pci devices vendor and version on a Linux?
[root@tecmint ~]# lspci 00:00.0 Host bridge: Intel Corporation 5000P Chipset Memory Controller Hub (rev b1) 00:02.0 PCI bridge: Intel Corporation 5000 Series Chipset PCI Express x8 Port 2-3 (rev b1) 00:04.0 PCI bridge: Intel Corporation 5000 Series Chipset PCI Express x8 Port 4-5 (rev b1) 00:06.0 PCI bridge: Intel Corporation 5000 Series Chipset PCI Express x8 Port 6-7 (rev b1) 00:08.0 System peripheral: Intel Corporation 5000 Series Chipset DMA Engine (rev b1) ...
That’s all for now. I hope these above questions might be very helpful to you. In our next weekend we again come-up with some new set of questions. Till then stay healthy, tuned and connected to Tecmint.
Great Work Avishek / Ravi,
But few questions are not sufficient to cover the interview on Linux.
I hope you can create important questions soon for each topic of Linux.
Nice to have tutorials for Linux beginners- I hope that people are able to see how easy Linux really is- especially for everyday web surfing and email.
Really good. Without tecmint it is very difficult to learn linux for beginners.
@Kiran,
Thanks a ton for such kind words about TecMint..
Very nice and very useful. Dil mange more ;)
Nice write up… wish to see more on awk and sed questions
Dear Neel,
awk and sed are something i really appreciate very much. It needs a lot of dedication to produce an article on awk and sed. I will do as soon as possible.
Keep Connected. thanks for your feedback.
Well written keep it up
Welcome @ Ravi
thanks for giving me information
Welcome birendra
Grate dude! very helpful………
THanks @ Ashok Dobal, for your Great Response.
Very much helpful for beginners in Linux
Nice to hear that it was helpful.
Thanks @ Phani
very useful..thanks a lot for sharing.
Welcome @ Ankit Sahil
super@@@@@@@2better to privide more..
Thanks @ bittu, we are considering your request.
I think answer for Q6 isn’t fully correct.
1. ~/.bashrc will run only if user shell is bash, and ~/.bashrc will run after ~/.bash_profile script if it present.
2. Threre are a lot of scripts may run before ~/.profile script. At first /etc/profile, and then every script in /etc/profile.d/ directory.
At fact ~/.bashrc and ~/.profile are the lastest files which called for user profile.
Thanks for that waiting for more question
sure @ koshal, we are coming up with next article on Interview Question on Next Saturday, and every Saturday.
Nice list for learning basic Linux commands.
Thanks.
Thanks @ SAB for your Feedback.
Great article. Thanks Avishek. I have never missed your articles and always archiving it for future reference.
Thanks @ Shahrun Ishak, Your comment is one of the best honour, i received.
Thanks! waiting for new items
Thanks @ saber, for your feedback. we are coming up with next interview article on next saturday. Till then stay tuned and connected.
Coollllllllll…………
Thanks @ durga prasad. :)
There is a mistake (twice) in the question and answer about resolv.conf. The file is wrongly named resolve.conf instead of resolv.conf.
Thanks @ Yannic for pointing that out. libreoffice dictionary ammended it automatically from resolv.conf to resolve.conf.
Anyway, It has been fixed in the article.
gr8..
Thanks @ nilesh khetre, for your highly appreciated feedback.
Thanks for the articles, it’s so great!!
Thanks @ Fernando Souza, for your valueable feedback.
Thanks …Very helpful…
welcome@ Suhail cheroor.
very helpfull
thanks
ashu