Interview Questions2
Interview Questions2
1. 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.
3. 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.
4. 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
5. 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.
6. 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.
7. 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.
8. 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.
10. 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.
11. 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.
12. 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.
15. 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.