440 lines
15 KiB
HTML
440 lines
15 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
|
|
<TITLE> From DOS/Windows to Linux HOWTO : The Remaining 1%</TITLE>
|
|
<LINK HREF="DOS-Win-to-Linux-HOWTO-12.html" REL=next>
|
|
<LINK HREF="DOS-Win-to-Linux-HOWTO-10.html" REL=previous>
|
|
<LINK HREF="DOS-Win-to-Linux-HOWTO.html#toc11" REL=contents>
|
|
</HEAD>
|
|
<BODY>
|
|
<A HREF="DOS-Win-to-Linux-HOWTO-12.html">Next</A>
|
|
<A HREF="DOS-Win-to-Linux-HOWTO-10.html">Previous</A>
|
|
<A HREF="DOS-Win-to-Linux-HOWTO.html#toc11">Contents</A>
|
|
<HR>
|
|
<H2><A NAME="s11">11. The Remaining 1%</A></H2>
|
|
|
|
<P>
|
|
<P>Much more than 1%, actually...
|
|
<P>
|
|
<P>
|
|
<H2><A NAME="ss11.1">11.1 Running DOS/Windows Apps</A>
|
|
</H2>
|
|
|
|
<P>
|
|
<P>Yes, you can to some extent run DOS and Windows applications under Linux!
|
|
There are two emulators that are quite good: Dosemu (
|
|
<A HREF="http://www.dosemu.org">http://www.dosemu.org</A>) and Wine (
|
|
<A HREF="http://www.winehq.com">http://www.winehq.com</A>).
|
|
The latter is getting better release after release, and the list of runnable
|
|
applications is getting larger. It even runs Word and Excel!
|
|
<P>
|
|
<P>
|
|
<H2><A NAME="ss11.2">11.2 Using tar and gzip</A>
|
|
</H2>
|
|
|
|
<P>
|
|
<P>Under UNIX there are some widely used applications to archive and compress
|
|
files. <CODE>tar</CODE> is used to make archives---it's like <CODE>PKZIP</CODE> or
|
|
<CODE>Winzip</CODE>but it doesn't compress, it only archives. To make a new
|
|
archive:
|
|
<P>
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
$ tar cvf <archive_name.tar> <file> [file...]
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
<P>To extract files from an archive:
|
|
<P>
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
$ tar xvf <archive_name.tar> [file...]
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
<P>To list the contents of an archive:
|
|
<P>
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
$ tar tf <archive_name.tar> | less
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
<P>You can compress files using <CODE>compress</CODE>, which is obsolete and
|
|
shouldn't be used any more, or <CODE>gzip</CODE>:
|
|
<P>
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
$ compress <file>
|
|
$ gzip <file>
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
<P>that creates a compressed file with extension <CODE>.Z</CODE>
|
|
(<CODE>compress</CODE>) or <CODE>.gz</CODE> (<CODE>gzip</CODE>). These programs can
|
|
compress only one file at a time. To decompress:
|
|
<P>
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
$ compress -d <file.Z>
|
|
$ gzip -d <file.gz>
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
<P>RMP.
|
|
<P>There are also the <CODE>unarj</CODE>, <CODE>zip</CODE> and <CODE>unzip</CODE> (PK??ZIP
|
|
compatible) utilities. Files with extension <CODE>.tar.gz</CODE> or
|
|
<CODE>.tgz</CODE> (archived with <CODE>tar</CODE>, then compressed with
|
|
<CODE>gzip</CODE>) are as common in the UNIX world as .ZIP files are under DOS.
|
|
Here's how to list the contents of a <CODE> .tar.gz</CODE> archive:
|
|
<P>
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
$ tar ztf <file.tar.gz> | less
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
<P>
|
|
<P>
|
|
<H2><A NAME="Install"></A> <A NAME="ss11.3">11.3 Installing Applications </A>
|
|
</H2>
|
|
|
|
<P>
|
|
<P>First of all: installing packages is root's work. Most Linux applications
|
|
are distributed as a <CODE>.tar.gz</CODE> archive, which typically will contain
|
|
a directory aptly named containing files and/or subdirectories. A good rule
|
|
is to install these packages from <CODE>/usr/local</CODE> with the command
|
|
<P>
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
# tar zxf <archive.tar.gz>
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
<P>reading then the README or INSTALL file. In most cases, the application is
|
|
distributed in source, which you'll have to compile; often, typing
|
|
<CODE>make</CODE> then <CODE>make install</CODE> will suffice. If the archive
|
|
contains a <CODE>configure</CODE> script, run it first. Obviously, you'll need
|
|
the <CODE>gcc</CODE> or <CODE>g++</CODE> compiler.
|
|
<P>Other archives have to be unpacked from /; this is the case
|
|
with Slackware's <CODE>.tgz</CODE> archives. Other archives contain the files
|
|
but not a subdirectory - careful not to mess things up! Always list the
|
|
contents of the archive before installing it.
|
|
<P>Debian and Red Hat have their own archive format; respectively,
|
|
<CODE>.deb</CODE> and <CODE>.rpm</CODE>. The latter is widely used by many
|
|
distributions; to install an <CODE>rpm</CODE> package, type
|
|
<P>
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
# rpm -i package.rpm
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
<P>
|
|
<P>
|
|
<H2><A NAME="ss11.4">11.4 Tips You Can't Do Without</A>
|
|
</H2>
|
|
|
|
<P>
|
|
<P><B>Backscrolling</B>: pressing <SHIFT + PAG UP> (the grey key)
|
|
allows you to backscroll a few pages, depending on how much video memory you
|
|
have.
|
|
<P><B>Resetting the screen</B>: if you happen to <CODE>more</CODE> or
|
|
<CODE>cat</CODE> a binary file, your screen may end up full of garbage. To fix
|
|
it, blind type <CODE>reset</CODE> or this sequence of characters: <CODE>echo
|
|
CTRL-V ESC c RETURN</CODE>.
|
|
<P><B>Pasting text</B>: in console, see below; in X, click and drag to select
|
|
the text in an <CODE>xterm</CODE> window, then click the middle button (or the
|
|
two buttons together if you have a two-button mouse) to paste. There is also
|
|
<CODE>xclipboard</CODE> (alas, only for text); don't get confused by its very
|
|
slow response.
|
|
<P><B>Using the mouse</B>: if you installed <CODE>gpm</CODE>, a mouse driver for
|
|
the console, you can click and drag to select text, then right click to
|
|
paste the selected text. It works across different VCs.
|
|
<P><B>Messages from the kernel</B>: have a look at <CODE>/var/adm/messages</CODE>
|
|
or <CODE>/var/log/messages</CODE> as root to see what the kernel has to tell
|
|
you, including bootup messages. The command <CODE>dmesg</CODE> is also handy.
|
|
<P>
|
|
<P>
|
|
<H2><A NAME="Programs"></A> <A NAME="ss11.5">11.5 Where to Find Applications </A>
|
|
</H2>
|
|
|
|
<P>
|
|
<P>If you're wondering whether you can replace your old and trusted DOS/Win
|
|
application with a Linux one, I suggest that you browse the main Linux
|
|
software repository:
|
|
<A HREF="ftp://metalab.unc.edu/pub/Linux">ftp://metalab.unc.edu/pub/Linux</A>. Other good
|
|
starting places are the ``Linux Applications and Utilities Page''
|
|
<A HREF="http://www.xnet.com/~blatura/linapps.shtml">http://www.xnet.com/~blatura/linapps.shtml</A>, the ``official'' Linux
|
|
page
|
|
<A HREF="http://www.linux.org">http://www.linux.org</A>, and
|
|
<A HREF="http://freshmeat.net">http://freshmeat.net</A>.
|
|
<P>
|
|
<P>
|
|
<H2><A NAME="ss11.6">11.6 A Few Things You Couldn't Do</A>
|
|
</H2>
|
|
|
|
<P>
|
|
<P>Linux can do an awful lot of things that were cumbersome, difficult or
|
|
impossible do to with DOS/Windows. Here's a short list that may whet your
|
|
appetite:
|
|
<P>
|
|
<UL>
|
|
<LI> <CODE>at</CODE> allows you to run programs at a specified time;
|
|
</LI>
|
|
<LI> <CODE>awk</CODE> is a simple yet powerful language to manipulate data
|
|
files (and not only). For example, being <CODE>data.dat</CODE> your multi field
|
|
data file,
|
|
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
$ awk '$2 ~ "abc" {print $1, "\t", $4}' data.dat
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
|
|
|
|
prints out fields 1 and 4 of every line in <CODE>data.dat</CODE> whose second
|
|
field contains ``abc''.
|
|
</LI>
|
|
<LI> <CODE>cron</CODE> is useful to perform tasks periodically, at specified
|
|
date and time. Type <CODE>man 5 crontab</CODE>.
|
|
</LI>
|
|
<LI> <CODE>file <filename></CODE> tells you what <CODE>filename</CODE> is
|
|
(ASCII text, executable, archive, etc.);
|
|
</LI>
|
|
<LI> <CODE>find</CODE> (see also Section
|
|
<A HREF="DOS-Win-to-Linux-HOWTO-5.html#Directories: Trans">Directories: Translating Commands</A>) is one of the most powerful and
|
|
useful commands. It's used to find files that match several characteristics
|
|
and perform actions on them. General use of <CODE>find</CODE> is:
|
|
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
$ find <directory> <expression>
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
|
|
|
|
where <expression> includes search criteria and actions. Examples:
|
|
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
$ find . -type l -exec ls -l {} \;
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
|
|
|
|
finds all the files that are symbolic links and shows what they point to.
|
|
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
$ find / -name "*.old" -ok rm {} \;
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
|
|
|
|
finds all the files matching the pattern and deletes them, asking for your
|
|
permission first.
|
|
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
$ find . -perm +111
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
|
|
|
|
finds all the files whose permissions match 111 (executable).
|
|
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
$ find . -user root
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
|
|
|
|
finds all the files that belong to root. Lots of possibilities here---RMP.
|
|
</LI>
|
|
<LI> <CODE>grep</CODE> finds text patterns in files. For example,
|
|
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
$ grep -l "geology" *.tex
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
|
|
|
|
lists the files *.tex that contain the word ``geology''. The variant
|
|
<CODE>zgrep</CODE> works on gzipped files. RMP;
|
|
</LI>
|
|
<LI> <B>regular expressions</B> are a complex but darn powerful way of
|
|
performing search operations on text. For example,
|
|
<CODE>^a[^a-m]X{4,}txt$</CODE> matches a line that starts with `a', followed by
|
|
any character except those in the interval a-m, followed by 4 or more `X',
|
|
and ends in `txt'. You use regular expressions with advanced editors,
|
|
<CODE>less</CODE>, and many other applications. <CODE>man grep</CODE> for an
|
|
introduction.
|
|
</LI>
|
|
<LI> <CODE>script <script_file></CODE> dumps the screen contents on
|
|
<CODE>script_file</CODE> until you issue the command <CODE>exit</CODE>. Useful for
|
|
debugging;
|
|
</LI>
|
|
<LI> <CODE>sudo</CODE> allows users to perform some of root's tasks (e.g.
|
|
formatting and mounting disks; RMP);
|
|
</LI>
|
|
<LI> <CODE>uname -a</CODE> gives you info about your system;
|
|
</LI>
|
|
<LI> <CODE>zcat</CODE> and <CODE>zless</CODE> are useful for browsing and piping
|
|
gzipped files without decompressing them. For example:
|
|
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
$ zless textfile.gz
|
|
$ zcat textfile.gz | lpr
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
|
|
</LI>
|
|
<LI> The following commands often come in handy: <CODE>bc, cal, chsh, cmp,
|
|
cut, fmt, head, hexdump, nl, passwd, printf, sort, split, strings, tac,
|
|
tail, tee, touch, uniq, w, wall, wc, whereis, write, xargs, znew.</CODE> RMP.
|
|
</LI>
|
|
</UL>
|
|
<P>
|
|
<P>
|
|
<H2><A NAME="ss11.7">11.7 Practicing UNIX under DOS/Win</A>
|
|
</H2>
|
|
|
|
<P>
|
|
<P>Believe it or not, there are fine tools that provide a UNIX-like environment
|
|
under DOS/Windows! One is the Djgpp suite (
|
|
<A HREF="http://www.delorie.com/djgpp/">http://www.delorie.com/djgpp/</A>) for DOS, while Cygwin (
|
|
<A HREF="http://www.cygnus.com/cygwin">http://www.cygnus.com/cygwin</A>) is a more complex port for Win32. Both
|
|
include the same GNU development tools and utilities as Linux; you won't get
|
|
the same stability and performance, though.
|
|
<P>If you'd like to have a taste of Linux, try out Djgpp. Download and install
|
|
the following files (as of this writing, the latest version is 2.02):
|
|
<CODE>djdev202.zip, bnu281b.zip, bsh1147b.zip, fil316b.zip, find41b.zip,
|
|
grep22b.zip, gwk303b.zip, lss332b.zip, shl112b.zip.</CODE>. Installation
|
|
instructions are provided, and you can find assistance on
|
|
<A HREF="news:comp.os.msdos.djgpp">news:comp.os.msdos.djgpp</A>.
|
|
<P>In particular, using <CODE>bash</CODE> under DOS/Win is a whiff of fresh air. To
|
|
configure it properly, edit the supplied file <CODE>BOOT.BAT</CODE> to reflect
|
|
your installation, then put these files in your home directory (in the
|
|
Windows partition) instead of those provided:
|
|
<P>
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
# this is _bashrc
|
|
|
|
LS_OPTIONS="-F -s --color=yes"
|
|
alias cp='cp -i'
|
|
alias d='ls -l'
|
|
alias l=less
|
|
alias ls="ls $LS_OPTIONS"
|
|
alias mv='mv -i'
|
|
alias rm='rm -i'
|
|
alias u='cd ..'
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
<P>
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
# this is _bprof
|
|
if [ -f ~/_bashrc ]; then
|
|
. ~/_bashrc
|
|
fi
|
|
PS1='\w\$ '
|
|
PS2='> '
|
|
CDPATH="$CDPATH:~"
|
|
# stuff for less(1)
|
|
LESS="-M-Q" # long prompt, silent
|
|
LESSEDIT="%E ?lt+%lt. %f" # edit top line
|
|
VISUAL="jed" # editor
|
|
LESSCHARSET=latin1 # visualise accented letters
|
|
export PS1 PS2 CDPATH LS_OPTIONS LESS LESSEDIT LESSOPEN VISUAL LESSCHARSET
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
<P>
|
|
<P>
|
|
<H2><A NAME="ss11.8">11.8 Common Extensions and Related Programs</A>
|
|
</H2>
|
|
|
|
<P>
|
|
<P>You may come across scores of file extensions. Excluding the more
|
|
exotic ones (i.e. fonts, etc.), here's a list of who's what:
|
|
<P>
|
|
<UL>
|
|
<LI> <CODE>1 ... 8</CODE>: man pages. Read them with
|
|
<CODE>groff -Tascii -man <file.1></CODE>.
|
|
</LI>
|
|
<LI> <CODE>arj</CODE>: archive made with <CODE>arj</CODE>.
|
|
</LI>
|
|
<LI> <CODE>dvi</CODE>: output file produced by TeX (see below). <CODE>xdvi</CODE>
|
|
to visualise it; <CODE>dvips</CODE> to turn it into a PostScript <CODE>.ps</CODE>
|
|
file.
|
|
</LI>
|
|
<LI> <CODE>gz</CODE>: archive made with <CODE>gzip</CODE>.
|
|
</LI>
|
|
<LI> <CODE>info</CODE>: info file (sort of alternative to man pages). Get
|
|
<CODE>info</CODE>.
|
|
</LI>
|
|
<LI> <CODE>lsm</CODE>: Linux Software Map file. It's a plain ASCII file
|
|
containing the description of a package.
|
|
</LI>
|
|
<LI> <CODE>ps</CODE>: PostScript file. To visualise or print it get
|
|
<CODE>gs</CODE> and, optionally, <CODE>ghostview</CODE> or <CODE>gv</CODE>.
|
|
</LI>
|
|
<LI> <CODE>rpm</CODE>: Red Hat package. You can install it on any system using
|
|
the package manager <CODE>rpm</CODE>.
|
|
</LI>
|
|
<LI> <CODE>taz, tar.Z</CODE>: archive made with <CODE>tar</CODE> and compressed
|
|
with <CODE>compress</CODE>.
|
|
</LI>
|
|
<LI> <CODE>tgz, tar.gz</CODE>: archive made with <CODE>tar</CODE> and compressed
|
|
with <CODE>gzip</CODE>.
|
|
</LI>
|
|
<LI> <CODE>tex</CODE>: text file to submit to TeX, a powerful typesetting
|
|
system. Get the package <CODE>tex</CODE>, available in many distributions.
|
|
</LI>
|
|
<LI> <CODE>texi</CODE>: texinfo file, can produce both TeX and info files (cp.
|
|
<CODE>info</CODE>). Get <CODE>texinfo</CODE>.
|
|
</LI>
|
|
<LI> <CODE>xbm, xpm, xwd</CODE>: graphic file.
|
|
</LI>
|
|
<LI> <CODE>Z</CODE>: archive made with <CODE>compress</CODE>.
|
|
</LI>
|
|
</UL>
|
|
<P>
|
|
<P>
|
|
<H2><A NAME="ss11.9">11.9 Converting Files</A>
|
|
</H2>
|
|
|
|
<P>
|
|
<P>If you need to exchange text files between DOS/Win and Linux, be aware of
|
|
the ``end of line'' problem. Under DOS, each line of text ends with CR/LF
|
|
(that is, ASCII 13 + ASCII 10), with LF under Linux. If you edit a DOS text
|
|
file under Linux, each line will likely end with a strange--looking `M'
|
|
character; a Linux text file under DOS will appear as a kilometric single
|
|
line with no paragraphs. There are a couple of tools, <CODE>dos2unix</CODE> and
|
|
<CODE>unix2dos</CODE>, to convert the files.
|
|
<P>If your text--only files contain accented characters, make sure they are
|
|
made under Windows (with Notepad) and not under plain DOS; otherwise, all
|
|
accented characters will be screwed up.
|
|
<P>
|
|
<P>
|
|
<H2><A NAME="ss11.10">11.10 Free Office Suites</A>
|
|
</H2>
|
|
|
|
<P>
|
|
<P>Yes, you can have for free what would otherwise cost a lot of money!
|
|
<P>StarOffice (
|
|
<A HREF="http://www.sun.com/staroffice">http://www.sun.com/staroffice</A>.) is currently the
|
|
only choice, though Koffice is down the pipeline (
|
|
<A HREF="http://www.koffice.org">http://www.koffice.org</A>). StarOffice is big and slow, but very good
|
|
anyway: it offers a lot of functionality not found in Microsoft Office. It
|
|
can also read and write Word and Excel files, although the conversion isn't
|
|
always perfect.
|
|
<P>Another good package is Corel WordPerfect, a free edition of which is
|
|
available for download. Need I say more? Go fetch it:
|
|
<A HREF="http://www.corel.com">http://www.corel.com</A>.
|
|
<P>
|
|
<P>
|
|
<HR>
|
|
<A HREF="DOS-Win-to-Linux-HOWTO-12.html">Next</A>
|
|
<A HREF="DOS-Win-to-Linux-HOWTO-10.html">Previous</A>
|
|
<A HREF="DOS-Win-to-Linux-HOWTO.html#toc11">Contents</A>
|
|
</BODY>
|
|
</HTML>
|