old-www/HOWTO/DOS-Win-to-Linux-HOWTO-8.html

123 lines
4.3 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 : Tailoring the System</TITLE>
<LINK HREF="DOS-Win-to-Linux-HOWTO-9.html" REL=next>
<LINK HREF="DOS-Win-to-Linux-HOWTO-7.html" REL=previous>
<LINK HREF="DOS-Win-to-Linux-HOWTO.html#toc8" REL=contents>
</HEAD>
<BODY>
<A HREF="DOS-Win-to-Linux-HOWTO-9.html">Next</A>
<A HREF="DOS-Win-to-Linux-HOWTO-7.html">Previous</A>
<A HREF="DOS-Win-to-Linux-HOWTO.html#toc8">Contents</A>
<HR>
<H2><A NAME="s8">8. Tailoring the System</A></H2>
<P>
<P>
<H2><A NAME="System Initialisation"></A> <A NAME="ss8.1">8.1 System Initialisation Files </A>
</H2>
<P>
<P>Two important files under DOS are <CODE>AUTOEXEC.BAT</CODE> and
<CODE>CONFIG.SYS</CODE>, which are used at boot time to initialise the system,
set some environment variables like PATH and FILES, and possibly launch a
program or batch file. Additionally, Windows has the infamous registry---one
of the worst ideas ever conceived in computer science.
<P>Under Linux there are lots of initialisation files, some of which you had
better not tamper with until you know exactly what you are doing; they
reside in the /etc tree. All configuration can be done editing
plain text files. If all you need is setting the PATH and other environment
variables, or you want to change the login messages or automatically launch
a program on login, have a look at the following files:
<P>
<BLOCKQUOTE><CODE>
<PRE>
FILES NOTES
/etc/issue sets pre-login message
/etc/motd sets post-login message
/etc/profile sets $PATH and other variables, etc.
/etc/bashrc sets aliases and functions, etc.
/home/your_home/.bashrc sets your aliases + functions
/home/your_home/.bash_profile or
/home/your_home/.profile sets environment + starts your progs
</PRE>
</CODE></BLOCKQUOTE>
<P>If the latter file exists (note that it is a hidden file), it will be read
after the login, and the commands therein will be executed.
<P>Example---look at this <CODE>.bash_profile</CODE>:
<P>
<HR>
<PRE>
# I am a comment
echo Environment:
printenv | less # equivalent of command SET under DOS
alias d='ls -l' # easy to understand what an alias is
alias up='cd ..'
echo "I remind you that the path is "$PATH
echo "Today is `date`" # use the output of the command 'date'
echo "Have a good day, "$LOGNAME
# The following is a "shell function"
ctgz() # List the contents of a .tar.gz archive.
{
for file in $*
do
gzip -dc ${file} | tar tf -
done
}
# end of .profile
</PRE>
<HR>
<P><CODE>$PATH</CODE> and <CODE>$LOGNAME</CODE>, you guessed right, are
environment variables. There are many others to play with; for instance, RMP
for apps like <CODE>less</CODE> or <CODE>bash</CODE>.
<P>Putting this line in your /etc/profile will provide the rough
equivalent of <CODE>PROMPT $P$G</CODE>:
<P>
<BLOCKQUOTE><CODE>
<PRE>
export PS1="\w\\$ "
</PRE>
</CODE></BLOCKQUOTE>
<P>
<P>
<H2><A NAME="ss8.2">8.2 Program Initialisation Files</A>
</H2>
<P>
<P>Under Linux, virtually everything can be tailored to your needs. Most
programs have one or more initialisation files you can fiddle with, often as
a <CODE>.prognamerc</CODE> in your home dir. The first ones you'll want to
modify are:
<P>
<UL>
<LI> <CODE> .inputrc</CODE>: used by <CODE>bash</CODE> to define key bindings;
</LI>
<LI> <CODE> .xinitrc</CODE>: used by <CODE>startx</CODE> to initialise X Window
System;
</LI>
<LI> <CODE> .fvwmrc</CODE>: used by the window manager <CODE>fvwm</CODE>.
</LI>
<LI> <CODE> .joerc, .jstarrc</CODE>: used by the editor <CODE>joe</CODE>;
</LI>
<LI> <CODE> .jedrc</CODE>: used by the editor <CODE>jed</CODE>;
</LI>
<LI> <CODE> .pinerc</CODE>: used by the mail reader <CODE>pine</CODE>;
</LI>
<LI> <CODE> .Xdefault</CODE>: used by many X programs.
</LI>
</UL>
<P>For all of these and the others you'll come across sooner or later, RMP.
Perhaps I could interest you in the Configuration HOWTO,
<A HREF="http://www.linuxdoc.org/HOWTO/Config-HOWTO.html">http://www.linuxdoc.org/HOWTO/Config-HOWTO.html</A>?
<P>
<P>
<HR>
<A HREF="DOS-Win-to-Linux-HOWTO-9.html">Next</A>
<A HREF="DOS-Win-to-Linux-HOWTO-7.html">Previous</A>
<A HREF="DOS-Win-to-Linux-HOWTO.html#toc8">Contents</A>
</BODY>
</HTML>