We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

Linux Cheat Sheet for Mac and Windows Programmers

Warning: The content of this article may be out of date. It was last updated in 2002.

This page is intended for programmers who are relatively new to Unix, who have access to a Linux machine and want to get going quickly doing mozilla builds or applying or generating patches.

If you want more information on the linux mozilla build system, or are setting up your own linux build machine, be sure to read the official Linux_Build_Prerequisites.

How do I log in to a linux box from another machine?

Use telnet on your preferred platform to log in to a remote linux (or other Unix) machine. You'll have to provide the machine's hostname (if it uses dhcp instead of a static IP, this will be something byzantine and different every time the machine is rebooted).

Of course, if the machine belongs to someone else, please check with the owner first before using it.

Once you're in, you can use "cd" (change directory; chdir also works, if you want to type more) to go to wherever the build tree is.

How do I start a new build?

First, decide where the build will go. Make sure first that there's enough space. A fully built debug tree currently takes about 1.6Gb. df -k will show you the disk space available on all filesystems mounted on the machine. Many Linux Mozilla developers here set up a /builds directory to put build trees; df -k /builds will tell you whether that exists and how much spaces is there. (The -k prints the result in kilobytes rather than disk blocks; on some systems, these are the same.)

When you log in, you're initially in your home directory. In machines inside large companies (for example, Netscape does this), this may be NFS mounted from a remote server (to find out, say "df ." and see if there's a hostname: in the "Filesystem" column). If your home directory is NFS mounted, you probably don't want to build there; but the build will go a lot faster if you build on a local disk.

Make a new directory where the build will live:

mkdir /builds/myname

cd to that directory:

cd /builds/myname

Set your cvsroot. This depends on your default shell. Try both if you're not sure, one of them will work.

setenv CVSROOT :pserver:myname%netscape.com@cvs.mozilla.org:/cvsroot

(csh/tcsh), or, if you're using sh/bash,

set CVSROOT=:pserver:myname%netscape.com@cvs.mozilla.org:/cvsroot; export CVSROOT

Pull client.mk:

cvs co mozilla/client.mk

Change into the mozilla directory:

cd mozilla

Pull and build everything:

make -f client.mk

Wait an hour or two ...

Cd to where the binary lives:

cd dist/bin

Run mozilla:


How do I rebuild part of the tree?

Change directory to the right place (e.g. cd layout/base/src), and type "make".

If you want to update in that directory first, cvs update will do it.

To rebuild a whole tree without pulling it, cd back to the mozilla level and type

make -f client.mk build

To pull everything and rebuild, cd to the mozilla level and type

make -f client.mk

How do I apply a patch?

Save the patch somewhere where the machine can get to it. You can use mozilla or 4.x to read mail and save it that way, ftp it from somewhere using command-line ftp or a gui client, or move it on a floppy. I recommend saving it in /tmp, e.g. /tmp/my.diff or my.patch (the extension doesn't matter, use something you'll remember). It's okay if it has mail headers and stuff before the meat of the patch.

cd to the directory in the source tree where the patch was made.

patch < /tmp/my.patch

(or whatever you named the patch). If it's a patch spanning multiple directories, you might need:

setenv POSIXLY_CORRECT 1 ; patch -p0 < mypatch.diffs

How do I read something off a floppy?

Good question. Some systems set up an automounted floppy, so you can insert the floppy then type:

mount /mnt/floppy

or perhaps

mount /floppy

If these give you an error, contact whoever administers the machine, and ask them to replace the fd0 line in /etc/fstab with something like:

/dev/fd0        /mnt/floppy        auto    noauto,owner    0 0

How do I generate a patch?

In a directory at or above the level where the changed files live, run cvs diff:

cvs diff -u [list of changed files]

You can add a -N to the diff arguments if you want it to include new files in the patch as well.

How do I debug?

That's a whole separate topic. See the Debugging FAQ for more details.

How do I find out how to do other things?

The mozilla-unix alias (see the community page to find out how to subscribe or how to read it as a newsgroup) for is a good place to ask questions on the linux build, or you can often find Xheads hanging out on the irc.mozilla.org channel #mozilla.

Original Document Information

  • Last Updated Date: August 15, 2002
  • Copyright Information: Portions of this content are © 1998–2007 by individual mozilla.org contributors; content available under a Creative Commons license | Details.

Document Tags and Contributors

Contributors to this page: SphinxKnight, teoli, Mgjbot, kohei.yoshino
Last updated by: SphinxKnight,