Our last article, “10 Useful SSH Interview Questions” was highly appreciated on various Social Networking sites as well as on Tecmint. This time we are presenting you with “10 Questions on various Linux commands“. These questions will prove to be brainstorming to you and will add to your knowledge which surely will help you in day-to-day interaction with Linux and in Interviews.
Q1. You have a file (say virgin.txt). You want this file to be alter-proof so that no one can edit or delete this file, not even root. What will you do?
The Syntax of command chattr, for the above purpose is:
# chattr +i virgin.txt
Now try to remove the file using normal user.
$ rm -r virgin.txt rm: remove write-protected regular empty file `virgin.txt'? Y rm: cannot remove `virgin.txt': Operation not permitted
Now try to remove the file using root user.
# rm -r virgin.txt cannot remove `virgin.txt': Operation not permitted
Q2. If several users are using your Linux Server, how will you find the usage time of all the users, individually on your server?
# apt-get install acct
# ac -p (unknown) 14.18 server 235.23 total 249.42
Q3. Which is preferred tool to create Network Statistics for your server?
# apt-get install mrtg
Q4. It is possible to send query to BIOS from Linux Command Line?
# biosdecode # biosdecode 2.11 ACPI 2.0 present. OEM Identifier: LENOVO RSD Table 32-bit Address: 0xDDFCA028 XSD Table 64-bit Address: 0x00000000DDFCA078 SMBIOS 2.7 present. Structure Table Length: 3446 bytes Structure Table Address: 0x000ED9D0 Number Of Structures: 89 Maximum Structure Size: 184 bytes PNP BIOS 1.0 present. Event Notification: Not Supported Real Mode 16-bit Code Address: F000:BD76 Real Mode 16-bit Data Address: F000:0000 16-bit Protected Mode Code Address: 0x000FBD9E 16-bit Protected Mode Data Address: 0x000F0000 PCI Interrupt Routing 1.0 present. Router ID: 00:1f.0 Exclusive IRQs: None Compatible Router: 8086:27b8 Slot Entry 1: ID 00:1f, on-board ... Slot Entry 15: ID 02:0c, slot number 2
Q5. Most of the Linux Server are headless, i.e., they run in command mode only. No GUI is installed. How will you find hardware description and configuration of your box?
The output of dmidecode is extensive. It will be a nice idea to redirect its output to a file.
# dmidecode > /path/to/text/file/text_file.txt
Q6. You need to know all the libraries being used and needed by a binary, say ‘/bin/echo’. How will you achieve desirable output?
$ ldd /bin/echo linux-gate.so.1 => (0xb76f1000) libc.so.6 => /lib/i386-linux-gnu/i686/cmov/libc.so.6 (0xb7575000) /lib/ld-linux.so.2 (0xb76f2000)
Q7. You are working for the country’s army. You have a file (say “topsecret.txt”) which contains confidential and country’s security Information, Nuclear missiles, etc. What will be your preferred method to delete this file?
# shred -n 15 -z topsecret.txt
shread – overwrite a file to hide its contents, and optionally delete it.
- -n – Overwrites the files n times
- -z – Add a final overwrite with zeros to hide shredding.
Note: The above command overwrites the file 15 times before overwriting with zero, to hide shredding.
Q8. Is it possible to mount an NTFS partition on Linux?
For more information, read article on how to monitor an NTFS Partition on Linux.
Q9. What and where you need to edit so that the default desktop at login will be KDE, which at present is GNOME.
Save the file with above content. Next time when machine boots, it automatically will load KDE as default display manager.
Q10. What does an intrid image file refers to?
That’s all for now. I’ll be here again with another interesting topic, worth knowing. Till then stay tuned and connected to Tecmint. Don’t forget to provide us with your valuable feedback in comment section.
Latest posts by Avishek Kumar (see all)
Linux Services & Free WordPress Setup
Our post is simply ‘DIY’ aka ‘Do It Yourself, still you may find difficulties and want us to help you out. We offer wide range of Linux and Web Hosting Solutions at fair minimum rates. Please submit your orders by Clicking Here.