![]() |
Faoileag's Nest | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| home about soapbox gallery sitemap | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Faoileag's Little Howto This is a loose collection of tips and tricks; basically it's just a collection of notes on how to do things. A quick reference if you like.
How to run a x application on a remote machineIf you want to start a x application on a remote machine (for instance via telnet), but have the output send to your screen (i.e. your local X-server), you've got to do two things:
How to access a remote machine via rshIn this case there must exist a.rhosts file in the user
directory of the remote machine you want to access. The
.rhosts file consists of lines like <local ip>
<local user> with exactly one ip/username-combination per
line (you may use hostnames instead of ip's).Attention: if you get the user-rights of the .rhosts file wrong, it will be ignored!!! Set them
to -rw------- (600) to be on the safe side.
How to update drivers for your graphics cardGet them, then copy them into the directory/usr/X11R6/lib/modules/drivers/
(at least on a suse 7.0 system).
How to unzip .zip files (or create them)Getzip and unzip from
www.info-zip.org/pub/infozi
p/,
either as a precompiled binary or as source.
How to start a cron jobThe cron daemon consults so-called crontabs for jobs to execute (and when to execute them). These crontabs are ordinary textfiles, however you should always use the appropriate tool (crontab) to
manipulate them.To have a look at your crontab execute crontab -l. If a
crontab exists then it's contents is listed, otherwise "no crontab
for <username>" will be displayed.To add or delete an entry in your crontab, use crontab -e.
Which editor is used can be customized, but usually it's vi.You add or delete entries by adding or deleting the appropriate line in the crontab (every entry takes exactly one line). Each line consists of six columns which are seperated by blanks. The sixth (rightmost) column tells cron which command/file
to execute (always use the full path here), while the other five columns
tell cron when to execute it.The columns (1 stands for the leftmost column, counting to the right) have the following meaning and take the values in brackets:
15 4 * * * /home/joe/backup.sh" would mean
that everyday at 4:15 in the morning the script backup.sh
in joe's home directory would be executed (assuming, of course, that
the script is executable).If you want to specify a group of times, then concatenate the individual values, seperated by commas (Example: "00,15,30,45" - in the first column this would read as "every quarter of an hour on the quarter of the hour"). If you want to specify a range of times, you can use the minus (Example: "1-5" in the fifth column would read as "every workday"). How to force package installation with rpmUse the option--nodeps with rpm.Example: rpm --install --nodeps mypackage.rpm
How to check the syntax of httpd.confCall (as root) httpd with the option-t or -T
(-t includes checking the DocumentRoot).Example: httpd -tIf the httpd.conf is faulty, the linenumber as well as the offending directive are printed. How to create a bash prompt with coloursThe sequence\[\033[attr;back;fore\] sets the text
following it to the attributes and colours defined by attr,
back and fore. Here's what values they can
assume:
you'll get something like this:
Attention: if you work with colour in your bashprompt, don't forget a \[\033[0m\] after the coloured
section; otherwise the last colour-definition will "spill-over"
into your command-line.
How to allow root to export his display to a user-started x-serverFirst, add a line likeexport DISPLAY=localhost:0 to
root's .bash_profile (or whatever file is executed after starting
a new shell on your machine).Next, you will have to tell the x-server that localhost
is allowed to connect to it. You do this by adding
xhost +localhost in your .xinitrc file.If the x-server is currently up and running, you'll have to restart it. And from now on, you can start x-applications when you're root but the x-server was started by you not being root but your usual user. How to make kppp work for normal usersIf you want to make the dialer kppp available for normal users in SuSE Linux 7.2 running as their process, you'll have to do the following:
How to change the login messageThe text in the file /etc/issue is displayed before the login-prompt. System information can be accessed via escape-sequences, e.g. \n stands for the system name.The text in the file /etc/motd is displayed directly after the user logged in succesfully. If you want to display generated messages that change daily (say, a message from fortune) you will have to write a small script that writes the generated message into the appropriate file and place it in your /etc/init.d directory. Then hook it up in the appropriate runlevel (for instance by creating a link in /etc/rc2.d) and you are greeted with a different message after restart. Here is an example script to display fortune's sagacities:
#!/bin/bash
How to tell the X server to reload .Xdefaultsxrdb -load ~/.Xdefaults
How to tell ls to use a local color tableInserteval `dircolors .dir_colors -b` somewhere in your
.bash_profile (.dir_colors being your customized xopy of
/etc/DIR_COLORS).You specify colors in the .dir_colors file not by specifying
the color itself but by specifying which color out of the current color
table should be used. Take a look at
"How to customize my terminal colors".
How to customize my terminal colorsIf you don't like the standard colors used, for instance, by thels command, you can change them by redefining the
color palette to which all entries in /etc/DIR_COLORS
refer to (see "How to tell ls to use a
local color table" on how to tell ls to use
user-specific colors).To do this, you will have to add the following lines to your .Xdefaults file (assuming you use xterm
for your terminal windows):
XTerm*color0: <some color>
for normal text and the lines:
XTerm*color8: <some color>
for bold text.For a list of the default colors see the man pages for xterm; for names of supported colors see
the file /usr/X11R6/lib/X11/rgb.txt.Or take a look at http://yath.mine.nu/x11byco lor.html, where you can see how the colors come out on your system as well. By the way, if you don't want to use names for the colors, you can also specify the color as hex-code, like: XTerm*color8: #000080,
which would be the color navy (blue).
How to query a pop3 server by telnetOpen a telnet connection to the pop3 server you want to query. Don't forget the port number (most pop3 servers use port 110). Example:telnet pop3.faoileag.de 110The result should be something like +OK POP3 server ready.
You now have to send the user data, i.e. the name part of your
email-address and your email password. The user name is passed
with the USER command and the password with
PASS. Example (let's assume the email address
is mike25@faoileag.de and the password is "iammike"):USER mike25+OK
PASS iammike+OK
Now you can query the pop3 server using the following commands
(the commands are not case-sensitive, i.e. you can write
USER as well as user:
-ERR no such message.
Same goes for unknown commands, then you will see -ERR unknown
command.RFC 1939 explains all this in more depth, if you are interested (it also lists some additional commands, but these here are the standard ones you need every day). How to query a web server by telnetOpen a telnet connection to the web server you want to query. Don't forget the port number (most web servers use port 80). Example:telnet www.faoileag.de 80The result should look like: Trying 212.227.109.218...Connected to www.faoileag.de.Escape character is '^]'.Now you can send off your query, i.e. fetch a web page. You do this with GET. Example:GET http://www.faoileag.de/index.html HTTP/1.0 [return][return] There are several things to note here: 1) You have to hit [return] two times. The first [return] just enters the GET command. It's the second [return]
that sends the request off to the web server.2) You have to type the full url (including the protocol bit "http://" and the server name) even though you already are connected to the server and it should know what to do. With long urls, this is not exactly fun. 3) After the url and seperated by a blank, you have to type the protocol again. As a result of the GET, the contents of the web page
you requested is printed to the telnet console. After that, the
connection is usually closed.What do you need this for? Well, there are two reasons why you might want to fetch a web page via telnet: 1) You get the code of the page you requested. This can be quite helpful if there are instant redirects on the page. 2) It's quite useful when you are testing scripts. This is because between the GET and the second [return], you
can insert and set the environment variables the script on the
other end "sees".Example: GET http://www.faoileag.de/index.cgi HTTP/1.0 [return]REFERER: http://www.faoileag.de [return][return] If my script, index.cgi (don't try, there isn't one),
would check the variable REFERER it would get
"http://www.faoileag.de" even though the request
originated on a completely different machine.This example is called "referer spoofing"; it's sometimes used to bypass security measures in scripts. How to query the status of an apache serverThere exist three query commands you can type in the location bar of your browser (I've used localhost here, but a domain name should work as well):http://localhost/server-statushttp://localhost/server-infohttp://localhost/perl-statusHowever, apache must be configured to support this. How to deny directory listing with apacheYou must set the options for that directory accordingly. You do this by usingOptions within a <directoy ...>
block like this:
Options include Indexes, a
directory that does not contain an index.html file (or whatever you have
specified as an equivalent) will be indexed, if Indexes is
not included in the list you will get an error 403, "Forbidden".
How to set up a virtual server with the same ip but on a different portApart from setting up the virtual server with a<VirtualHost...> block, you also have to set the
Listen directive to the new port you've chosen as
well as to port 80.Attention: You will have to restart apache after this; reload won't do! How to suppress the header information on a telnet connectionStart the telnet server with the option-h. If you use
inetd, this is done in /etc/inetd.conf
How to set the default rights for uploaded filesStart the ftp server with the option-u xxx, where
xxx stands for the desired umask.Example: ftpd -u 002 sets the umask for uploads to
-rw-rw-r--.
How to avoid logging shell commands in the historyAt the beginning of the session typeunset HISTFILE[return].
That will clear the environment variable that specifies the file in which
shell commands are logged. And without that variable set the shell won't
save the sessions command history when it exits.
How to really erase a file and clean the diskWith the normalrm command, you only delete the i-node
of the file in question; the file's data is still on your harddisk
and could potentially be read by analyzing the disk.There are two ways to ensure complete deletion:
How to customize syntax highlighting in emacsType:M-x customize-face[Return] (M-x
translates into [Alt][x] on my system).Answer the question wether you want to customize all faces with yes. The syntax highlighting rules for c++ code are those named " Font Lock <element> Face:".If you can't set boldness here, just set it to off, then
change the entry in your .emacs file manually from
nil to on (the lines looks like
(font-lock-type-face (... :bold nil))).
How to supress loading Netcenter in Netscape MailAdd the lineuser_pref("mailnews.start_page.enabled",
false); to the file prefs.js.
How to install the RealPlayer plugin for Netscape 4.7xAfter installing the RealPlayer, look for the filerpnp.so
and copy it into Netscape's plugins directory.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| © 2005, 2010 Dietmar König <mail@faoileag.de> --- last changed September 13, 2010 |