Linux Notes
Linux Notes
Answer: fsck
The fsck command is used to check the integrity of the filesystem on your disk.
You want to print out a text file called vacations however the lines are of varying
length. What text filter could you use to even out
Answer: fmt
The fmt text utility attempts to make all the lines the same lenght by joining or
splitting lines.
You need to locate a file called salesdata that one of your user’s created in his
home directory but you do not know which one.
How could you use the find command to locate this file?
When using the find command to locate a file by name you must specify the
starting place in the directory heirarchy and the -name option
What command would you type to use the cpio to create a backup called
backup.cpio of all the users’ home directories?
Answer: 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.
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.
Answer: file
You have three files in the /home/ben/memos directory called letters, tom, betty.
How could you determine each file’s type by issuing only one command?
The file utility will display the file’s type for each filename that is passed as an
argument.
In order to display the last five commands you have entered using the fc command,
you would type ___________.
Answer: fc -5
The fc command can be used to edit or rerun commands you have previously
entered. To specify the number of commands to list, use -n.
Each command has two types of output. There are standard output and standard
__________.
Answer: error
By default, each command sends its result as standard output and any error
messages as standard error.
What can you type at a command line to determine which shell you are using?
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,
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
Answer: 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.
What would you type to send the last 20 lines of a text file to STDIN?
A) end -n 20 filename
B) last -n 20 filename
Answer: E – Use the command tail -20 filename to see the last 20 lines of a file. The
answers for a and d both point to an invalid command.
The answer for b points to a valid command. Typing this answer in with a valid file
name will even give you some output. However,
the last command tells you who is logged in, it does not actually list the contents of
any file named in the command. The answer for c,
the head command, is used to look at the beginning of a file, not the end.
A) mkboot
B) make bootdsk
C) make boot
D) mkbootdsk
E) mkbootdisk
Answer: E – The mkbootdisk command creates a boot disk. Answers b and c are
incorrect. The make package is used to compile software,
B) runlevel
C) level
D) run
E) init
Answer: E – The command used to change runlevels is init. Answers a, c, and d point
to invalid commands. Answer b is a valid command,
but does not set the current runlevel. The runlevel command displays the current
runlevel, and the one that was used directly before entering this one.
You have a new, empty hard drive that you will use for Linux. What is the first step
you use.
Choose one:
Answer: d
You must always first create a primary partition. Operating systems, including
Linux, can only be booted from a primary partition.
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.
d. Use the prerotate command to run a script to move the older logs to another
location.
Answer: d
You can use the prerotate command to run a script before logs are rotated. You
could have this script move the older logs to another location
If you type the command cat dog &> cat what would you see on your display?
Choose one:
Answer: d
When you use &> for redirection, it redirects both the standard output and standard
error. The output would be saved to the file cat.
and need to give everyone except root read only access to it. Which of the following
commands will accomplish this?
Choose one:
Answer: d
When using symbols, the equal sign explicitly sets permissions and revokes any
pre-existing permissions.
You want to know how much space is being occupied by your user’s home
directories. Which of the following will provide you with this information?
Choose one:
a. du -l /home
b. du -b /home
c. du -m /home
d. du -c /home
Answer: d
Using the -c option with the du command will show the grand total of used space for
the designated directory.
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.
Answer: d
This would run at 15 minutes after the hour on every Monday, Wednesday, and
Friday of every month no matter what the date.
You need to see the last fifteen lines of the files dog, cat and
The tail utility displays the end of a file. The -15 tells tail to
Answer: The SYS user owns the data dictionary. The SYS and SYSTEM
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
Answer: zcat
You suspect that you have two commands with the same name as the
command is not producing the expected results. What command can you
Answer: 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
Answer: whatis
The whatis command displays a summary line from the man page for the
specified command.
command fails. What option should you use in this command line to be
successful.
When you issue the command ls -l, the first character of the
resulting display represents the file’s ___________.
Answer: type
What utility can you use to show a dynamic listing of running processes?
Answer: top
dynamically updated.
Answer: tar
You can use the z modifier with tar to compress your archive at the
You wish to restore the file memo.ben which was backed up in the
This command uses the x switch to extract a file. Here the file
The t switch tells tar to display the contents and the f modifier
Answer: syslogd
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?
Answer: split
The split text filter will divide files into equally sized pieces. The
Answer: set -o vi
editor. However, once you log off and log back in you will return to
Answer: root
Whenever you install Linux, only one user account is created. This is
What command should you use to check the number of files and disk
Answer: repquota
quotas you have set including the amount of allocated space and amount
of used space.
In order to run fsck on the root partition, the root partition must
be mounted as ___________.
Answer: readonly
Answer: pwconv
The pwconv command creates the file /etc/shadow and changes all
forgot his password. What command should you use to reset his command?
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
Answer: no
The kmem group manages direct access to kernel memory and is necessary
What text filter can you use to display a multi-page file and place
numbers at the beginning of each line.
DirContents
Using the > will redirect the output of the ls /etc command to the
file DirContents.
What file defines the levels of messages written to system log files?
Answer: kernel.h
You have two files each ten lines long. What text filter could you
use to combine the two files so that each line of the output contains
Answer: join
The join text filter will display one line for each pair of input
You have two files in two different directories with the same
“,1] ); //–>
Answer: nl
The nl text filter will divide a file into logical pages and number each line.
priority is ___________?
Answer: nice
Both the top and nice utilities provide the capability to change the
format them. What command would you use to create the ext2 filesystem?
Answer: mke2fs
What command should you type to see all the files with an
/home/ben/memos directory.
Answer: ls -r /home/ben/memos/*.mem
file DirContents.
What file defines the levels of messages written to system log files?
Answer: kernel.h
You have two files each ten lines long. What text filter could you
use to combine the two files so that each line of the output contains
Answer: join
The join text filter will display one line for each pair of input
You have two files in two different directories with the same
/interview-questions/type.asp?iType\u003d83&offset\u003d20
“,0] ); D(["ma",[1,"
Hard links all have the same inode number, unlike symbolic links.
Answer: gpasswd -r
group. Use the -r option to remove the password from the group.