Linux Interview 2

1.What command is used to remove the password assigned to a group?

gpasswd –r

2. What is the minimum number of partitions you need to install Linux


3. What command can you use to review boot messages?

Dmesg: The dmesg command displays the system messages contained in the kernel ring buffer. By using this command immediately after booting your computer, you will see the boot messages.

4.What command you execute to display the last five commands you have entered?

history|tail -5.

5.Which partitions might you creates on mail server HDDs other than the root, swap and boot partitions?


6.Which partitioning tool is available in all distributions?

fdisk, parted.

7. Which two commands can you use to delete directories?

rm, rmdir.

8.Which file defines all users on your system?


9.What is contained in the directory /proc

System information

The /proc directory is a virtual filesystem that contains system information.

10.In order to improve your system’s security you decide to implement shadow passwords. What command should you use?

Pwconv : The pwconv command creates the file /etc/shadow and changes all passwords to ‘x’ in the /etc/passwd file.
/etc/passwd file already exists there.
So, give passwords by “passwd”

11. How to give permission for a user to shutdown the system?

Add his username to the /etc/shutdown.allow file.  Any user who is listed in the /etc/shutdown.allow file will be able to run the shutdown command without being root.

12.You locate a command in the /bin directory but do not know what it does. What command can you use to determine its purpose?

Whatis :    The whatis command displays a summary line from the man page for the specified command.  We can use man and info commands

13. What utility can you use to show a dynamic listing of running processes?

Top :The top utility shows a listing of all running processes that is dynamically updated. top utility is used. but ps -ef command can also be used .

14. What command would you type to use the cpio to create a backup called backup.cpio of all the user’s home directories? _____________

find /home | cpio -o > backup.cpio  :  The find command is used to create a list of the files and directories contained in home. This list is then piped to the cpio utility as a list of files to include and the output is saved to a file called backup.cpio.

15. What file defines the levels of messages written to system log files?
kernel.h:    To determine the various levels of messages that are defined on your system, examine the kernel.h file.

16.You want to create a compressed backup of the users’ home directories. What utility should you use?

Tar : You can use the z modifier with tar to compress your archive at the same time as creating it.
tar -zcvf filename.tgz file1 file2
This command is used to take a compress backup

17.You routinely compress old log files. You now need to examine a log from two months ago. In order to view its contents without first having to decompress it which utility is used.


The zcat utility allows you to examine the contents of a compressed file much the same way that cat displays a file.
grep is preffered over zcat

18. What command can you use to determine the directory structure was stored for a tar file

tar tvf tarfile
The t switch will list the files contained in the tarfile. Using the v modifier will display the stored directory structure.

19 You suspect that you have two commands with the same name as the command is not producing the expected results. What command can you use to determine the location of the command being run?

The which command searches your path until it finds a command that matches the command you are looking for and displays its full path

20. The top utility can be used to change the priority of a running process? Another utility that can also be used to change priority is ___________?

Answer: nice
Both the top and nice utilities provide the capability to change the priority of a running process.
nice can be used.
For already existing process, renice is used.

21 .While logged on as a regular user, your boss calls up and wants you to create a new user account immediately. How can you do this without first having to close your work, log off and logon as root?

Issue the command su and type exit when finished.
You can use the su command to imitate any user including root. You will be prompted for the password for the root account. Once you have provided it you are logged in as root and can do any administrative duties.

22. In order to prevent a user from logging in, you can add a(n) ________at the beginning of the password field.

If you add an asterisk at the beginning of the password field in the /etc/passwd file, that user will not be able to log in.
You can also use
passwd -l with the username to lock his account.

23. You have a file called phone nos that is almost 4,000 lines long. What text filter can you use to split it into four pieces each 1,000 lines long?

The split text filter will divide files into equally sized pieces. The default length of each piece is 1,000 lines.

24.You have the /var directory on its own partition. You have run out of space. What should you do?

Delete the partition and recreate it with a larger size.
The only way to enlarge a partition is to delete it and recreate it. You will then have to restore the necessary files from backup.
If we feel that we may need to enlarge the partition in future then we can use LVM partitions
LVM partitions can be used to enlarge to reduce the partitions
LVM can be used with RAID too
We can also redirect the log files path, so we can store log files on any other partition or on any other system

25. You changed /etc/lilo.conf to cause a boot: prompt to show, however, when you restart your computer you still do not have a prompt. What should you do?

Install the configuration changes by issuing the command /sbin/lilo
You have to reinstall LILO in order for any configuration changes to take effect. This is done by running /sbin/lilo without any options.

Leave a Reply

Your email address will not be published. Required fields are marked *