Linux Cheat Sheet for Mac and Windows Programmers

  • Revision slug: Linux_Cheat_Sheet_for_Mac_and_Windows_Programmers
  • Revision title: Linux Cheat Sheet for Mac and Windows Programmers
  • Revision id: 180415
  • Created:
  • Creator: Mgjbot
  • Is current revision? Yes
  • Comment robot Adding: [[ja:Linux Cheat Sheet for Mac and Windows Programmers]] <<langbot>>

Revision Content

{{ Outdated("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:

./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.
{{ languages( { "ja": "ja/Linux_Cheat_Sheet_for_Mac_and_Windows_Programmers" } ) }}

Revision Source

<p>{{ Outdated("It was last updated in 2002.") }}
</p><p>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.
</p><p>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 <a href="en/Linux_Build_Prerequisites">Linux_Build_Prerequisites</a>.
</p>
<h3 id="How_do_I_log_in_to_a_linux_box_from_another_machine.3F" name="How_do_I_log_in_to_a_linux_box_from_another_machine.3F"> How do I log in to a linux box from another machine? </h3>
<p>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).
</p><p>Of course, if the machine belongs to someone else, please check with the owner first before using it.
</p><p>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.
</p>
<h3 id="How_do_I_start_a_new_build.3F" name="How_do_I_start_a_new_build.3F"> How do I start a new build? </h3>
<p>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. <code>df -k</code> 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; <code>df -k /builds</code> 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.)
</p><p>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.
</p><p>Make a new directory where the build will live:
</p>
<pre>mkdir /builds/myname</pre>
<p>cd to that directory:
</p>
<pre>cd /builds/myname</pre>
<p>Set your cvsroot. This depends on your default shell. Try both if you're not sure, one of them will work. </p>
<pre>setenv CVSROOT :pserver:myname%netscape.com@cvs.mozilla.org:/cvsroot</pre>
<p>(csh/tcsh), or, if you're using sh/bash,
</p>
<pre>set CVSROOT=:pserver:myname%netscape.com@cvs.mozilla.org:/cvsroot; export CVSROOT</pre>
<p>Pull <code>client.mk</code>:
</p>
<pre>cvs co mozilla/client.mk</pre>
<p>Change into the mozilla directory:
</p>
<pre>cd mozilla</pre>
<p>Pull and build everything:
</p>
<pre>make -f client.mk</pre>
<p>Wait an hour or two ...
</p><p>Cd to where the binary lives:
</p>
<pre>cd dist/bin</pre>
<p>Run mozilla:
</p>
<pre>./mozilla</pre>
<h3 id="How_do_I_rebuild_part_of_the_tree.3F" name="How_do_I_rebuild_part_of_the_tree.3F"> How do I rebuild part of the tree? </h3>
<p>Change directory to the right place (e.g. cd layout/base/src), and type "make".
</p><p>If you want to update in that directory first, <code>cvs update</code> will do it.
</p><p>To rebuild a whole tree without pulling it, cd back to the mozilla level and type
</p>
<pre>make -f client.mk build</pre>
<p>To pull everything and rebuild, cd to the mozilla level and type
</p>
<pre>make -f client.mk</pre>
<h3 id="How_do_I_apply_a_patch.3F" name="How_do_I_apply_a_patch.3F"> How do I apply a patch? </h3>
<p>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 <a href="#How_do_I_read_something_off_a_floppy.3F">move it on a floppy</a>. 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.
</p><p>cd to the directory in the source tree where the patch was made.
</p>
<pre>patch &lt; /tmp/my.patch</pre>
<p>(or whatever you named the patch). If it's a patch spanning multiple directories, you might need:
</p>
<pre>setenv POSIXLY_CORRECT 1 ; patch -p0 &lt; mypatch.diffs</pre>
<h3 id="How_do_I_read_something_off_a_floppy.3F" name="How_do_I_read_something_off_a_floppy.3F"> How do I read something off a floppy? </h3>
<p>Good question. Some systems set up an automounted floppy, so you can insert the floppy then type:
</p>
<pre>mount /mnt/floppy</pre>
<p>or perhaps
</p>
<pre>mount /floppy</pre>
<p>If these give you an error, contact whoever administers the machine, and ask them to replace the fd0 line in <code>/etc/fstab</code> with something like:
</p>
<pre>/dev/fd0        /mnt/floppy        auto    noauto,owner    0 0</pre>
<h3 id="How_do_I_generate_a_patch.3F" name="How_do_I_generate_a_patch.3F"> How do I generate a patch? </h3>
<p>In a directory at or above the level where the changed files live, run cvs diff:
</p>
<pre>cvs diff -u [list of changed files]</pre>
<p>You can add a -N to the diff arguments if you want it to include new files in the patch as well.
</p>
<h3 id="How_do_I_debug.3F" name="How_do_I_debug.3F"> How do I debug? </h3>
<p>That's a whole separate topic. See the <a href="en/Debugging_on_Linux">Debugging FAQ</a> for more details.
</p>
<h3 id="How_do_I_find_out_how_to_do_other_things.3F" name="How_do_I_find_out_how_to_do_other_things.3F"> How do I find out how to do other things? </h3>
<p>The mozilla-unix alias (see the <a class="external" href="http://www.mozilla.org/community/developer-forums.html">community page</a> 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.
</p>
<div class="originaldocinfo">
<h2 id="Original_Document_Information" name="Original_Document_Information"> Original Document Information </h2>
<ul><li> Last Updated Date: August 15, 2002
</li><li> Copyright Information: Portions of this content are © 1998–2007 by individual mozilla.org contributors; content available under a Creative Commons license | <a class="external" href="http://www.mozilla.org/foundation/licensing/website-content.html">Details</a>.
</li></ul>
</div>
<div class="noinclude">
</div>
{{ languages( { "ja": "ja/Linux_Cheat_Sheet_for_Mac_and_Windows_Programmers" } ) }}
Revert to this revision