You are on page 1of 41

You attempt to use shadow passwords but are unsuccessful.

What characteristic of the


/etc/passwd file may cause this? Choose one: a. The login command is missing. b. The
username is too long. c. The password field is blank. d. The password field is prefaced by an
asterick.

You create a new user account by adding the following line to your /etc/passwd file.
bobm:baddog:501:501:Bob Morris:/home/bobm:/bin/bash Bob calls you and tells you that he
cannot logon. You verify that he is using the correct username and password. What is the
problem? Choose one: a. The UID and GID cannot be identical. b. You cannot have spaces in
the line unless they are surrounded with double quotes. c. You cannot directly enter the
password; rather you have to use the passwd command to assign a password to the user. d.
The username is too short, it must be at least six characters long.

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.

You create a new user by adding the following line to the /etc/passwd file bobm::501:501:Bob
Morris:/home/bobm:/bin/bash You then create the user’s home directory and use the passwd
command to set his password. However, the user calls you and says that he cannot log on.
What is the problem? Choose one: a. The user did not change his password. b. bobm does not
have permission to /home/bobm. c. The user did not type his username in all caps. d. You
cannot leave the password field blank when creating a new user.

When using useradd to create a new user account, which of the following tasks is not done
automatically. Choose one: a. Assign a UID. b. Assign a default shell. c. Create the user’s
home directory. d. Define the user’s home directory.

1> how many grafical consoles are there in linux(rhce)?


7 GUI Modes are there in RHEL 5.0
Home > Communities > Other > Unix Troubleshoot > Forum > Messages

Linux Interview Question Part II


1) What is the function of the ‘!!’ command?

2) What is the minimum number of partitions required to install Linux?

3) How do you check which ports are listening on Linux box?

4) How can the load on the Linux server be checked?

5) What is patch management, how to patch kernel? Explain?

6) What is the main path and name of the system log?

7) What is the Proc file system? Explain.

8) How to display three, four or five-digit numbers from a file1 using regular expressions?
9) When the system boots, what file is used to specify mount points?

10) How can the file system integrity be checked? How do you troubleshoot DNS Resolving
problems?

11) What are the steps to troubleshoot X11 server?

12) Explain the difference between Hard and Soft Links?


13) How to configure ‘sshd’ to allow listed users to login to the Linux Server?

14) What is the use of /etc/services file?

15) What are ‘pam’ modules? Why do we use it? What is the configuration location of files?

16) How can a swap file be added?

17) How to display file / file system statistics including inode details of file & permissions?

18) List the Linux boot loaders with features & trouble shooting steps

19) Which command is used to check boot time messages?

20) Explain Backup types

21) Which command is used to check open files?

22) Command to add ip address to a interface via command line?

23) Explain tcpwrappers?

ports listening --- use netstat command

/proc -- it contains all information about current running process . With this info we can
implement "ps" command

How can the load on the Linux server be checked?


ps -ef will do or not?

How to configure ‘sshd’ to allow listed users to login to the Linux Server?
modify sshd_config

i am posting the answers for the above questions. please correct the answer if it is wrong.

1) What is the function of the ‘!!’ command?


Ans: Its is used for re-execution of the last or previous command executed

2) What is the minimum number of partitions required to install Linux?


Ans: Two is minimus. One is for swap and the other is for / filesystem.

3) How do you check which ports are listening on Linux box?


Ans: nmap <ip> to check the ports open and listening on. And lsof -i can also be used.

4) How can the load on the Linux server be checked?


Ans: ps -elf |more , top , vmstat - ps for listing running
processes, top for cpu usage , memory and vmstat for swap or virtual memory utilization.
5) What is patch management, how to patch kernel? Explain?
Ans: Change to the directory where the kernel is compiled and issue the patch command.
ex: patch -p0 < <patched-kernel>

6) What is the main path and name of the system log?


Ans: /var/log/ is the path for the system log file called "messages"

7) What is the Proc file system? Explain.


And: The /proc File System is a pseudo file system residing in the virtual memory and
maintains highly dynamic data on the state of your operating system. Most of the
information in the /proc file system is updated to match the current state of the operating
system.The important factor about the /proc file system is the fact that the file system
doesn't exist on any particular media.

8) How to display three, four or five-digit numbers from a file1 using regular expressions?

9) When the system boots, what file is used to specify mount points?
Ans: The file system table configuration file i.e. /etc/fstab file will be used for the mount
points.

10) How can the file system integrity be checked? How do you troubleshoot DNS Resolving
problems?
Ans: fsck can be used to check the filesystem integrity. For DNS dig , host , nslookup
commands can be used for resolvation problems.

#fsck /home -- To check the file system integrity.


#dig -x <ip> -- To verify whether the nameserver is ablet to reply for reverse dns query.
#dig <fqdn> -- To verify the name server is able to reply for the dns query or not
#host <ip> -- To get the reverse information or the FQDN for the ip.
#host -v <fqdn> -- To get the appropraite ip for the FQDn
* Check for the entry in /etc/resolve.conf.
* Check for the route.
* Check for the gateway.
* Check with firewalls.

11) What are the steps to troubleshoot X11 server?


Ans:
#export DISPLAY=local:0.0 -Check for the dispaly variable.
#service kudzu start - Driver detection for video card.
#chkconfig kudzu on
#service xfs status - it should be started for startx to run.
#service xfs start
#chkconfig xfs on

Check for the file in /etc/X11/xorg.conf, if it is not there then run


#system-config-diplay to generate the file.

Check for the rpm installed xorg-x11 , xorg-x11-twm , kdutils , gnome and system-config-
display. if not installed install them.

Check for the permissions of /tmp and /home directories and remove unwanted files.
#chmod 1777 /tmp

Check permissions for the startx.


#chmod 755 /usr/bin/startx
Check for the user quotas.it may be reached preventing the creation of some xserver related
files in the home directory.

Check for the horizontal and vertical sync for the monitors in /etc/X11/xorg.conf file.

Check for th entries in the /etc/inittab whether it is prompted to run into the required run-
level.

12) Explain the difference between Hard and Soft Links?


Ans: A.Hard links share the same inode. Soft links do not.
B.Hard links can't cross file systems. Soft links do.

13) How to configure ‘sshd’ to allow listed users to login to the Linux Server?
Ans: Using a favourite editor include a configuration parameter "AllowUsers" in
/etc/ssh/sshd_config.
#vim /etc/ssh/sshd_config
AllowUsers <user1> <user2> ---- add the line and replace the user1 and user2 for thr
users you want

14) What is the use of /etc/services file?


Ans: Translates network service names to port number/protocol. Read by inetd, telnet,
tcpdump, and some other programs.

15) What are ‘pam’ modules? Why do we use it? What is the configuration location of files?
Ans: "PAM" modules are the libraries which are used for authentication and authrorization
for the applications.Appropriate modules or the dynamically loaded authentication modules
for the applications will be in the /lib/security. Configuration file for the modules in
/lib/security will be in /etc/security.And the configuration files for the each application that
uses the PAM modules will be in /etc/pam.d

16) How can a swap file be added?


Ans: 1. # dd if=/dev/zero of="Path to the file" bs=4000000000 count=1
( Take An EXAMPLE I AM taking name of File as /usr/local/swapfile
This will create a file "/usr/local/swapfile" of approx 4GB size

2. # chmod 0 /usr/local/swapfile

So that no one can ever use it /delete it.

3. # mkswap /usr/local/swapfile

4. # swapon -v /usr/local/swapfile

5. Test if your swap has increase by 1 MB

# top

or

# cat /proc/swaps
Linux Interview Question Part II
Home > Communities > Other > Unix Troubleshoot > Forum > Messages

17) How to display file / file system statistics including inode details of file & permissions?
Ans: ls -li

18) List the Linux boot loaders with features & trouble shooting steps
Ans:Most popular boot loaders are GRUB and Lilo.All the boot loaders do the same process
but some are more flexible for troubleshooting.Here Lilo doesnt have command interactive
mode, it doesnt support booting from network.Misconfigured file in lilo will lead to
unbootable stage. whereas in grub it leaves a prompt to reconfigure.

19) Which command is used to check boot time messages?


Ans: dmesg - to display the messeges scrolled fast while booting the system.

20) Explain Backup types


Ans. tar , rsync , dump/restore are the bulit-in backup tools in linux

21) Which command is used to check open files?


Ans : lsof - to list of files opened by the processes.

22) Command to add ip address to a interface via command line?


Ans : #ifconfig eth0 10.8.7.1
#route add -net 10.8.7.0 dev eth0
#route add -host 10.8.7.1 dev eth0
#route add default gw 10.8.7.100
#ifconfig eth0 up
#ifconfig

23) Explain tcpwrappers?


Ans: Many programs do not run all the time as they are infrequently used and would create
unnecessary overhead. The inetd program is run takes care of this nicely. When a user tries
to connect to your computer, the connection is made up of a pair of data: an ip address and
a port. Inetd reacts to this connection by looking up the port number in /etc/services, and
then looking in the file /etc/inetd.conf for a corresponding service, (program) and then runs
the service. With tcp wrappers, inetd is tricked into running tcpd instead of the service that
would normally be called. Tcpd checks it's rules in the /etc/hosts.allow and /etc/hosts.deny
files. It either accepts the connection and runs the service or denies the connection based
on it's rules.

NOTE: tcp wrappers only works for services that inetd starts! Sendmail, apache, and named
do not use inetd, and so they are not protected via tcp wrappers.

Can we all discuss Linux Interview Questions ???


Here's a kind of a game to help it make a lil less boring. THere's a question above u.,
answer it and give an interview question known to you and the next person follows and
so on. Hopefull this shud be a lil' fun and we shud be able to get a lot of interview
questions here that'll help most of us.

Here's mine.

What is the meaning of GRUB and where would you find it on a Linux PC ?

GNU GRUB ("GRUB" for short) is a boot loader package from the GNU Project. GRUB is the
reference implementation of the Multiboot Specification, which allows a user to have several
different operating systems on their computer at once, and to choose which one to run
when the computer starts.
u can find it in /sbin/

5/3/07

where can u find a users password ?


where can u find a users home page?
how can u deny a user, different ways if u can ?

Linux interview questions


Home > Communities > Other > Unix Troubleshoot > Forum > Messages

7/31/07
karthik
Linux interview questions
Hi Geeks here i am pasting some of the useful question i got....

Linux admin interview questions:


1.How do you take a single line of input from the user in a shell script?
2.Write a script to convert all DOS style backslashes to UNIX style slashes in a list of files.
3.Write a regular expression (or sed script) to replace all occurrences of the letter ‘f’,
followed by any number of characters, followed by the letter ‘a’, followed by one or more
numeric characters, followed by the letter ‘n’, and replace what’s found with the string
“UNIX”.
4.Write a script to list all the differences between two directories.
5.Write a program in any language you choose, to reverse a file.
6.What are the fields of the password file?
7.What does a plus at the beginning of a line in the password file signify?
8.Using the man pages, find the correct ioctl to send console output to an arbitrary pty.
9.What is an MX record?
10.What is the prom command on a Sun that shows the SCSI devices?
11.What is the factory default SCSI target for /dev/sd0?
12.Where is that value controlled?
13.What happens to a child process that dies and has no parent process to wait for it and
what’s bad about this?
14.What’s wrong with sendmail? What would you fix?
15.What command do you run to check file system consistency?
16.What’s wrong with running shutdown on a network?
17.What can be wrong with setuid scripts?
18.What value does spawn return?
19.Write a script to send mail from three other machines on the network to root at the
machine you’re on. Use a ‘here doc’, but include in the mail message the name of the
machine the mail is sent from and the disk utilization statistics on each machine?
20.Why can’t root just cd to someone’s home directory and run a program called a.out
sitting there by typing “a.out”, and why is this good?
21.What is the difference between UDP and TCP?
22.What is DNS?
23.What does nslookup do?
24.How do you create a swapfile?

7/31/07
karthik
1.How would you check the route table on a workstation/server?
2.How do you find which ypmaster you are bound to?
3.How do you fix a problem where a printer will cutoff anything over 1MB?
4.What is the largest file system size in solaris? SunOS?
5.What are the different RAID levels?
1.Advantages/disadvantages of script vs compiled program.
2.Name a replacement for PHP/Perl/MySQL/Linux/Apache and show main differences.
3.Why have you choosen such a combination of products?
4.Differences between two last MySQL versions. Which one would you choose and
when/why?
5.Main differences between Apache 1.x and 2.x. Why is 2.x not so popular? Which one
would you choose and when/why?
6.Which Linux distros do you have experience with?
7.Which distro you prefer? Why?
8.Which tool would you use to update Debian / Slackware / RedHat / Mandrake / SuSE ?
9.You’re asked to write an Apache module. What would you do?
10.Which tool do you prefer for Apache log reports?
11.Your portfolio. (even a PHP guest book may work well)
12.What does ‘route’ command do?
13.Differences between ipchains and iptables.
14.What’s eth0, ppp0, wlan0, ttyS0, etc.
15.What are different directories in / for?
16.Partitioning scheme for new webserver. Why?

thanks and regards,

karthik

7/31/07
karthik
« back to topics

=====================
• Whats HOT!

Top 100 Linux Interview Questions


1. You attempt to use shadow passwords but are unsuccessful. What characteristic of
the /etc/passwd file may cause this? Choose one: a. The login command is missing. b. The
username is too long. c. The password field is blank. d. The password field is prefaced by an
asterick.

2. You create a new user account by adding the following line to your /etc/passwd file.
bobm:baddog:501:501:Bob Morris:/home/bobm:/bin/bash Bob calls you and tells you that he
cannot logon. You verify that he is using the correct username and password. What is the
problem? Choose one: a. The UID and GID cannot be identical. b. You cannot have spaces in
the line unless they are surrounded with double quotes. c. You cannot directly enter the
password; rather you have to use the passwd command to assign a password to the user. d.
The username is too short, it must be at least six characters long.

3. 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.

4. You create a new user by adding the following line to the /etc/passwd file
bobm::501:501:Bob Morris:/home/bobm:/bin/bash You then create the user’s home directory
and use the passwd command to set his password. However, the user calls you and says that
he cannot log on. What is the problem? Choose one: a. The user did not change his
password. b. bobm does not have permission to /home/bobm. c. The user did not type his
username in all caps. d. You cannot leave the password field blank when creating a new user.

5. When using useradd to create a new user account, which of the following tasks is not
done automatically. Choose one: a. Assign a UID. b. Assign a default shell. c. Create the
user’s home directory. d. Define the user’s home directory.
6. 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.

7. You have created special configuration files that you want copied to each user’s home
directories when creating new user accounts. You copy the files to /etc/skel. Which of the
following commands will make this happen? Choose one: a. useradd -m username b. useradd
-mk username c. useradd -k username d. useradd -Dk username

8. Mary has recently gotten married and wants to change her username from mstone to
mknight. Which of the following commands should you run to accomplish this? Choose one: a.
usermod -l mknight mstone b. usermod -l mstone mknight c. usermod -u mknight mstone d.
usermod -u mstone mknight

9. After bob leaves the company you issue the command userdel bob. Although his entry
in the /etc/passwd file has been deleted, his home directory is still there. What command
could you have used to make sure that his home directory was also deleted? Choose one: a.
userdel -m bob b. userdel -u bob c. userdel -l bob d. userdel -r bob

10. All groups are defined in the /etc/group file. Each entry contains four fields in the
following order. Choose one: a. groupname, password, GID, member list b. GID, groupname,
password, member list c. groupname, GID, password, member list d. GID, member list,
groupname, password

11. You need to create a new group called sales with Bob, Mary and Joe as members.
Which of the following would accomplish this? Choose one: a. Add the following line to the
/etc/group file: sales:44:bob,mary,joe b. Issue the command groupadd sales. c. Issue the
command groupadd -a sales bob,mary,joe d. Add the following line to the /etc/group file:
sales::44:bob,mary,joe
12. What command is used to remove the password assigned to a group?

13. You changed the GID of the sales group by editing the /etc/group file. All of the
members can change to the group without any problem except for Joe. He cannot even login
to the system. What is the problem? Choose one: a. Joe forgot the password for the group. b.
You need to add Joe to the group again. c. Joe had the original GID specified as his default
group in the /etc/passwd file. d. You need to delete Joe’s account and recreate it.

14. You need to delete the group dataproject. Which two of the following tasks should you
do first before deleting the group? A. Check the /etc/passwd file to make sure no one has this
group as his default group. B. Change the members of the dataproject group to another group
besides users. C. Make sure that the members listed in the /etc/group file are given new login
names. D. Verify that no file or directory has this group listed as its owner. Choose one: a. A
and C b. A and D c. B and C d. B and D

15. When you look at the /etc/group file you see the group kmem listed. Since it does not
own any files and no one is using it as a default group, can you delete this group?

16. When looking at the /etc/passwd file, you notice that all the password fields contain ‘x’.
What does this mean? Choose one: a. That the password is encrypted. b. That you are using
shadow passwords. c. That all passwords are blank. d. That all passwords have expired.

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

18. What file contains the default environment variables when using the bash shell?
Choose one: a. ~/.profile b. /bash c. /etc/profile d. ~/bash

19. You have created a subdirectory of your home directory containing your scripts. Since
you use the bash shell, what file would you edit to put this directory on your path? Choose
one: a. ~/.profile b. /etc/profile c. /etc/bash d. ~/.bash
20. Which of the following interprets your actions when typing at the command line for the
operating system? Choose One a. Utility b. Application c. Shell d. Command

21. What can you type at a command line to determine which shell you are using?

22. You want to enter a series of commands from the command-line. What would be the
quickest way to do this? Choose One a. Press enter after entering each command and its
arguments b. Put them in a script and execute the script c. Separate each command with a
semi-colon (;) and press enter after the last command d. Separate each command with a / and
press enter after the last command

23. You are entering a long, complex command line and you reach the right side of your
screen before you have finished typing. You want to finish typing the necessary commands
but have the display wrap around to the left. Which of the following key combinations would
achieve this? Choose One a. Esc, /, Enter b. /, Enter c. ctrl-d, enter d. esc, /, ctrl-d

24. After typing in a new command and pressing enter, you receive an error message
indicating incorrect syntax. This error message originated from.. Choose one a. The shell b.
The operating system c. The command d. The kernel

25. When typing at the command line, the default editor is the _____________ library.

26. You typed the following at the command line ls -al /home/ hadden. What key strokes
would you enter to remove the space between the ‘/’ and ‘hadden’ without having to retype the
entire line? Choose one a. Ctrl-B , Del b. Esc-b , Del c. Esc-Del , Del d. Ctrl-b , Del

27. You would like to temporarily change your command line editor to be vi. What
command should you type to change it?

28. After experimenting with vi as your command line editor, you decide that you want to
have vi your default editor every time you log in. What would be the appropriate way to do
this? Choose one a. Change the /etc/inputrc file b. Change the /etc/profile file c. Change the
~/.inputrc file d. Change the ~/.profile file

29. You have to type your name and title frequently throughout the day and would like to
decrease the number of key strokes you use to type this. Which one of your configuration files
would you edit to bind this information to one of the function keys?

30. In your present working directory, you have the files maryletter memo1
MyTelephoneandAddressBook What is the fewest number of keys you can type to open the
file MyTelephoneandAddressBook with vi? Choose one a. 6 b. 28 c. 25 d. 4

31. A variable that you can name and assign a value to is called a _____________
variable.

32. You have installed a new application but when you type in the command to start it you
get the error message Command not found. What do you need to do to fix this problem?
Choose one a. Add the directory containing the application to your path b. Specify the
directory’s name whenever you run the application c. Verify that the execute permission has
been applied to the command. d. Give everyone read, write and execute permission to the
application’s directory.

33. You telnet into several of your servers simultaneously. During the day, you sometimes
get confused as to which telnet session is connected to which server. Which of the following
commands in your .profile file would make it obvious to which server you are attached?
Choose one a. PS1=’\h: \w>’ b. PS1=’\s: \W>’ c. PS1=’\!: \t>’ d. PS1=’\a: \n>’

34. Which of the following environment variables determines your working directory at the
completion of a successful login? Choose one a. HOME b. BASH_ENV c. PWD d.
BLENDERDIR

35. Every time you attempt to delete a file using the rm utility, the operating system prompts
you for confirmation. You know that this is not the customary behavior for the rm command.
What is wrong? Choose one a. rm has been aliased as rm -i b. The version of rm installed on
your system is incorrect. c. This is the normal behavior of the newest version of rm. d. There is
an incorrect link on your system.

36. You are running out of space in your home directory. While looking for files to delete or
compress you find a large file called .bash_history and delete it. A few days later, it is back
and as large as before. What do you need to do to ensure that its size is smaller? Choose one
a. Set the HISTFILESIZE variable to a smaller number. b. Set the HISTSIZE to a smaller
number. c. Set the NOHISTFILE variable to true. d. Set the HISTAPPEND variable to true.

37. In order to display the last five commands you have entered using the history
command, you would type ___________.

38. In order to display the last five commands you have entered using the fc command, you
would type ___________.

39. You previously ran the find command to locate a particular file. You want to run that
command again. What would be the quickest way to do this? Choose one a. fc -l find fc n b.
history -l find history n c. Retype the command d. fc -n find

40. Using command substitution, how would you display the value of the present working
directory? Choose one a. echo $(pwd) b. echo pwd c. $pwd d. pwd | echo

41. You need to search the entire directory structure to locate a specific file. How could you
do this and still be able to run other commands while the find command is still searching for
your file? Choose one a. find / -name filename & b. find / -name filename c. bg find / -name
filename d. &find / -name filename &

42. In order to create a file called DirContents containing the contents of the /etc directory
you would type ____________.

43. What would be displayed as the result of issuing the command ps ef? Choose one a. A
listing of the user’s running processes formatted as a tree. b. A listing of the stopped
processes c. A listing of all the running processes formatted as a tree. d. A listing of all system
processes formatted as a tree.

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

45. 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 ___________?

46. What key combination can you press to suspend a running job and place it in the
background?

47. You issue the command jobs and receive the following output: [1]- Stopped (tty output)
pine [2]+ Stopped (tty output) MyScript How would you bring the MyScript process to the
foreground? Choose one: a. fg %2 b. ctrl-c c. fg MyScript d. ctrl-z

48. You enter the command cat MyFile | sort > DirList & and the operating system displays
[4] 3499 What does this mean? Choose one a. This is job number 4 and the PID of the sort
command is 3499. b. This is job number 4 and the PID of the job is 3499. c. This is job
number 3499 and the PID of the cat command is 4. d. This is job number 4 and the PID of the
cat command is 3499.

49. You attempt to log out but receive an error message that you cannot. When you issue
the jobs command, you see a process that is running in the background. How can you fix this
so that you can logout? Choose one a. Issue the kill command with the PID of each running
command of the pipeline as an argument. b. Issue the kill command with the job number as an
argument. c. Issue the kill command with the PID of the last command as an argument. d.
Issue the kill command without any arguments.

50. You have been given the job of administering a new server. It houses a database used
by the sales people. This information is changed frequently and is not duplicated anywhere
else. What should you do to ensure that this information is not lost? Choose one a. Create a
backup strategy that includes backing up this information at least daily. b. Prepare a proposal
to purchase a backup server c. Recommend that the server be made part of a cluster. d.
Install an additional hard drive in the server.

51. 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? _________

52. Many factors are taken into account when planning a backup strategy. The one most
important one is how often does the file ____________.

53. Which one of the following factors does not play a role in choosing the type of backup
media to use? Choose one: a. How frequently a file changes b. How long you need to retain
the backup c. How much data needs to be backed up d. How frequently the backed up data
needs to be accessed

54. When you only back up one partition, this is called a ______ backup. Choose one a.
Differential b. Full c. Partial d. Copy

55. When you back up only the files that have changed since the last backup, this is called
a ______ backup. Choose one a. Partial b. Differential c. Full d. Copy

56. The easiest, most basic form of backing up a file is to _____ it to another location.

57. When is the most important time to restore a file from your backup? Choose one a. On
a regular scheduled basis to verify that the data is available. b. When the system crashes. c.
When a user inadvertently loses a file. d. When your boss asks to see how restoring a file
works.

58. As a system administrator, you are instructed to backup all the users’ home directories.
Which of the following commands would accomplish this? Choose one a. tar rf usersbkup
home/* b. tar cf usersbkup home/* c. tar cbf usersbkup home/* d. tar rvf usersbkup home/*

59. What is wrong with the following command? tar cvfb / /dev/tape 20 Choose one a. You
cannot use the c option with the b option. b. The correct line should be tar -cvfb / /dev/tape20.
c. The arguments are not in the same order as the corresponding modifiers. d. The files to be
backed up have not been specified.

60. You need to view the contents of the tarfile called MyBackup.tar. What command would
you use? __________

61. After creating a backup of the users’ home directories called backup.cpio you are asked
to restore a file called memo.ben. What command should you type?

62. You want to create a compressed backup of the users’ home directories so you issue
the command gzip /home/* backup.gz but it fails. The reason that it failed is that gzip will only
compress one _______ at a time.

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

64. 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, use the _________
utility.

65. Which two utilities can you use to set up a job to run at a specified time? Choose one:
a. at and crond b. atrun and crontab c. at and crontab d. atd and crond

66. You have written a script called usrs to parse the passwd file and create a list of
usernames. You want to have this run at 5 am tomorrow so you can see the results when you
get to work. Which of the following commands will work? Choose one: a. at 5:00 wed usrs b.
at 5:00 wed -b usrs c. at 5:00 wed -l usrs d. at 5:00 wed -d usrs

67. Several of your users have been scheduling large at jobs to run during peak load times.
How can you prevent anyone from scheduling an at job? Choose one: a. delete the file
/etc/at.deny b. create an empty file called /etc/at.deny c. create two empty files: /etc/at.deny
and /etc/at.allow file d. create an empty file called /etc/at.allow

68. How can you determine who has scheduled at jobs? Choose one: a. at -l b. at -q c. at -d
d. atwho

69. When defining a cronjob, there are five fields used to specify when the job will run.
What are these fields and what is the correct order? Choose one: a. minute, hour, day of
week, day of month, month b. minute, hour, month, day of month, day of week c. minute, hour,
day of month, month, day of week d. hour, minute, day of month, month, day of week

70. You have entered the following cronjob. When will it run? 15 * * * 1,3,5 myscript Choose
one: a. at 15 minutes after every hour on the 1st, 3rd and 5th of each month. b. at 1:15 am ,
3:15 am, and 5:15 am every day c. at 3:00 pm on the 1st, 3rd, and 5th of each month d. at 15
minutes after every hour every Monday, Wednesday, and Friday

71. As the system administrator you need to review Bob’s cronjobs. What command would
you use? Choose one: a. crontab -lu bob b. crontab -u bob c. crontab -l d. cronq -lu bob

72. In order to schedule a cronjob, the first task is to create a text file containing the jobs to
be run along with the time they are to run. Which of the following commands will run the script
MyScript every day at 11:45 pm ? Choose one: a. * 23 45 * * MyScript b. 23 45 * * * MyScript
c. 45 23 * * * MyScript d. * * * 23 45 MyScript

73. Which daemon must be running in order to have any scheduled jobs run as scheduled?
Choose one: a. crond b. atd c. atrun d. crontab

74. You want to ensure that your system is not overloaded with users running multiple
scheduled jobs. A policy has been established that only the system administrators can create
any scheduled jobs. It is your job to implement this policy. How are you going to do this?
Choose one: a. create an empty file called /etc/cron.deny b. create a file called /etc/cron.allow
which contains the names of those allowed to schedule jobs. c. create a file called
/etc/cron.deny containing all regular usernames. d. create two empty files called
/etc/cron.allow and /etc/cron.deny

75. You notice that your server load is exceptionally high during the hours of 10 am to 2
noon . When investigating the cause, you suspect that it may be a cron job scheduled by one
of your users. What command can you use to determine if your suspicions are correct?
Choose one: a. crontab -u b. crond -u c. crontab -l d. crond -l

76. One of your users, Bob, has created a script to reindex his database. Now he has it
scheduled to run every day at 10:30 am . What command should you use to delete this job.
Choose one: a. crontab -ru bob b. crontab -u bob c. crontab -du bob d. crontab -lu bob

77. What daemon is responsible for tracking events on your system?

78. What is the name and path of the default configuration file used by the syslogd
daemon?

79. You have made changes to the /etc/syslog.conf file. Which of the following commands
will cause these changes to be implemented without having to reboot your computer? Choose
one: a. kill SIGHINT `cat /var/run/syslogd.pid` b. kill SIGHUP `cat /var/run/syslogd.pid` c. kill
SIGHUP syslogd d. kill SIGHINT syslogd

80. Which of the following lines in your /etc/syslog.conf file will cause all critical messages
to be logged to the file /var/log/critmessages? Choose one: a. *.=crit /var/log/critmessages b.
*crit /var/log/critmessages c. *=crit /var/log/critmessages d. *.crit /var/log/critmessages

81. You wish to have all mail messages except those of type info to the
/var/log/mailmessages file. Which of the following lines in your /etc/syslogd.conf file would
accomplish this? Choose one: a. mail.*;mail!=info /var/log/mailmessages b. mail.*;mail.=info
/var/log/mailmessages c. mail.*;mail.info /var/log/mailmessages d. mail.*;mail.!=info
/var/log/mailmessages
82. What is the name and path of the main system log?

83. Which log contains information on currently logged in users? Choose one: a.
/var/log/utmp b. /var/log/wtmp c. /var/log/lastlog d. /var/log/messages

84. You have been assigned the task of determining if there are any user accounts defined
on your system that have not been used during the last three months. Which log file should
you examine to determine this information? Choose one: a. /var/log/wtmp b. /var/log/lastlog
c. /var/log/utmp d. /var/log/messages

85. You have been told to configure a method of rotating log files on your system. Which of
the following factors do you not need to consider? Choose one: a. date and time of messages
b. log size c. frequency of rotation d. amount of available disk space

86. What utility can you use to automate rotation of logs?

87. You wish to rotate all your logs weekly except for the /var/log/wtmp log which you wish
to rotate monthly. How could you accomplish this. Choose one: a. Assign a global option to
rotate all logs weekly and a local option to rotate the /var/log/wtmp log monthly. b. Assign a
local option to rotate all logs weekly and a global option to rotate the /var/log/wtmp log
monthly. c. Move the /var/log/wtmp log to a different directory. Run logrotate against the new
location. d. Configure logrotate to not rotate the /var/log/wtmp log. Rotate it manually every
month.

88. You have configured logrotate to rotate your logs weekly and keep them for eight
weeks. You are running our of disk space. What should you do? Choose one: a. Quit using
logrotate and manually save old logs to another location. b. Reconfigure logrotate to only save
logs for four weeks. c. Configure logrotate to save old files to another location. d. Use the
prerotate command to run a script to move the older logs to another location.

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


90. What file defines the levels of messages written to system log files?

91. What account is created when you install Linux?

92. 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? Choose one: a. Issue the command rootlog. b. Issue the command su and
type exit when finished. c. Issue the command su and type logoff when finished. d. Issue the
command logon root and type exit when finished.

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

94. There are seven fields in the /etc/passwd file. Which of the following lists all the fields in
the correct order? Choose one: a. username, UID, GID, home directory, command, comment
b. username, UID, GID, comment, home directory, command c. UID, username, GID, home
directory, comment, command d. username, UID, group name, GID, home directory, comment

95. Which of the following user names is invalid? Choose one: a. Theresa Hadden b.
thadden c. TheresaH d. T.H.

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

97. The beginning user identifier is defined in the _________ file.

98. Which field is used to define the user’s default shell?

99. Bob Armstrong, who has a username of boba, calls to tell you he forgot his password.
What command should you use to reset his command?
100. Your company has implemented a policy that users’ passwords must be reset every
ninety days. Since you have over 100 users you created a file with each username and the
new password. How are you going to change the old passwords to the new ones? Choose
one: a. Use the chpasswd command along with the name of the file containing the new
passwords. b. Use the passwd command with the -f option and the name of the file containing
the new passwords. c. Open the /etc/passwd file in a text editor and manually change each
password. d. Use the passwd command with the -u option.

Description :
1. Quick Guide Linux Command Line Anuchit Chalothorn
2. About ? Senior Software Engineer @ SIPA ? Fedora Ambassador @ Fedora Project ? Ubuntu
LocoTeam @ Ubuntu Club
3. Linux? ? Operating System ? “Linux” = Linux kernel ? Linus Torvalds develop Linux kernel ?
More than 10,000 developers around the world ? Release under GNU/GPL Version 2.0
4. Why command line ? Hardware Kernel Shell
5. Shell chabu@pirate:~$ root@pirate:~# ** file and directory is case sensitive **
6. Basic Command $command <option> Eg: ls -la ** use TAB to complete command **
7. Basic Command ? whoami show who you are ? ls list file & directory ? cp copy file
8. Basic Command ? cd change to $HOME directory ? cd somedir change to somedir ? pwd
show current directory
9. Basic Command ? mv move or rename file & directory ? touch filename create blank file ?
cat filename view content in file
10. Basic Command ? ps list the process ? pstree list the process as tree ? cat filename view
content in file
11. Basic Command ? tar myfile.tar myfile create archive file .tar ? gzip myfile create archive
file .gz ? tar zxvf myfile.tar.gz myfile create archive in tar then gzip
12. Pipe and Direction ? Pipe | combined shell command ? Direction >,<, >> sent out put, sent
input ? Step Command line ; run more command in 1 line
13. Pipe & Direction ? ls -la | more list all file in current directory with page break ? ls -la >
mylistfile.txt list all fire in current directory and save the result to mylistfile.txt ? cat
mylistfile.txt > mylistfile2.txt list content and sent to mylistfile2.txt
14. Pipe & Direction ? touch mylistfile3.txt ? echo “Hello World” > mylistfile3.txt ? echo “My
name is Anuchit.ch” >> mylisyfile3.txt
15. Editor in Command Line ? vim or vi ? pico ? nano ? mcedit
16. Advance Command Line Combine shell script with basic command or shell programming...
17. Q&A
18. CC-BY-SA

Some Important Linux Commands

Quick Reference to Frequently Used Commands

1. alias - To create an alias (nickname) for a command or show which aliases already exist.

2. at - To schedule a command to run at a particular time. Great for running time-consuming commands
later, such as in the middle of the night.

3. apt - A package management tool used by the Debian Linux distribution.

4. banner - To display text in huge, ugle letters.

5. bash - To run the BASH shell, optionally running a script

6. bc - A handy-dandy desk calculator

7. bg - To background a process or job.

8. cal - To print a calender for a month or a year

9. cat - To display a file on-screen

10. cd - To change to another directory, that is, to change the current working directory to the directory

you indicate

11. chgrp - To change the group that has access to a file or directory

12. chmod - To chane the permissions for a file

13. chown - To change the ownership of a file

14. cmp - To compare two files and tell you the line numbers where they differ.

15. comm - To compare two text files, each of which is sorted in alphabetical order. Ther program shows

you lines that are in both files versus lines that are in just one of them.

16. compress - To shrink a file into a compressed file so that it takes up less space on your disk

17. cp - to copy one or more files

18. cron - This will run scheduled jobs, its similar to the 'at' command above do 'man crontab' or Man

Pages for all of its capabilities.

19. csh - To run the C shell, optionally running a script of stored commands

20. date - To tell you the current date and time, taking into account your time zone and, if appropriate,

daylight savings time.

21. df - To display how much space is free on your disk

22. diff - To compare two files and print the lines in which the files differ.

23. dpkg - A package management tool used by the Debian Linux distribution.

24. dselect - A package management tool used by the Debian Linux distribution.

25. echo - To echo back whatever you type on the command line after echo, expanding any wildcards

using *, ?, or [ ]

26. ed - To run one of the world's ugliest line-oriented text editors

27. elm - To read and send e-mail


28. emacs - To run a powerful, screen-oriented text editor.

29. exit - To logout. When used in a terminal window, closes the window. If exit doesn't work try typing

logout. Pressing Ctrl-D can also log you out.

30. fg - To continue a job that you have running in the background.

31. file - To tell you whether something is a file, a direcotry, or something else entirely. If the thing is a

file, the file command tries to guess what type of information it contains.

32. find - To find one or more files, assuming that you know their approximate filenames, and do

something to them. Use this command when you can't figure out the directory where you put one or more

files, but you know the filename(s). When you use the find command, you tell it where to start looking,

usually either . (which means "right here") or / (which means "search the entire disk"). Then give the

name of the file (type -name, a space and the filename, possibly using wilcard characters), and then you

tell find what to do when it finds the files, usually -print (to mean "display the full filenames, including

the names of the directories that they are in")

33. ftp - To transfer files from one computer to another over a network

34. getty - sets terminal mode, speed, and line discipline

35. grep - To find lines in one or more files that contain a particular word or phrase. There are two

similar commands, egrep and fgrep, that you will probably never use.

36. gs - To print PostScript files, even if you don't have a PostScript printer.

37. gunzip - To unzip gzipped files. Replaces a .gz file with the orginal file.

38. gzip - To compress a file, replaces the orginal file with a GNU ZIP file with a name ending in .gz

39. head - To display just the first few lines of a file (usually the first ten).

40. history - To list the last 20 or so commands you typed. Works only with the BASH, Korn and C shells.

41. id - To tell you your numeric user and group ID, and on BSD, what groups you are in.

42. ifconfig - By typing ifconfig you will see your lo (local), eth0(ethernet), and ppp0(dialup) ip addresses

and configurations. do "man ifconfig" or Man Pages for more information.

43. inittab - format of the inittab file used by the sysv-com-patible init process

44. kibitz - A way for two users to share a shell. This is good for teaching purpose's so one user can watch

and learn as the other user does things on the system. Both users can send text to the shell screen.

45. kill - To cancel a job that you don't want to continue

46. ksh - To run the Korn shell

47. ln - To create a link to a file so that the file has more than one name or lives in more than one
directory. If you use a file all the time and are tired of moving to the directory where it lives, link the file

to your home direcotry or to another convenient place. When you use ln, you tell it the current pathname

of the file and the new filename you want in the current working directory.

48. logout - To tell unix you are done using it

49. lpr - To print a file

50. lpq - To list the status of al the available printers

51. ls - To list the files in a direcotry. If you don't tell it otherwise, the ls command lists all the files in the

working directory. You can tell it the name of antoher directory to list, and you can specify the files you

want listed by using a filename(which can include wildcards) Go back to Section One for some other good

uses for ls.

52. mail - To read and send e-mail. We suggest using elm or pine instead, if they are available, or any of

the GUI e-mail programs found in X.

53. man - To display reference manual page about Unix/Linux commands

54. minicom - friendly serial communication program

55. mkdir - To create a new directory

56. more - To display information a screen at a time, so you have time to read it. When the screen is full,

more pauses. To tell it to show you more, press the spacebar. To make more stop, press q.

57. mv - To rename a file or move it from one directory to another.

58. nice - To run a command with lower priority so that it doesn't hog the computer

59. netconfig - To configure your local network settings

60. nslookup - query Internet name servers interactively

61. pack - To shrink a file into one "packed" file so that it takes up less space on you disk. The command

is obsolete; compress and gzip shrink alot better

62. passwd - To change your password

63. pcat - To display the contents of a packed file. Packes files have names that end in .z (That's a small

z)

64. pico - To run a simple, screen-oriented text editor.

65. pine - To run a nicely designed e-mail program

66. pkgtool - To install and uninstall packages in Slackware

67. pr - To format a text file with page numbers, line numbers, or other options so that it looks nice when

you print it.


68. ps - To display information about your process table (jobs) There are several switches you can use

with this command do 'man ps' or Man Pages to see them all.

69. pwd - To display the name of the current working directory

70. rcp - To copy files to or from another computer.

71. rlogin - To log in to another UNIX computer on a network. See also telnet.

72. rm - To delete (remove) a file permanently. If there are other links to the file, the file continues to

exist, just not under the name you removed. The rm command delete just one name (link) to the file. Be

very careful with this command as there is no recycle bin in Unix/Linux and you can not easily get the file

back.

73. rmdir - To delete (remove) a directory. Before you delete a directory, delete the files and

subdirectories that it contains. The -r option does this for you, but make sure that this is what you really

want to do.

74. RPM - RPM is the RedHat Package Manager. It is used to maintain a database of installed packages and

the files beloging to each package to allow easy installation, upgrades and removal of packages. The RPM

home is http://www.rpm.org. Many packages are at http://rufus.w3.org/linux/RPM/. To install or

upgrade an rpm use rpm -U package.rpm (for upgrade and install) and to remove use rpm -e package (for

erase).

75. rsh - To run a command on another UNIX computer. NOTE: called remsh on some systems.

76. set - To set a shell variable to the value you specify, or to display the value of the shell variable. In

any shell, typing set by itself lists the variables that are defined, and their values.

77. sh - To run the Bourne shell

78. shutdown - To stop Unix/Linux and prepare a workstation to be turned off. Do 'man shutdown' or Man

Pages for required switches

79. sleep - To wait a little while.

80. sort - To sort the lines in a text file.

81. spell - To look through a text file for words not int he UNIX dictionary

82. stty - To set the options for your terminal

83. tail - To display the last few lines of a file

84. talk - To talk to another computer user by typing messages to each other on-screen

85. tar - To copy a file to or from an archieve file or backup tape or diskette. This command has several

usages do 'man tar' or Man Pages too see all of them.


86. tee - To copy text from a pipe into a file. tee is most useful for making a log of the output of a slow

or long-running program while still seeing its output on-scree. It's also good for debugging scripts so that

you can see what's coming out of one program and going into another.

87. telnet - To log in to a remote computer, even one that doesn't run unix.

88. troff - To format text files for output on a high-quality printer or typsetter unsing a complex

formatting language.

89. updatedb - This command will update the internal database of the filesystem.

90. unpack - To restore a packed files to irs orginal size A .z at the end of the filename confirms that this

is a packed tile. If a filename ends with .Z (uppercase) instead it is compressed and you must use the

uncompress command.

91. uucp - To copy a file to another computer

92. uudecode - To convert a uuencoded file back into its orginal form

93. uuencode - To disguise a program as a text file so that you can send it through electronic mail

94. vi - To run a powerful, but yucky, screen-oriented text editor.

95. vim - Is vi improved and is a much better and more powerful screen-oriented text editor than vi

96. wall - To display a message on-screnn to every single user on your entire computer. Use with care.

97. who - To tell you who else is using this computer.

98. whoami - Tells you the user you are currently using

99. write - To display a message on the screen of another user.

100. zcat - To uncompress a compressed file and send the results to standard output (usually the screen).

Compressed files have names ending in .Z (uppercase)

LINUX INTERVIEW QUESTIONS Set-1

There are seven fields in the /etc/passwd file. Which of the following lists all the
fields in the correct order?
Choose one:
a. username, UID, GID, home directory, command, comment
b. username, UID, GID, comment, home directory, command
c. UID, username, GID, home directory, comment, command
d. username, UID, group name, GID, home directory, comment
Answer: b

The seven fields required for each line in the /etc/passwd file are username, UID, GID,
comment, home directory, command. Each of these fields must be separated by a colon even
if they are empty.

Which of the following commands will show a list of the files in your home directory
including hidden files and the contents of all subdirectories?
Choose one:
a. ls -c home
b. ls -aR /home/username
c. ls -aF /home/username
d. ls -l /home/username
Answer: b

The ls command is used to display a listing of files. The -a option will cause hidden files to be
displayed as well. The -R option causes ls to recurse down the directory tree. All of this starts
at your home directory.
In order to prevent a user from logging in, you can add a(n) ________at the beginning of the
password field.
Answer: asterick

If you add an asterick at the beginning of the password field in the /etc/passwd file, that user
will not be able to log in.
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.
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.
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.
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.
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.
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.

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.

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.
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.
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.
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.

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.

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.

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.


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

What key combination can you press to suspend a running job and place it in the
background?
ctrl-z

Using ctrl-z will suspend a job and put it in the background.


The easiest, most basic form of backing up a file is to _____ it to another location.
copy

The easiest most basic form of backing up a file is to make a copy of that file to another
location such as a floppy disk.
What type of server is used to remotely assign IP addresses to machines during the
installation process?
A) SMB
B) NFS
C) DHCP
D) FT
E) HTTP

C - You can use a DHCP server to assign IP addresses to individual machines during the
installation process. Answers a, b, d, and e list legitimate Linux servers, but these servers do
not provide IP addresses. The SMB, or Samba, tool is used for file and print sharing across
multi-OS networks. An NFS server is for file sharing across Linux net-works. FTP is a file storage
server that allows people to browse and retrieve information by logging in to it, and HTTP is for
the Web.

Which password package should you install to ensure that the central password file
couldn't be stolen easily?
A) PAM
B) tcp_wrappers
C) shadow
D) securepass
E) ssh

C - The shadow password package moves the central password file to a more secure location.
Answers a, b, and e all point to valid packages, but none of these places the password file in a
more secure location. Answer d points to an invalid package.

When using useradd to create a new user account, which of the following tasks is
not done automatically.
Choose one:
a. Assign a UID.
b. Assign a default shell.
c. Create the user's home directory.
d. Define the user's home directory.

The useradd command will use the system default for the user's home directory. The home
directory is not created, however, unless you use the -m option.

You want to enter a series of commands from the command-line. What would be the
quickest way to do this?
Choose One
a. Press enter after entering each command and its arguments
b. Put them in a script and execute the script
c. Separate each command with a semi-colon (;) and press enter after the last command
d. Separate each command with a / and press enter after the last command

The semi-colon may be used to tell the shell that you are entering multiple commands that
should be executed serially. If these were commands that you would frequently want to run,
then a script might be more efficient. However, to run these commands only once, enter the
commands directly at the command line.

You attempt to use shadow passwords but are unsuccessful. What characteristic of
the /etc/passwd file may cause this?
Choose one:
a. The login command is missing.
b. The username is too long.
c. The password field is blank.
d. The password field is prefaced by an asterisk.

The password field must not be blank before converting to shadow passwords.

When you install a new application, documentation on that application is also


usually installed. Where would you look for the documentation after installing an
application called MyApp?
Choose one:
a. /usr/MyApp
b. /lib/doc/MyApp
c. /usr/doc/MyApp
d. In the same directory where the application is installed.

c
The default location for application documentation is in a directory named for the application in
the /usr/doc directory.

What file would you edit in your home directory to change which window manager
you want to use?
A) Xinit
B) .xinitrc
C) XF86Setup
D) xstart
E) xf86init

Answer: B - The ~/.xinitrc file allows you to set which window man-ager you want to use when
logging in to X from that account.
Answers a, d, and e are all invalid files. Answer c is the main X server configuration file.

INTERVIEW QUESTIONS set-2

What command allows you to set a processor-intensive job to use less CPU
time?
A) ps
B) nice
C) chps
D) less
E) more

Answer: B - The nice command is used to change a job's priority level, so that it
runs slower or faster. Answers a, d, and e are valid commands but are not used to
change process information. Answer c is an invalid command.

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?
Choose one:
a. Issue the command rootlog.
b. Issue the command su and type exit when finished.
c. Issue the command su and type logoff when finished.
d. Issue the command logon root and type exit when finished.

Answer: b
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.

In order o run fsck on the root partition, the root partition must be mounted as
readonly
You cannot run fsck on a partition that is mounted as read-write.
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.

Bob Armstrong, who has a username of boba, calls to tell you he forgot his
password. What command should you use to reset his command?
passwd boba

The passwd command is used to change your password. If you do not specify a
username, your password will be changed.

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 ___________?
nice

Both the top and nice utilities provide the capability to change the priority of a
running process.

What command should you type to see all the files with an extension of
'mem' listed in reverse alphabetical order in the /home/ben/memos
directory.
ls -r /home/ben/memos/*.mem

The -c option used with ls results in the files being listed in chronological order. You
can use wildcards with the ls command to specify a pattern of filenames.

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.

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


gpasswd -r

The gpasswd command is used to change the password assigned to a group. Use the
-r option to remove the password from the group.

What command would you type to use the cpio to create a backup called
backup.cpio of all the users' 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.

What can you type at a command line to determine which shell you are
using?
echo $SHELL

The name and path to the shell you are using is saved to the SHELL environment
variable. You can then use the echo command to print out the value of any variable
by preceding the variable's name with $. Therefore, typing echo $SHELL will display
the name of your shell.

What type of local file server can you use to provide the distribution
installation materials to the new machine during a network installation?
A) Inetd
B) FSSTND
C) DNS
D) NNTP
E) NFS
E - You can use an NFS server to provide the distribution installation materials to the
machine on which you are performing the installation. Answers a, b, c, and d are all
valid items but none of them are file servers. Inetd is the superdaemon which
controls all intermittently used network services. The FSSTND is the Linux File
System Standard. DNS provides domain name resolution, and NNTP is the transfer
protocol for usenet news.

If you type the command cat dog & > cat what would you see on your
display? Choose one:
a. Any error messages only.
b. The contents of the file dog.
c. The contents of the file dog and any error messages.
d. Nothing as all output is saved to the file cat.

When you use & > for redirection, it redirects both the standard output and
standard error. The output would be saved to the file cat.

You are covering for another system administrator and one of the users asks you to
restore a file for him. You locate the correct tarfile by checking the backup log but do
not know how the directory structure was stored. What command can you use to
determine this?
Choose one:
a. tar fx tarfile dirname
b. tar tvf tarfile filename
c. tar ctf tarfile
d. tar tvf tarfile

(d)

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

You have the /var directory on its own partition. You have run out of space. What
should you do? Choose one:
a. Reconfigure your system to not write to the log files.
b. Use fips to enlarge the partition.
c. Delete all the log files.
d. Delete the partition and recreate it with a larger size.

(d)

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.

You have a new application on a CD-ROM that you wish to install. What should your
first step be?
Choose one:
a. Read the installation instructions on the CD-ROM.
b. Use the mount command to mount your CD-ROM as read-write.
c. Use the umount command to access your CD-ROM.
d. Use the mount command to mount your CD-ROM as read-only.

(d)

Before you can read any of the files contained on the CD-ROM, you must first mount
the CD-ROM.

When you create a new partition, you need to designate its size by defining
the starting and ending _____________.
cylinders

When creating a new partition you must first specify its starting cylinder. You can
then either specify its size or the ending cylinder.

You need to see the last fifteen lines of the files dog, cat and horse. What
command should you use?
tail -15 dog cat horse

The tail utility displays the end of a file. The -15 tells tail to display the last fifteen
lines of each specified file.

Who owns the data dictionary?


The SYS user owns the data dictionary. The SYS and SYSTEM users are created when
the database is created.

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, use
the _________ utility.
zcat

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

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?
which

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

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.

You wish to create a link to the /data directory in bob's home directory so you issue
the command ln /data /home/bob/datalink but the command fails. What option
should you use in this command line to be successful.
Use the -F option

In order to create a link to a directory you must use the -F option.

When you issue the command ls -l, the first character of the resulting
display represents the file's ___________.
type

The first character of the permission block designates the type of file that is being
displayed.

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.

Where is standard output usually directed?


to the screen or display

By default, your shell directs standard output to your screen or display.

You wish to restore the file memo.ben which was backed up in the tarfile
MyBackup.tar. What command should you type?
tar xf MyBackup.tar memo.ben

This command uses the x switch to extract a file. Here the file memo.ben will be
restored from the tarfile MyBackup.tar.

You need to view the contents of the tarfile called MyBackup.tar. What
command would you use?
tar tf MyBackup.tar

The t switch tells tar to display the contents and the f modifier specifies which file to
examine.
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.

What daemon is responsible for tracking events on your system?


syslogd

The syslogd daemon is responsible for tracking system information and saving it to
specified log files.

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

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

You would like to temporarily change your command line editor to be vi.
What command should you type to change it?
set -o vi

The set command is used to assign environment variables. In this case, you are
instructing your shell to assign vi as your command line editor. However, once you
log off and log back in you will return to the previously defined command line editor.

What account is created when you install Linux?


root

Whenever you install Linux, only one user account is created. This is the superuser
account also known as root.

What command should you use to check the number of files and disk space
used and each user's defined quotas?

repquota

The repquota command is used to get a report on the status of the quotas you have
set including the amount of allocated space and amount of used space.

Linux interview - August 21, 2008 at 22:00 pm by Rajmeet Ghai


What is Linux and why is it so popular?
Answer - Linux is an operating system that uses UNIX like Operating system.......
Unix interview questions with answers
Discuss the mount and unmount system calls, What are the process states in Unix?, What is use of sed
command?, What is 'inode'?,What are the Unix system calls for I/O?, How are devices represented in
UNIX?, Brief about the directory representation in UNIX ......
What is LILO?
Answer - LILO is Linux Loader is a boot loader for Linux. It is used to load Linux into the memory and start
the Operating system.......
What is the difference between home directory and working directory?
Answer - Home directory is the default working directory when a user logs in. On the other hand, working
directory is the user’s current directory.......
What is the difference between internal and external commands?
Answer - Internal commands are commands that are already loaded in the system. They can be executed
any time and are independent.......
Explain the difference between a static library and a dynamic library.
Answer - Static libraries are loaded when the program is compiled and dynamically-linked libraries are
loaded in while......
What is LD_LIBRARY_PATH?
Answer - LD_LIBRARY_PATH is an environment variable. It is used for debugging a new library or a non
standard library.......
What is the file server in Linux server?
Answer - File server is used for file sharing. It enables the processes required fro sharing.......
What is NFS? What is its purpose?
Answer - NFS is Network File system. It is a file system used for sharing of files over a network.......
How do I send email with linux?
Answer - Email can be sent in Linux using the mail command. ......
Explain RPM (Red Hat Package Manager) features.
Answer - RPM is a package managing system (collection of tools to manage software packages).......
What is Kernel? Explain the task it performs.
Answer - Kernel is used in UNIX like systems and is considered to be the heart of the operating system.......
What is Linux Shell? What is Shell Script?
Answer - Linux shell is a user interface used for executing the commands. Shell is a program the user......
What are Pipes? Explain use of pipes.
Answer - A pipe is a chain of processes so that output of one process (stdout) is fed an input (stdin) to
another.......
Explain trap command; shift Command, getopts command of linux.
Answer - Trap command: controls the action to be taken by the shell when a signal is received. ......
What Stateless Linux server? What feature it offers?
Answer - A stateless Linux server is a centralized server in which no state exists on the single workstations.
......
What does nslookup do? Explain its two modes.
Answer - Nslookup is used to find details related to a Domain name server. Details like IP addresses of a
machine, MX records,......
What is Bash Shell?
Answer - Bash is a free shell for UNIX. It is the default shell for most UNIX systems. It has a combination of
the C and Korn shell features. ......
Explain some Network-Monitoring Tools in Linux: ping, traceroute, tcpdump, ntop
Answer - Network monitoring tools are used to monitor the network, systems present on the network, traffic
etc.......
How does the linux file system work?
Answer - Linux file structure is a tree like structure. It starts from the root directory, represented by '/', and
then expands into sub-directories.......
What are the process states in Linux?
Answer - Process states in Linux.......
What is a zombie?
Answer - Zombie is a process state when the child dies before the parent process. In this case the
structural information of the process is still in the process table.......
Explain each system calls used for process management in linux.
Answer - System calls used for Process management......
Interview is an essential part of the selection criteria of any company and every one have to
go through it. Many candidates frightens from the name of "Interview" because they are
completely unaware about the atmosphere and questions that can be asked to them. In the
following web pages you will learn "How to answer some difficult questions". There are one
hundred questions covered to make you sure that if you follow these questions, definitely the
chances of your job opportunity will be enhanced.

1. Difficult Interview Questions - Page 1


Question: Tell me about yourself ?

Answer: Whenever you go for the interview, most probably this is the first question
asked to interviewee. This is likely to be a warm-up question. So you should not
waste your best points on it. More difficult questions are yet to be asked. So just cover
up our topics for answering this question: early years, education, work history, and
recent career experience.

2. Difficult Interview Questions - Page 2


Question : Why should we hire you?

Answer: The best way to answer of this question is to convince them by giving the
examples of your skills and worthiness why you are the best candidate for the job.
Compare the job description with your abilities before them, as well as also mentioned
what you have accomplished in your other positions. Be positive and attracts their
attention towards your ability, your experience, and your energy. Also show your
interest in the company and the position.

3. Difficult Interview Questions - Page 3


Question : What Are Three Positive Things Your Last Boss Would Say About You?

Answer: This is the time to express your best old performance appraisals given by
your last boss by your own mouth. This is a great way to brag about yourself through
someone else's words: "My boss has told me that I am the best marketing manager he
has ever had. He knows he can rely on me, and he likes my communication skill,
intelligence, sense of humor and presence of minds."

4. Difficult Interview Questions - Page 4


Question : What are your Weaknesses?

Answer: It's not just a pull legging question but also brainteasers that will ask the
check your presence of mind. Be positive and deliver your answer in such a way
that your weakness should reflect to your strengths. For example, say you are a
stickler for meeting deadlines and will stay on top of a project until it is done according
to your specifications, which may cause you to sometimes work late nights. Be
confident and answer it in a good sound.

5. Difficult Interview Questions - Page 5


Question : Why haven't you found a new position before now?

Answer: I've found various jobs but couldn't find suitable for me. I think that finding
a job is easy; but finding the right job is more difficult. I was looking for a more
challenging job.

6. Difficult Interview Questions - Page 6


Question : How long would you stay with us?

Answer: Don't be hesitate to answer this question, because the manager or


interview panel wants to know that won't you ditch them in the way. If it is not a
very big and reputed organization, the chances of leaving the organization has been
increased. So this question is most often asked. Answer that I'll be here till I'll face the
challenges and every time new challenges. I don't like repetition of work or routine
work. If I keep on facing challenges in this organization, I'll will be everlasting here.

7. Difficult Interview Questions - Page 7


Question : What is your management style?

Answer: For answering this question you have to verify yourself as a task oriented,
result oriented, paternalism ( take care of your subordinates and give them the right
direction ) and versatile manager, how are are different to others. The best way of
management system is "Open-door management system ( to motivate people and
delegate responsibility )" Now days. You must reply by using the examples of this
method.

8. Difficult Interview Questions - Page 8


Question : Prepare a plan for your first 1/2/3 months in the role and present it at the
interview?

Answer: This question is generally asked to the marketing managers or commercial


managers, but can also be asked to the other managers too. This question is asked to
valuate the knowledge and planning skill of the manager. Don't to be exaggerate. You
can take the help of Gantt chart to represent it, this is also a better way for
representation.

9. Difficult Interview Questions - Page 9


Question : How would you describe your own personality?

Answer: This question can be asked to you in another way like "Describe your
personality in one words?" The main purpose for asking this sort of question is to get
an idea of your personality in your own words. "What do you think about yourself?"
The answers may differ from person to person depending upon it's strength and
weakness. But before answering must realize about the types of job, designation and
company. What are the requirements of these? "Balanced" is the nice word to be
used.

10. Difficult Interview Questions - Page 10


Question : Do you have any questions?

Answer: Don't answer like that "No Sir, I think you have covered everything what I
want to know. I'm sure, I'll have more questions if I get the job." It is a very passive
response that demonstrate your lack of interest in the company or lack of
imagination in yourself. If you really want the job, show your interest in the company
and ask several question regarding company's policy, working culture, responsibilities
of your job designation in that company, the first challenge for the new one in that
company, etc.

Interviewing is a two-way process in which both the interviewer and the interviewee evaluate
each other and find a good fit for you and for the employer. That is a win-win situation. There
can be no similarities between any two interviewers and interviews, so it is impossible to be
prepare all the questions that will be asked. So prepare some basic difficult questions like
given in the above web pages, you will be definitely benefited.

You might also like