University Crest

[wlug] Re: Linux guru test

wlug archive index About the wlug list Mailing lists home
To The University of Waikato HomepageWaikato Home > Waikato Mailing Lists > wlug Info > wlug archives
Oliver Jones oliver@d...
Fri Apr 8 18:47:36 NZST 2005

Since no one else seems to have bothered with this I thought I'd post my
answers.  Of course this is just a shameless attempt to show off how fat
my head is... ;)

> Google, manpages and any other reference source is encouraged.
> * Why has the writing been worn off my tab key?  what am I using it for?

Tab completion & code indentation.

> * What's a netmask?  What is the netmask for a /23?  What happens if you 
> have the wrong netmask?

A netmask defines your IP subnet.  Ie, what computers your computer will
broardcast IP packets to (and expect answers from without routing
packets via a router).  A CIDR style netmask of /23 will give you subnet
that extends from to with a broadcast address
of  There are 510 hosts in this network.

(Yeah for ipcalc). ;)

> * A service has died, you've fixed it and need to restart it, how would 
> you go about doing so?

On RedHat "service <insert service_name> restart".  Or if you were
paranoid: "service <insert service_name> stop; service <insert service
name> stop".  I'm not sure if Debian has the service command so I might
instead do this:  

cd /etc/rc.d/init.d && ./service_name restart

> * What does it mean if my computer boots up and says "L" then stops? 
> What's wrong? How would you fix it?

A) It means you're till using lilo.  B) It means lilo failed to
correctly find your kernel and start it.  Probably because your Master
Boot Record is corrupt.  I take it that L is more fatal the LI which is
what I've seen the most of.  I imagine each character signifies a
completed stage of the LILO boot process?

> * Can you compile your own kernel?  Does anyone really know what MTRR 
> is?  does anyone care?

Yes, though I have not done so in years.  MTRR is the Memory Type Range
Register.  It controls how your x86 box lays out memory for processes.
I've never really had to worry about it.  I specifically remember it
being more important when I had an SMP machine.   (Had to Google for the
Acronym dfinition).

> * What is ldconfig, and when would you use it?  what happens if you 
> forget to run it?

ldconfig generally gets run automatically by your package manager when
you update or install a shared library.  If you install a lib from
source you might have to run it manually.  ldconfig keeps up
to date with the locations of all your shared libraries (as controlled
by  If you don't run it your may find that ld and ld-linux
can't find shared libraries when linking at compile type or dynamically
at runtime.

> * lost+found directories are scattered around the filesystem, what is 
> their purpose?  Can they just be removed?  Are there any side effects to 
> doing so?

When running fsck on a filesystem and it finds orphan directory entries
of inodes it will create files in lost+found that contain these orphaned
files.  It has been a long long time since I ever had that problem.
Journaling file systems seem to not suffer from this problem.

> * emacs or vi?

Emacs.  But I'm using vi more often these days when editing config

> * What process has pid 1, why is this process important?  Where would 
> you configure this process?  What happens if this process goes away?

init has pid 1 because it is the first process to be spawned by the
kernel.  It is the parent of all other processes.  MostLinux  systems
run SysVinit which configured via /etc/inittab.  If it was to die?  The
kernel would probably halt or reboot the system.

> * Do you know what these tools are used for?
> ** apropos

Searching man pages.

> ** awk

Processing text with awk scripts (because you're crazy and don't know

> ** cvs

Concurrent Versions System.  Source code control system.

> ** dmesg

Prints the kernel's message ring buffer to screen.

> ** find

Find files using a variety of tests/criteia.

> ** fsck

File system check.  Checks your file systems for integrity. 

> ** grep

Search text files for substrings using regular expressions.

> ** locate

Query the locate database which contains all files and directories on
your system.  This command is only useful if the updatedb command has
been run to completion.  This usually occurs every night at about 4am
via cron.

> ** screen

A command that allows you to have multiple "screens" attached to a
single tty.  You can think of it as a tabbed console app for text
terms. ;)  Also allows you to detach from a tty & logout and have your
interactive processes remain running. 

> ** sed

The venerable stream editor.  Allows you to edit streams of text using
regular expressions.

> ** ssh

Secure Shell.  A much safer encrypted alternative to telnet.  Also
encrypted provides TCP/IP tunneling features.

> ** strace

Stack trace.  A program that will print the call stack of a process as
it runs.

> ** sudo

Super User Do.  Allows you to delegate authority to run processes that
require root access in a controlled fashion.  Trendy distros like ubunto
and MacOS X favour sudo over a separate root account.

> ** svn

Subversion.  A better alternative to cvs.  Does the same job only with
more tricks.  Supports file metadata (file modes, sym links) much better
(ie, at all) than cvs.  Also allows for much nicer management of
directories.   Many other cool features.  Use it, not cvs, you wont
regret it.  :) 

> ** umount

Umounts devices.

> ** watch

A command that allows you to repeatedly execute a command at specific
intervals and watch the output.  It redraws the screen so it doesn't

> ** wall

Write to all.  Allows you to write messages to all connected ttys.
Useful if you want to broadcast that the system will be going
down/rebooting in X minutes etc.

> ** wget

Web get.  Venerable console util for downloading files from the web or
ftp sites.  Also allows you to mirror websites.

> * do you know how to use /sbin/fdisk?  do you use cfdisk anyway?

Yes.  When partitioning disks fdisk is a handy tool.  Only other disk
partioner I've used is sfdisk.  Mainly because you can pipe the output
of sfdisk into the input of sfdisk and have it mirror the partition
table to another disk.  Very handy for setting up RAID arrays.

> * How do killall and killall5 differ?  Have you ever got them confused? 
>   Is this bad?  Were you fired?

Killall kills all processes with a particular name.  Killall5 does the
same but will not kill the processes in its own session.  Very useful
for shutdown scripts.

> * Do you run screaming at the word PCMCIA?  How would you configure a 
> PCMCIA wireless card?  a PCMCIA GPS?  a PCMCIA flux capacitor?

I've not done this in a long time so I can't remember exactly how you go
about it.  But if it wasn't detected by kudzu (or similar tool) and
configured for me I'd probably be able to wade my way through
the /etc/pcmcia config files to get it working (if there was driver

> * Running most programs elicits the error "Read only filesystem", what 
> may have caused this?  How would you resolve it?

You're trying to run stuff from a CDROM or a readonly mounted
filesystem.  You should probably add the noatime option to the fs mount
options so that it doesn't attempt to update the access time of each
file it executes/reads.

> * how would you tell if a machine is running debian, redhat, gentoo, or 
> windows xp?

If I couldn't look at the screen?  nmap could guess the OS between
Windows and Linux.  To remotely tell Linux's apart?  That I've never had
to attempt.  If they were running telnet daemons I could have a look at
the issue file that might be displayed.  But no one (or at least very
few) is stupid enough to run an exposed telnet so if I was logged in I
could check the /etc/issue file.   If Apache was configured to emit the
Stock status line for most distros I could look at that to guess the OS
remotely too.

> * what would you do to get a program run on stup?

If it has a init script in /etc/rc.d/init.d then I would use chkconfig
to add the script to the right run level.  If it didn't have an init
script I'd have to write one first.

> * What kind of files would you expect to find in /usr/share/zoneinfo, 
> are these files important?  what would happen if they were removed?

They provide time zone information to glibc.  If they were removed then
the only timezone I could run in successfully would probably be gmt/utc.

> * I'm installing a package the depends on portmap, what is it that I'm 
> likely to be installing?  is portmap important?  how would I diagnose 
> issues with portmap?

You installing a package that uses SUN RPC.  Portmap is the SUN RPC port
mapper.  It provides a common well known service for SUN RPC processes
to contact to request the port of the daemon process the RPC client is
trying to contact.  Diagnosing problems with portmap I've never had to
do.  I imagine there are some utilities I can run to inspect process
data.  Usually you don't have to do anything to get portmap or NFS to
work other than ensuring the right processes are enabled and the ports
arn't filewalled off.

> * How do I determine what ports are open on my machine?  How can I tell 
> what ports to close?  Name at least two ways to "close" ports from the 
> Internet.

netstat -l.  You can close ports of processes you are not using by
shutting down the process in question and configuring it not to start
again at system startup and you can also firewall the ports with

> * How do I list all the hidden files in a directory?

ls -la will list all files in a directory (in long form).  If you just
want the "dot" files then ls -ld .* will just list all the "hidden"

> * What does "#!/bin/sh" mean, why is it important?

#! is used by the kernel as the "magic number" for shell processes. The
kernel reads the rest of the first line of the file and uses it as the
executable to run and give the executable the named of the file as its
first argument (after any arguments on the #! line of the shell script).

> * If I had permissions "rwxr-xr-x  perry fooers" who could do what? 
> What type of file is this likely to be?  What about if the permissions 
> are 550?

The file is probably an executable or directory and everyone can run it
or change directory into it.  User perry could also read and write to
the file/directory, everyone else can only read or execute/change
directory on it.

> * Whats the difference between bash and xterm?

Bash is a shell, xterm is a process that provides an X11 hosted tty to
which a process like bash can attach its input/output to.

> * How do I determine if swap is enabled?  How would I disable it?

The command free will tell you how much swap you have.  You can turn
swap off with swapoff -a.

> * How many primary partitions can you have on a normal x86 box?  How 
> would you get around this?

4.  You can create an extended partition which will enable you to create
more "logical" partitions within it.  I forget how many logicals you
have.  I've never been in a position to run out of them though.

> * I have a /boot partition, how big should this be?  Is there anything 
> special about how this partition is layed out on disk?

It should be big enough to hold as many kernels as you think a rational
to have installed on your PC.  I've rarely filled up a 128MB boot
partition.  It is generally considered to be good practice to make
the /boot partition the first partition on the drive.  This helps ensure
buggy BIOSes can read files on it.  It should also be a ext2 file system
because GRUB & LILO don't generally support fancier file system types.

> * fsck says "Deleted inode has zero dtime" what has happened to my disk? 
>   am I going to have to reinstall?

Your filesystem has some slight corruption.  A deleted file/inode never
had its deletion time set.  The file was probably still open (yet had
been unlinked) when your system shutdown.  Fsck can repair this easily
and no you shouldn't have to reinstall.

> * I've forgotten my root password, what can I do about this?

You do have a boot/rescue disk yes?  You can use it to boot up the
machine and edit /etc/shadow to replace the password with either nothing
or another password hash (say from a user you know the password of).  Or
if your distro doesn't prompt for the root password when you boot into
single user mode you can add the argument "single" to your lilo/grub
boot manager.  If it does ask for the root password you can over ride
this by specifying an alternative init to the kernel with the
init=/bin/sh argument.  Once you are in you just use passwd to reset the

> * depmod complains about unresolved symbols?  How would you resolve this 
> issue?

Either you have old binary kernel modules in your /lib/modules/ tree for
the running kernel or your kenerl lacks a static feature that a kernel
module requires.

> * what is important about "."'s at the beginning of a filename?  What 
> sort of files would be named like this?

It hides files from ls by default.  It is the naming convention used by
Unix operating systems to signify that the file is "hidden".  There is
nothing special about this other than it is a convention.  They are
generally called "dot files".  They usually contain configuration data.

> * I have a file with a charactor I can't type in it, how would I delete 
> it from the cli?

You mean a filename with something strange in it.  Just use a wildcard.  Eg:

rm  ./start*end  

Or if it is a single character use:

rm ./start?end

> * Linux boots and then says it can't start my X server, what does this 
> mean?  how would I fix this?

Probably you have a misconfigured video driver, or your mouse is not
plugged in or your font server is turned off.   Configure, plug in or
start as necessary.

> * I want to have a program run every day at 3am, how would I do this?

As root?  Put a link or script that runs your program
in /etc/cron.daily.  If the time that those are run is not 3am then use
the command crontab -e to edit your crontab file.  Read the crontab man
page (man 5 crontab) for the file format.

> * What are the best ways of determining what hardware is in my machine?

lspci, hwbrowser, lsusb.

> * Have you written any wiki pages?


> * ls segfaults when run, how can I tell what files are in the current 
> directory without using X?

for i in *;do echo $i; done

> * What is a window manager?  What happens if I don't have one?

A window manager manages windows in an X11 session.  Ie, it allows you
to move, resize, minimise, restore windows.  If you don't have one the X
server will put windows where ever it likes an you can't do sqwat about

> * What's this lpd thing running?  Why would I want it?  Where is it's 
> configuration usually stored?  How would I submit files to it?

It is the line printer daemon.  It manages printer cues.  You should
really install cups. ;)  lpd speaks the LPD protocol and you can print a
file with lpr.  eg, cat /etc/passwd | lpr.  You can view the queue with
lpq and remove files with lprm.  The config is probably
in /etc/printtab.  But like I said you should be running cups. ;)

> * Every time I type an "s" in X I get a "z" on the screen, whats wrong? 
> how would I fix this?

Your keyboard map is wrong.  Use system-config-keyboard (on RedHat) to
select the correct keyboard language.  Or you can use loadkeys and
kbd_mode to correct the keyboard maping.  Or in X you can use xmodmap
too alter the keyboard mappings.

> * X needs a driver on a CD I have to run, how would I get that driver 
> onto the machine?

mkdir -p /mnt/cdrom && mount -t iso9660 /dev/cdrom /mnt/cdrom &&
cp /mnt/cdrom/file ~/ && umount /mnt/cdrom

> * How do I list all the rpm's installed on a machine?  How do I list all 
> the .debs installed on a machine?

rpm -qa |sort |less

Dunno.  Don't run debian... ;)  Probably something to do with dpkg.

> * click to focus? sloppy focus? or focus follows the mouse?  Discuss.

Used to use sloppy focus.  Have gotten used to click to focus now in Gnome.

> * I have a .tar.gz file that contains the source to a program I want to 
> install, how would I compile and install it?

tar zxfv file.tar.gz && cd dir && ./configure && make && make install

> * The above program fails while installing saying "checking for 
> zlib.h... failed" what do I do now?

yum install zlib-devel || apt-get install zlib-devel

> * Should I install it in ~, /usr, /var/tmp, /opt, "/Program 
> files/Perry's cool program" or /usr/local, discuss.

/usr/local (if you're root), some sub directory of ~ if not.

> * I have a daemon that isn't working, what would the first thing I do be?

Ensure it is running.

> * I have a program running on port 23/tcp open, is this a problem?

Running telnet is a problem yes. :)  Unless you don't care about packet

> * what's /dev/ttyS0 likely to be?  I sent "AT\n" to it, and it said 
> something back that made me happy, what did it say?

A modem.  It should say OK back and you would be happy.

> * How would I set up IP masquerading?

Depends on the kernel and whether you used ipchains or iptables (for 2.4
and 2.6 kernels).  With 2.6 and iptables you might do this:

iptables        -A FORWARD     -i $INTERNAL_IF  -j ACCEPT
iptables        -A FORWARD     -i $EXTERNAL_IF  -j ACCEPT

You would also have to enable ip packet forwarding with: 

sysctl -w net.ipv4.ip_forward=1

> * what's /etc/issue used for?  why is it different to /etc/motd?  Can I 
> arbitarily edit either file?

The issue file is displayed by telnetd and getty's to identify hosts
when you connect.  The motd file (message of the day) is displayed after
you login before your shell prompt appears.  You can edit motd as much
as you like.  /etc/issue might be over written when you boot up.

> * eth0 has an IP address of, name two problems with this 
> address being used on eth0.

It appears to be a board cast address.  It is also on the
network which is designed for use as loopback and will be dropped by
routers and not understood correctly by machines on your subnet.

> * Explain the difference between an oops and a panic.

An kernel opps is when the kernel generates a page fault that wasn't
expected but can be recovered from.  A panic is generally a kernel bug
in the kernel interrupt handlers/scheduler that can not be recovered
from.  A panic halts the machine.  And opps does not.

> * I have an internal network, what IP address(es) can I use for my 
> machines?  what addresses shouldn't I use?

Use a subnet in, or

You should not use pretty much anything else.

> * I use ihug for dialup internet, how would I set this up?

Use whatever your distro uses to support PPP dialup.  If this requires
special "ihug" stuff I don't know what it is.  With RedHat/Fedora I
would configure a PPP modem link with system-config-network.

> * Whenever I try and use the internet it says "Unknown host", I can ping 
> machines by IP address, whats probably wrong?  what config file(s) would 
> I check?  How would I fix this?

Your DNS resolver is not configured.  Check /etc/resolv.conf has the
correct nameserver lines for your uplink.

> * I have no default route, how do I add a new one without rebooting?  If 
> I know my IP and netmask, at a guess what should I set the default 
> gateway to?

If you're on a 192.168.0/24 subnet then, as root: route add default gw

> * What is 0x20 in decimal? binary? octal? does anyone care?

32 dec, 40 octal, 100000 binary.  No. ;)

> * /proc/interrupts is showing a lot of interrupts on IRQ 0, is this 
> something I should be worried about?

IRQ 0 is the system timer and no you should not be worried.

> * inetd is a cool program, what does it do?  What happens if it's not 
> running?

inetd is a "super daemon" it manages other daemons like telnet, rlogin,
pop3d, imapd etc.  Most distros now use xinetd which is more secure and
much easier to configure.  If it isn't running then you wont be able to
access any services it manages.

> * I'm at an Installfest, and I have a problem I can't solve, what should 
> I do?

Google. ;)  Ask someone else for help.

> * What's NAT?  Why is it evil?

Network address translation.  It isn't that evil.  Though it does make
it hard for outside machines to contact machines in your local lan if
the protocol (particularly udp protocols) hasn't been written very well.

> * I installed a new kernel and now my computer panics during boot, what 
> should I do?

Tell LILO/GRUB to use your old kernel. You did leave your old kernel in
place didn't you?!

> * If you had a computer that had all the problems outlined above, would 
> you switch to macos?

No.  But I'd buy a Mac Mini for my iPod. ;)

> If you want to discuss your answers to questions please reply to me *OFF 
> LIST* so that other people have a chance to think about them without the 
> answers being given away.

Do I get a prize?

                   Oliver Jones » Roving Code Warrior

   oliver@d... » +64 (21) 41 2238 » 

More information about the wlug mailing list
NOTICE: This is an archive of a public mailing list. The University of Waikato is not responsible for its contents.

The University of Waikato - Te Whare Wananga o Waikato