old-www/LDP/LG/issue44/silva.html

197 lines
8.8 KiB
HTML

<!--startcut ==========================================================-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<title>Linux Tips and Tricks LG #44</title>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#0000AF"
ALINK="#FF0000">
<!--endcut ============================================================-->
<H4>
"Linux Gazette...<I>making Linux just a little more fun!</I>"
</H4>
<P> <HR> <P>
<!--===================================================================-->
<center>
<H1><font color="maroon">Linux Tips and Tricks</font></H1>
<H4>By <a href="mailto:afsilva@liberty.edu">Anderson Silva</a></H4>
</center>
<P> <HR> <P>
<P ALIGN=LEFT STYLE="margin-bottom: 0in"> I am writing this article
for the linux newbies and even for the intermediate user that might
think a few of these tricks are useful for them. Nothing here is new.
They are just published very seldom by magazines or books, so a few of you might not know
these tips.</P>
<P ALIGN=LEFT STYLE="margin-bottom: 0in"> I have been using linux for
2 years now, and I can tell you that I learn something new virtually
every day. And a few of those things I have learned are very rare to be seen all the time. Here are a
few of them.</P>
<P ALIGN=LEFT STYLE="margin-bottom: 0in"><BR>
</P>
<OL>
<LI><P ALIGN=LEFT STYLE="margin-bottom: 0in">If you are using
Redhat's <B>netcfg</B><SPAN STYLE="font-weight: medium"> utility
to connect to the internet and you are sick of having to open up
the GUI, and click on ACTIVATE to connect, and then have to click on
DEACTIVATE to disconnect... here is one little thing that you can
do to make life easier.</SPAN></P>
<P ALIGN=LEFT STYLE="margin-bottom: 0in; font-weight: medium">Let's
say you have a ppp0 set up with <B>netcfg</B>. Just add this two
lines to your <I>/etc/bashrc</I></P>
</OL>
<UL>
<LI><P ALIGN=LEFT STYLE="margin-bottom: 0in"><I><B>alias
dial=&quot;/etc/sysconfig/network-scripts/ifup-ppp
/etc/sysconfig/network-scripts/ifcfg-ppp0&quot;</B></I></P>
<LI><P ALIGN=LEFT STYLE="margin-bottom: 0in"><I><B>alias
hangup=&quot;/etc/sysconfig/network-scripts/ifdown-ppp
/etc/sysconfig/network-scripts/ifcfg-ppp0&quot;</B></I></P>
</UL>
<P ALIGN=LEFT STYLE="margin-left: 0.5in; margin-bottom: 0in; font-style: normal; font-weight: medium">
<BR>
</P>
<P ALIGN=LEFT STYLE="margin-left: 0.5in; margin-bottom: 0in; font-style: normal; font-weight: medium">
Now if you want to connect, all you need to do is to go to your terminal
and type <B>dial</B>; if you would like to disconnect just type
<B>hangup</B>.</P>
<P ALIGN=LEFT STYLE="margin-left: 0.5in; margin-bottom: 0in; font-style: normal; font-weight: medium">
<BR>
</P><OL start=2>
<LI>Here is another cool thing for you guys that use <B>bash</B>.</P></OL>
<P ALIGN=LEFT STYLE="margin-left: 0.5in; margin-bottom: 0in">Let's
say you want to create a new directory called <B>test</B></P>
<P ALIGN=LEFT STYLE="margin-left: 0.5in; margin-bottom: 0in; font-weight: medium">
And you type:</P>
<P ALIGN=LEFT STYLE="margin-left: 0.5in; margin-bottom: 0in"><BR>
</P>
<P ALIGN=LEFT STYLE="margin-left: 0.5in; margin-bottom: 0in"><B>#</B>
mkdri
</P>
<P ALIGN=LEFT STYLE="margin-bottom: 0in"><I><B> </B></I></P>
<P ALIGN=LEFT STYLE="margin-left: 0.5in; margin-bottom: 0in"><B><SPAN STYLE="font-style: normal">Note
that the command is mkdir, not mkdri</SPAN></B><SPAN STYLE="font-weight: medium"><SPAN STYLE="font-style: normal">.
Instead of backspa</SPAN></SPAN>cing to fix this typo, go ahead and
hit <b>Ctrl+t</b> (simultaneously). It will swap the two letter and you
have your command fixed.</P>
<P ALIGN=LEFT STYLE="margin-left: 0.5in; margin-bottom: 0in"><BR>
</P>
<OL START=3>
<LI><P ALIGN=LEFT STYLE="margin-bottom: 0in">Also for you guys that
are using <B>bash</B>.</P>
<P ALIGN=LEFT STYLE="margin-bottom: 0in"><SPAN STYLE="font-weight: medium">Don't
you hate when you want to go from one directory to another, but the
directory is a 200-letter name? Let's say you wanted to go from your
current directory to the directory
<B>what_is_wrong_with_this_directory.</B></SPAN></P>
<P ALIGN=LEFT STYLE="margin-bottom: 0in"></P>
<P ALIGN=LEFT STYLE="margin-bottom: 0in"><B># cd what</B></P>
<P ALIGN=LEFT STYLE="margin-bottom: 0in"></P>
<P ALIGN=LEFT STYLE="margin-bottom: 0in"><SPAN STYLE="font-weight: medium">Now,
go ahead and hit the TAB key.</SPAN> This will make the shell look
through your paths and find the possibilities that starts with <B>what</B><SPAN STYLE="font-weight: medium">.
</SPAN>
</P>
<P ALIGN=LEFT STYLE="margin-bottom: 0in"><B>Note: If you hit tab
once and nothing happens, hit it twice, because if there is any
other directory that starts with the <SPAN STYLE="font-style: normal">word</SPAN>
</B><SPAN STYLE="font-weight: medium"><I>what</I></SPAN><B> then the
shell would not know to what directory to go to.</B></P>
</OL>
<P ALIGN=LEFT STYLE="margin-left: 0.5in; margin-bottom: 0in; font-weight: medium">
<BR>
</P>
<OL START=4>
<LI><P ALIGN=LEFT STYLE="margin-bottom: 0in; font-weight: medium">Customizing
your directory colors.</P>
<P ALIGN=LEFT STYLE="margin-bottom: 0in"><SPAN STYLE="font-weight: medium">I
know a lot of you know the command <B>ls --color</B></SPAN><B>. </B><SPAN STYLE="font-weight: medium">Which
displays your directory with colors. But, a lot of people may not
know that those colors are customizable.</SPAN><SPAN STYLE="font-weight: medium">
All you need to do is add the following line to your <I>/etc/bashrc</I>
file.</SPAN></P>
</OL>
<P ALIGN=LEFT STYLE="margin-left: 0.5in; margin-bottom: 0in; font-weight: medium">
<BR>
</P>
<P ALIGN=LEFT STYLE="margin-left: 0.5in; margin-bottom: 0in; font-weight: medium">
<B>eval `dircolors /etc/DIR_COLORS`</B></P>
<P ALIGN=LEFT STYLE="margin-left: 0.5in; margin-bottom: 0in; font-weight: medium">
<BR>
</P>
<P ALIGN=LEFT STYLE="margin-left: 0.5in; margin-bottom: 0in; font-weight: medium">
And then all of the color configuration can be found in the file
<I>/etc/DIR_COLORS</I></P>
<P ALIGN=LEFT STYLE="margin-left: 0.5in; margin-bottom: 0in; font-weight: medium">
<BR>
</P>
<OL START=5>
<LI><P ALIGN=LEFT STYLE="margin-bottom: 0in; font-style: normal; font-weight: medium">
Frozen Xwindow.</P>
<P ALIGN=LEFT STYLE="margin-bottom: 0in; font-style: normal; font-weight: medium">
If your Xwindow freezes sometimes, here are two ways that you may
try to kill your server. The first is the simple simple way of
killing your X server the key combination: <B>Ctrl+Alt+Backspace</B></P>
</OL>
<P ALIGN=LEFT STYLE="margin-left: 0.5in; margin-bottom: 0in"><SPAN STYLE="font-weight: medium"><SPAN STYLE="font-style: normal">
The second way is a little more complicated, but it works most
of the time. Hit <B>Ctrl+Alt+F2</B> to </SPAN></SPAN>startup a
virtual console, then log in with your user name and password and
run:</P>
<P ALIGN=LEFT STYLE="margin-left: 0.5in; margin-bottom: 0in"><BR>
</P>
<P ALIGN=LEFT STYLE="margin-left: 0.5in; margin-bottom: 0in"># <B>ps
-ax | grep startx</B></P>
<P ALIGN=LEFT STYLE="margin-left: 0.5in; margin-bottom: 0in"><BR>
</P>
<P ALIGN=LEFT STYLE="margin-left: 0.5in; margin-bottom: 0in">This
will give you the PID of your Xserver. Then just kill it with:</P>
<P ALIGN=LEFT STYLE="margin-left: 0.5in; margin-bottom: 0in"><BR>
</P>
<P ALIGN=LEFT STYLE="margin-left: 0.5in; margin-bottom: 0in"># <B>kill
-9 PID_Number</B></P>
<P ALIGN=LEFT STYLE="margin-left: 0.5in; margin-bottom: 0in"><BR>
</P>
<P ALIGN=LEFT STYLE="margin-left: 0.5in; margin-bottom: 0in">To go
back to your first console, just hit <B>Alt-F1</B></P>
<P ALIGN=LEFT STYLE="margin-left: 0.5in; margin-bottom: 0in"><BR>
</P>
<P ALIGN=LEFT STYLE="margin-bottom: 0in"><B> </B><SPAN STYLE="font-weight: medium">None
of these tricks are &quot;rocket scientist&quot; stuff, but I bet it
is new for a lot of linux newcomers. So, hopefully, you learned
something new with this article. </SPAN>
</P>
<P ALIGN=LEFT STYLE="margin-bottom: 0in"><BR>
</P>
<P ALIGN=LEFT STYLE="margin-left: 0.5in; margin-bottom: 0in"><BR>
</P>
<P ALIGN=LEFT STYLE="margin-left: 0.5in; margin-bottom: 0in"><BR>
</P>
<!--===================================================================-->
<P> <hr> <P>
<center><H5>Copyright &copy; 1999, Anderson Silva <BR>
Published in Issue 44 of <i>Linux Gazette</i>, August 1999</H5></center>
<!--===================================================================-->
<!--startcut ==========================================================-->
<P> <hr> <P>
<A HREF="index.html"><IMG ALIGN=BOTTOM SRC="../gx/indexnew.gif"
ALT="[ TABLE OF CONTENTS ]"></A>
<A HREF="../index.html"><IMG ALIGN=BOTTOM SRC="../gx/homenew.gif"
ALT="[ FRONT PAGE ]"></A>
<A HREF="severinghaus.html"><IMG SRC="../gx/back2.gif"
ALT=" Back "></A>
<A HREF="stumpel.html"><IMG SRC="../gx/fwd.gif" ALT=" Next "></A>
<P> <hr> <P>
</BODY>
</HTML>
<!--endcut ============================================================-->