Monday, December 29, 2014

Linux Basic Interview Questions - Part4

12:58 PM



1. You have a directory called /home/ben/memos and want to move it to /home/bob/memos so you issue the command mv /home/ben/memos /home/bob. What is the results of this action?
 
Choose one:
a. The files contained in /home/ben/memos are moved to the directory /home/bob/memos/memos.
b. The files contained in /home/ben/memos are moved to the directory /home/bob/memos.
c. The files contained in /home/ben/memos are moved to the directory /home/bob/.
d. The command fails since a directory called memos already exists in the target directory.

Answer: a
When using the mv command to move a directory, if a directory of the same name exists then a subdirectory is created for the files to be moved.

2. Which of the following tasks is not necessary when creating a new user by editing the /etc/passwd file?
 
Choose one:
a. Create a link from the user's home directory to the shell the user will use.
b. Create the user's home directory
c. Use the passwd command to assign a password to the account.
d. Add the user to the specified group.

Answer: a
There is no need to link the user's home directory to the shell command. Rather, the specified shell must be present on your system.

3. You issue the following command useradd -m bobm But the user cannot logon. What is the problem?
 
Choose one:
a. You need to assign a password to bobm's account using the passwd command.
b. You need to create bobm's home directory and set the appropriate permissions.
c. You need to edit the /etc/passwd file and assign a shell for bobm's account.
d. The username must be at least five characters long.

Answer: a
The useradd command does not assign a password to newly created accounts. You will still need to use the passwd command to assign a password.

4. You wish to print the file vacations with 60 lines to a page. Which of the following commands will accomplish this?

Choose one:
a. pr -l60 vacations | lpr
b. pr -f vacations | lpr
c. pr -m vacations | lpr
d. pr -l vacations | lpr

Answer: a
The default page length when using pr is 66 lines. The -l option is used to specify a different length.

5. Which file defines all users on your system?
 
Choose one:
a. /etc/passwd
b. /etc/users
c. /etc/password
d. /etc/user.conf

Answer: a
The /etc/passwd file contains all the information on users who may log into your system. If a user account is not contained in this file, then the user cannot log in.

6. Which two commands can you use to delete directories?
 
A) rm
B) rm -rf
C) rmdir
D) rd
E) rd -rf

Answer(s): B, C - You can use rmdir or rm -rf to delete a directory. Answer a is incorrect, because the rm command without any specific flags will not delete a directory, it will only delete files. Answers d and e point to a non-existent command.

7. Which partitioning tool is available in all distributions?
 
A) Disk Druid
B) fdisk
C) Partition Magic
D) FAT32
E) System Commander

Answer(s): B - The fdisk partitioning tool is available in all Linux distributions. Answers a, c, and e all handle partitioning, but do not come with all distributions. Disk Druid is made by Red Hat and used in its distribution along with some derivatives. Partition Magic and System Commander are tools made by third-party companies. Answer d is not a tool, but a file system type. Specifically, FAT32 is the file system type used in Windows 98.

8. Which partitions might you create on the mail server's hard drive(s) other than the root, swap, and boot partitions?
 
[Choose all correct answers]
A) /var/spool
B) /tmp
C) /proc
D) /bin
E) /home

Answer(s): A, B, E - Separating /var/spool onto its own partition helps to ensure that if something goes wrong with the mail server or spool, the output cannot overrun the file system. Putting /tmp on its own partition prevents either software or user items in the /tmp directory from overrunning the file system. Placing /home off on its own is mostly useful for system re-installs or upgrades, allowing you to not have to wipe the /home hierarchy along with other areas. Answers c and d are not possible, as the /proc portion of the file system is virtual-held in RAM-not placed on the hard drives, and the /bin hierarchy is necessary for basic system functionality and, therefore, not one that you can place on a different partition.

9. When planning your backup strategy you need to consider how often you will perform a backup, how much time the backup takes and what media you will use. What other factor must you consider when planning your backup strategy? _________
what to backup
Choosing which files to backup is the first step in planning your backup strategy.

10. What utility can you use to automate rotation of logs?
 
Answer: logrotate
The logrotate command can be used to automate the rotation of various logs.

11. In order to display the last five commands you have entered using the history command, you would type ___________ .
Answer: history 5
The history command displays the commands you have previously entered. By passing it an argument of 5, only the last five commands will be displayed.

12. What command can you use to review boot messages?
 
Answer: 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.

13. What is the minimum number of partitions you need to install Linux?
 
Answer: 2
Linux can be installed on two partitions, one as / which will contain all files and a swap partition.

14. What is the name and path of the main system log?
 
Answer: /var/log/messages
By default, the main system log is /var/log/messages.

15. Of the following technologies, which is considered a client-side script?  

A) JavaScript
B) Java
C) ASP
D) C++

Answer: A - JavaScript is the only client-side script listed. Java and C++ are complete programming languages. Active Server Pages are parsed on the server with the results being sent to the client in HTML

Written by

0 comments :

Post a Comment

 

© 2014 Linux Storages | Updated . All rights resevered. Designed by Templateism