Jump to content

Tips for Linux Explorers

Recommended Posts



Here is another really simple one:


$ su < password ># mcedit /usr/lib/openoffice/program/sofficerc

set the Logo to " 0 "


NOTE: for OpenOffice 2.0 the sofficerc is in "/usr/lib/ooo-2.0/program/sofficerc" or "/opt/openoffice.org2.0/program/sofficerc"


If only life itself was sOOo simple . . . . . . . :)


B) Bruno

Link to post
Share on other sites
  • Replies 375
  • Created
  • Last Reply

Top Posters In This Topic

  • Bruno


  • greengeek


  • Peachy


LilBambi: Just giving you all some work-out for the brain, ;) My Mandrake 9.1 PowerPack will come in any day now and I'll have to take the system down for a day. New software, new hardware, network set-up, major tweakwork on this box. So while I'm bussy, I don't want all of you to get bored. :D B) Bruno

Link to post
Share on other sites



They say that Linux is tweaker's heaven, here is why:

All of the configuration files are readable and quiete easy to understand, here is a list of the most common files and a short description what they are about. ( go on, do have a look with "cat" )


/etc/bashrc =settings for the bash shell trough the system


/etc/crontab =setting for the cron-jobs ( remember the jobs that run in the middle of the night ? )


/etc/cups =the printer settings ( if you use lpr instead of cups: /etc/printcap )


/etc/fstab = filesystem table


/etc/inittab = the default runlevel


/etc/lilo.conf = the configuration of the boot loader ( /boot/grub if you use grub instaed of lilo )


/etc/modules.conf = the modules to load at boot


/etc/profile = programs started at boot


/etc/rc.d = the different runlevels and shotcuts to programs to load at that level


/etc/ssh = the ssh settings for secure remote acces


/etc/X11/XF86Config = the X configuration ( GUI )


~/.bash_profile = aliases and variables for the bash shell


~/.bashrc = personal settings for the bash shell


~/evolution = your mail, adresses and settings for evolution


~/.galeon = you bookmarks and settings for galeon


~/.gnome = your personal gnome settings


~/.gnome2 = more gnome settings


~/.kde = your peronal settings for kde


~/Mail = here are your mail and mail settings if you use kmail


~/.mozilla = personal mozilla settings, bookmarks etc.


~/.ssh = personal ssh settings


~/.exrc = your settings for the vi editor


We will have a good look at these files and what clever tricks we can do with some of them, later in the thread !


B) Bruno

Link to post
Share on other sites
Be one step ahaid and backup your /home directory from time to time. There are many different ways to do this, in Mandrake you can go to the Mandrake Control Center and use darkx to do this automated on a regular basis.
Should darkx be drakx? - I just want to verify that?
Link to post
Share on other sites

havnblast:Oeps, typo . . . . . . . . . . changed it ! Thanks havnblast, I knew I could count on you people to get the typo's ouwt ;) oeps, out. ! :unsure: Bruno

Link to post
Share on other sites



As your system boots-up it goes through several "run-levels"

We're going to shed some light on how all this works, not changing anything yet, just having a quick peek.


There are 7 different run-levels:


0.) Shutdown, complete stop


1.) Single user mode, only for troubleshooting and system recovery


2.) Multi-user mode, without networking


3.) Multi-user mode, with networking


4.) Not used, you could create your own runlevel here ( ! In Slackware like 5 ! )


5.) Multi-user mode with GUI, your normal X desktop ( ! Not in Slackware ! )


6.) Restart


O.K. we're starting the tour, not using the console this time but by simply clicking a few icons

Home --> /etc --> /rc.d ( rc.d ! not the other rc's !! )


Now, here you'll see them: "/rd0" to "/rc6" and some special files like "rc.local" and "rc.sysinit".

Click on "rc5" to open it; here you'll see a bunch of symbolic-links ( shortcuts ) they all are linked to a program to start or stop in runlevel 5. Have a good look, you will notice they start with a "K" or" S" and a number. The number gives the order of execution the "K" stands for Kill the "S" for Start. ( some services started earlier or in other runlevels are stopped here, because the only had to run to boot the system. )


We go one step back to /etc/rc.d and have a look at the "rc.local" file, right-click on it and choose "Preview in Embedded KDE Advanced Text Editor Component" that's a safe way to have see the file.

"rc.local" is a script where you could add your own lines of code at the bottom in order to get a program started at boot in the last runlevel. ( see the "#!/bin/sh" on the first line ? This is no bash script but a shell script ! )


NOTE: remember the Multi Media key's ? There we did put a script in "~/.kde/Autostart", in order to startup with KDE. This is useless if you run a more exotic window manager ! In that case "rc.local" is the place to add the code.


The file "rc.sysinit" also located in /etc/rc.d controls the runlevel procedure and is the first file loaded at boot, so you better don't fidddle around with this one !!! Preview in the "Embedded KDE Advanced Text Editor Component" can't hurt though ! The "rc.sysinit" look familiar and starts with "#!/bin/bash" we know that one already ! While you're at it look at the "rc" and "rc.modules" too, they speak for themselves.


Now you know what's going on as you boot your system !


B) Bruno

Link to post
Share on other sites



It looks like some commands given in the text Multi Media Key's text don't work anymore in Mandrake 9.1 ( they did in 9.0 ). These were the old commands for "Reboot" < shutdown - r now > and "Stop" < shutdown - h now >. In the case of "Reboot" the solutions is simple: < reboot >, for the command of "Stop"


I'm still scratching my head, "sudo" does not seem to work nor does "-su", but as soon as I find the trick it will be added in the text.


B) Bruno

Link to post
Share on other sites

Hi Thanks to all who contributed to the execellent information on the linux commands . Copied and pasted it into a text editor and have quite a few printed pages , Now to digest all the material. I have used the text editor vi before and some of my PC friends have suggested that it is the Linux equlivent of the dos text editor edlin , but it works and is always there when you need it I have found out during installation of Linux with a high speed connection that if the siginal is looped through a router it picks up all the information and after installation and reboot you are connected to the net . Also a good hard ware fire wall. An associate and I spent quite an amount of time getting tar to work , using the man and help files , we still didn't figure out how to eliminate the iso file in the backup Keep yp the execellent work there are many who are unhappy with Windows and from the experince I have had it is an excellent alternativePS excuse the typos , have the same problem in the command line :D charlie

Link to post
Share on other sites

Hi Charlie, thanks for your input. Always great to hear some feedback.Could you be a bit more clear on:

we still didn't figure out how to eliminate the iso file in the backup
Sugestion: start up a new thread explaining us the probelm, we'll be glad to help.PS never mind the typo's I make plenty of them and correct them the next day :D :D Bruno
Link to post
Share on other sites



In Linux we talk about "users" and "groups" I'm sure you know about this.

They have different permissions regarding access to files. There is a clever way to see how permissions are set.


Remember the command "ls" it gave a list of all files in the directory you"re in, "ls -a" even did show all the hidden files as well.

$ ls -l

( Will give you the files in "long" format, try: )

$ ls -l /etc/gnome/gnomerc


This is what you will get:

-rwxr-xr-x 1 root root 484 Feb 25 14:08 /etc/gnome/gnomerc


This does look a bit complicated but it really isn"t. The first 10 characters are built up like this:

- | rwx | r-x | r-x


The first one tells you whether it is a file ( - ) a directory ( d ) or a link ( l )

The next three are for the "user" "r"ead "w"rite and e"x"ecute. The next three for the "group" and the last three for all "others"


The next 1 stands for the number of links to the file. The owner. The group. The size in bytes. The date and time of the last modification to the file. And the name of the file.

$  ls -al /home/bruno


Will give a long list of all the files in your home directory and their permissions.

The list is even to long for your screen:

"ls -al /home/bruno >permissions"

Places a textfile called permissions in your home directory, do print it out for further inspection, there is a lot to learn there.


B) Bruno

Link to post
Share on other sites



Changing the permissions can be done with names and numbers, I like the numbers:

( do you remember the chmod 755 command from a few posts ago ? )

# chmod 754 filename

( Will put the file to rwx r-x r-- )


Here is why:

4=read 2=write 1=execute.

The three numbers in the chmod above are for the "user" ( the first number ), "group" ( the second number ) and "others" ( the third number )


So if I want to give the user all permissions: 4+2+1=7

and i give the group read an execute permissions: 4+1=5

and all others only read permission 4=4


Chown and chgrp are two commands also related to permissions:

# chown

( Changes the owner of the file. )


# chown anna tessst

( Changes the owner of the file tessst from bruno to anna )


# chgrp

( Changes the group ownership of a file - if you did change the user and the user belongs to another group - ).


If you want to change both user and group at the same time you can do it this way:

# chown anna:anna tessst

( This changes the owner to anna and the group to anna )


You want to do the same but for a directory full of files:

# chown -R anna:anna tessst


Well, this will give you enough exercise for this sunday, tomorrow we will go into hardlinks and symlinks, another little brain-teaser


B) Bruno


NOTE: Next to the method described above there is a second way to change permissions:

chmod takes either the decimal representation of the permissions or a symbolic representation. The symbolic representation is [ugoa][+-][rwx]. This is one of the letters u (user=file owner), g (group), o(others), a(all=u and g and o) followed by + or - to add or remove permissions and then the symbolic representation of the permissions in the form of r(read) w(write) x(execute). To make the file "file.txt" writable for all you type: "chmod a+w file.txt"
Link to post
Share on other sites


( what browser should open as you click on a link in an email )


I had this problem, I really do like Evolution for my mail and it used to open the links send to me in an email in Galeon, a nice fast browser.

Suddenly with the new Mandrake 9.1 it opened the links in Mozilla, that's a much slower browser.

So I found the tweak :

$ gnome-control-center


A window will pop up, go to the "Preferred Applications" and there set the default browser to the one you prefer.


Start or restart Evolution and notice the difference


B) Bruno

Link to post
Share on other sites



Today we will test your virtual imagination capabilities !


The main difference between hardlinks and symlinks ( symbolic or softlinks ) are:

1.) You cannot make a hardlink to a directory.

2.) If you remove the original file of a hardlink the link will still show you the content of the file.

3.) A symlink can link a directory

4.) The symlink is useless as you remove the original file.


All this might seem hard to grasp, but let's explain:




A little experiment to show the case.

$ mkdir Test

( Making a new directory for our test )


$ cd Test

( Move in the directory )


$ vi fileA

( Make a file called fileA )


< i >

Type in some funny lines of text

< Esc >

< ZZ > ( save the file )


So, we made a "fileA" in a new directory called "Test" in your /home.

$ ln fileA fileB

( Making a hardlink )


$ ls -il fileA fileB

( The "i" argument will show the inode on the HD )


This is what you get:

1482256 -rw-r--r-- . . . 2 bruno . . bruno . . . . 21 May 5 15:55 fileA1482256 -rw-r--r-- . . . 2 bruno . . bruno . . . . 21 May 5 15:55 fileB


Here you can see that both fileA and fileB have the same inode number ( 1482256 ), also both files have the same file permissions and the same size, because that ´size´ is on the same inode it does not consume any extra space on your HD !


Now if we would remove the original "fileA"

$ rm fileA


and have a look at the content of the "link" fileB

$ cat fileB


you will still be able to read the funny line of text you typed. ( MAGIC ! )




Staying in the same test directory as above we make a symlink:

$ ln -s fileB fileC
$ ls -il fileB fileC


This is what you´ll get:

1482256 -rw-r--r-- . . . . . 1 bruno . . bruno . . . . 21 May 5 15:55 fileB1482226 lrwxrwxrwx . . . 1 bruno . . bruno . . . . 5 May 5 16:22 fileC -> fileB


You´ll notice the inodes are different and the link got a "l" before the rwxrwxrwx . The link has different permissions than the original file because it is just a symbolic link, its real content is just a string pointing to the original file. The size of the symlink ( 5 ) is the size of it´s string.

$ cat fileB



$ cat fileC


Will show the same funny text.


Now if we remove the original file:

$ rm fileB


and check the Test directory

$ ls


you will see the link fileC is still there, but if we do

$ cat fileC

it will tel you that there is no such file or directory !!



$ ls -il fileC


will still give you:

1482226 lrwxrwxrwx . . . 1 bruno . . bruno . . . . 5 May 5 16:22 fileC -> fileB


But the link is obsolete ! ( hope you´re still with me )


O.K. The test is over, you can delete the Test directory


$ cd .. $ rm -rf Test

( "r" stands for recursive "f" is force )


WARNING: < rm -rf > is very powerfull, if ever someone wants to play a trick on you and tells you to do < rm -rf / > as root, you will loose all your files and directories on your / partition, thus have an empty HD !!! :(


Not dizzy yet ? Wait till next week when we come to the real stuff !


B) Bruno

Link to post
Share on other sites



We can add some personal tweaks to the vi editor, making editing just a bit easier.


Remember on page 5 the important config files ? Remember ~/.exrc ? That is one we will tweak.


The ~/.exrc file stores the settings for the vi editor, I like my vi to number the lines, so if I get an error message that on line 26 there is a conflict I can easily find it, also I like to see the mode vi is in.


So I use 1 and 5 from this list: ( this list is over-complete, but just pick the ones you like )

set number

set ap

set autowrite

set showmatch

set showmode

set redraw

set nu

map ^X :set backup="%~"

set noskipdisplay

set displayencoding=euc-jp

set inputencoding=euc-jp

set fileencoding=euc-jp

set autodetect=jp+ map S :r ~/.signature


Here is how you do it:

$ vi .exrc


< i >

set number

set showmode

<Esc >

< ZZ >


The next time you start your favorite editor the .exrc will be used.


B) Bruno



Link to post
Share on other sites



Lilo ( or Grub ) boots your computer.


If you install a second or third distro on your computer you´ll have to adapt the bootloader to show all the entries you want to boot in.

( NOT if you just add Linux to your windows computer ! )

I recently added Debian and Slackware to my Mandrake computer.

First I added the vmlinuz and init.gz from Knoppix and slack to the /boot directory of mandrake.

I made 2 directories in /boot : /debian and /slack and copied the vmlinuz from both disto´s in there.

Drive hdb2 and hdb6 are mounted on /mnt in my Mandrake.


I´m using the lilo from Mandrake. After making a backup of my original lilo.conf, I changed my /etc/lilo.conf ( for the moment only Debian is added ) This is what my /etc/lilo.conf looks like:

( I´ve put in some dots to format the text )




default="mandrake" ( ! I did change linux to mandrake ! )









. . . . . label="mandrake" ( ! I did change linux to mandrake ! )

. . . . . root=/dev/hda1

. . . . . initrd=/boot/initrd.img

. . . . . append="devfs=mount hdd=ide-scsi acpi=off quiet"

. . . . . vga=788

. . . . . read-only



. . . . . label="debian"

. . . . . root=/dev/hdb2

. . . . . initrd=/boot/debian/initrd.gz

. . . . . vga=788

. . . . . read-only



. . . . . label="slackware"

. . . . . root=/dev/hdb6

. . . . . append="hdd=ide-scsi"

. . . . . vga=788

. . . . . read-only



. . . . . label="linux-nonfb"

. . . . . root=/dev/hda1

. . . . . initrd=/boot/initrd.img

. . . . . append="devfs=mount hdd=ide-scsi acpi=off"

. . . . . read-only



. . . . . label="failsafe"

. . . . . root=/dev/hda1

. . . . . initrd=/boot/initrd.img

. . . . . append="devfs=nomount hdd=ide-scsi acpi=off failsafe"

. . . . . read-only



. . . . . label="floppy"

. . . . . unsafe


# If you multiboot windows it will show here:


. . . . . label="windows"

. . . . . table=/dev/hda


I´m not saying that you should start messing your lilo right away, but, do have a look at your own /etc/lilo.conf and see what it looks like:

$ cat /etc/lilo.conf


IMPORTANT: If you ever have to change your /etc/lilo.conf, and you´ve finished adapting it, you have to give the command as root:

# /sbin/lilo


This will write lilo to the MBR sector of your disk. ( if you made a mistake it will give you an error message !! The default distro will be marked with an * )

If ever an other OS overwrites your Lilo, just use your bootdisk to boot in Linux and give the same command < /sbin/lilo >


At boot as the lilo screen comes up you´ll see:

mandrake *







Happy tweaking !

Perhaps see if you can change the name "linux" in your own Lilo to whatever distro you are using ! ( you have to change it on two places like I did with Mandrake )

This will give you some experience for when you really will have to do it ! <_< BUT MAKE A BACKUP FIRST !


B) Bruno

Link to post
Share on other sites
TEAK EVOLUTION( what browser should open as you click on a link in an email ) I had this problem, I really do like Evolution for my mail and it used to open the links send to me in an email in Galeon, a nice fast browser. Suddenly with the new Mandrake 9.1 it opened the links in Mozilla, that's a much slower browser. So I found the tweak : $ vi /home/user/.gnome/Gnome < i > change: default-show=gnome-moz-remote --newwin "%s" to: default-show=galeon --newwin "%s" ( or replace galeon with opera or phoenix ) < Esc > < ZZ > Start or restart Evolution and notice the difference :D ;) :D Bruno
Hello Bruno,This method does not work on RedHat....I too prefer Galeon to Mozilla. So, what i did was rename the actual mozilla in /usr/bin to something else and create a new simlink named mozilla which points to Galeon! This way any app which makes a request for mozilla actually runs Galeon! ;) rgds,007
Link to post
Share on other sites

I use Grub instead of Lilo, and during grub setup, theres an option to write to MBR, and its off by default. grub boots up during loading, but how does it do that without messing with the MBR?

Link to post
Share on other sites

Thanks for the tip 007 ! ( happy that someone actualy does read my tips :D )Prelude76, I know only about Lilo, but if Grub does the same : The bootloader overwrites the MBR, ( you can always restore it later ) but leaves you the option to boot in windows too. ;) Bruno

Link to post
Share on other sites

ISO's and MD5SUM ( checksum )


For those of you that never came near to linux, here is a description how to download your first Linux ISO, and check its integrety.


For the ones already running Linux: Imagine, one day you get bored with your current distro and you want to try something else. Or, you've got enough HD space and want to triple-boot. Or, and this is more likely to happen; there is a new version of your disto hitting the mirrors : You start downloading the ISO's


After downloading you can check the integrity of the ISO-file with a checksum, the md5sum. The mirror will offer you a separate text file to download with a 128 bit string of characters. This string has to be exactly the same as the one you get when you do:

$ md5sum downloaded.iso


The string you get typically looks like:

563c1bfff307a16d45f5d6 a04011f07b


( Sure you have to "cd" to that directory first or do /home/bruno/tmp/downloaded.iso )

Creating the checksum will take only a minute.

Usually I only check the first and the last 5 or 6 characters of the string.


The checksum can be done in windows too: see page 11 of The Tips "Checksum in Windows"


Once you are sure the ISO is O.K. you can burn it to a CD.

WARNING: Doing the checksum to check your CD will give you a different string !


Some handy links:

For more info about the different disto's: Distrowatch

For downloading ISOLinux


Happy downloads !


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


If you might think: "this is all to much trouble, is there no other way to get a distro ?"


Sure you can order a distro at its distributor OR for a quick and cheap solution:

CheapBytes sells them for around $5


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


B) Bruno


PS: Mike180 pointed us to this Link for an other tool to do the checksum in windows.

Link to post
Share on other sites



Here is a short and easy one; in the previous post you learned how to do checksums, so now we can burn them to CD.


In Linux:

$ cdrecord --scanbus


( this will give you a 3 digit number like 0,1,0 )

NOTE: Since kernel 2.6 the above command changed, see Here

$ cdrecord dev=0,1,0 downloaded.iso


That's all, really that's all !


In Windows ( ALL ) with Nero 5:

file --> burn CD image ( don't use that stupid wizard ! )


In Windows ( ALL ) with Nero 6:

1. Launch the "Nero Burning ROM" (regular version, not the wizard) portion of the program.

2. Select from the menu: Recorder > Burn Image.

3. Use the default options and burn the CD.


If after burning you can see a lot of files ( README :( *tip ! ) and directories you'll know your CD is fine!


If after burning you see only one file; the downloaded.iso you've clearly done something wrong and can use the CD as a coaster


B) Bruno

Link to post
Share on other sites
Guest LilBambi

Bruno --Great tips!I believe my Jim uses a GUI based front end for CDRECORD which I believe is called XCDRoast. I have seen it, but am not sure on the exact name, but it is pretty slick. It has support for Joliet and creating bootable Windows CDs as well.I use Nero myself, because that is the computer that has the CDRW in it, and I would have to agree wholeheartedly ...skip the Wizards :(

Link to post
Share on other sites
I believe my Jim uses a GUI based front end for CDRECORD which I believe is called XCDRoast.
Hi Fran:I did use XCDroast too for a short while, but cdrecord on the commandline is just so much easier for ISO's ! :(( no more XCDroast in mdk 9.1 I just saw, it is replaced by K3b, still prefer the commandline cdrecord or even better cdcopy ) :( Bruno
Link to post
Share on other sites
Guest LilBambi

Bruno,You are absolutely right. For many things commandline is actually easier and quickerBut sometimes those cool GUI front ends are very handy. With some programs, they can cut to the chase graphically to make some of those very long commands that can run into several lines of options a lot easier :(

Link to post
Share on other sites

Sure if you want to burn a bundle of files, you're definitely right, then I do GUI too. ( I'm not that fanatic ! :( )But for just an ISO, in the time the GUI loads I've got my ISO burned. :( :( Bruno

Link to post
Share on other sites



UPDATE: Our forum member Steel came with a far easier way in the new XMMS

Crtl + P --> audio 1/0 plugins ---> double click on mpeg layer -->then click on tab "streaming" ---> then tick box "save streaming to disk

"If this does not work for you, try it the way described below:


Today we attack the music section, 3 programs to play around with music files: "Vsound" for recording, "Lame" for converting to MP3 and "mp32ogg" to convert mp3 to ogg. ( ogg vorbis the copyright free audio format )


Ever wished you could record shoutcast audio stream ?

Here is a trick to record stream and convert it to mp3 in one go:


First you need two files; Lame and Vsound:

# urpmi notlame

( Hope you got the urpmi sources set up, it's from the plf ), this will install Lame ! (Yes, I know the package is called Not-Lame, but it installs Lame)


Then go to:


and download the file: vsound-0.4-1mdk-i586.rpm and do:

# rpm -ihv vsound-0.4-1mdk-i586.rpm

( While you're in the directory you downloaded the file in )


O.K. Here is the trick: First go to http://www.shoutcast.com/index.phtml and pick out a station you want to record from. As soon as xmms will start playing you stop xmms and get it of your screen ( not minimize )

Now the code:

$ vsound -s -d xmms -p | lame -h "-" track1.mp3

( "-" stands for standard-out, just copy exactly "-" )


Thats all !


If later you want to convert mp3 to ogg you need the file 'mp32ogg" and do < mp32ogg track1.mp3 track1.ogg >


Installing mp32ogg: < urpmi mp32ogg > ( you need CD 1 & 3 ) ( "Perl-MP3-Info" and "Perl-String-ShellQuote" will be installed aswell, just sit back and let urpmi do the works )


PS: in some cases your "-" can gives problems, in that case do:

$ vsound -s -d xmms -p >track1.wav

( And convert it later to mp3 )


Or even at the same time:

$ vsound -s -d xmms -p >track1.wav&

( You will get your prompt back, then give the command: )

$ lame track1.wav track1.mp3


Have fun recording !


B) Bruno

Link to post
Share on other sites




Sometimes textfiles shown with <cat > are much to long to fit on your screen, this command will show you the top 10 lines of a file, with an -20 option you can let it show the first 20.

$ head -15 fileA

( For the first 15 lines )



Does the same as head, but guess. . . . it shows the last 10.

$ tail -25 fileA

( For the last 25 lines )



If you typed a long text, saved it and later the file gets edited and saved again. There is a command to compare the two files and show the differences:

$ cmp -l fileA fileB

( The l option is to show all differences )



Also checks two files on differences but in another way, just try:

$ diff -by fileA fileB

( The b option is for ignoring black space the y option to sort the output side by side )



This is a simple one, as you're in the commandline might as well print with it:

$ lpr fileA

( Will print the fileA )

$ lpr -#5 fileA

( Will print the file 5 times )



Will create an empty file ( you can write to that file later )

$ touch fileA



( useless but nice to know :) )



Will show you the current date



Will show you the current time


NOTE: you can run several commands on one line seperating them with an ";" so

$ date; time


Will show you: "Fri May 9 21:34:37 CEST 2003"


B) Bruno

Link to post
Share on other sites
This topic is now closed to further replies.

  • Create New...