Jump to content

Tips for Linux Explorers


Recommended Posts





RPM stands for RedHat Package Management, but is pretty universal and used in modern Distro's. In many cases a simple click on the RPM icon will open a GUI for easy installation. Sometimes you can even do a test-install to see if all dependencies are correct.


For the commandline we have: ( assuming we want to install samba-2.2.1a-4 )

# rpm -ihv  samba-2.2.1a-4.rpm ( Will install the package )
# rpm -Uhv samba-2.2.1a-4.rpm  ( Will upgrade the package )
# rpm -e samba-2.2.1a-4.rpm  ( Delete the package )
# rpm -l samba-2.2.1a-4.rpm  ( Will list the files in the package )
# rpm -ql samba-2.2.1a-4.rpm ( Will list the files and state the installed version of the package )


Imagine the install returns that there are some libs missing, and you know for sure that they are there: In most cases you can force an install, or tell it to ignore dependencies.

# rpm -ihv  samba-2.2.1a-4.rpm --force
# rpm -ihv  samba-2.2.1a-4.rpm --nodeps



First have a look what's installed,

# rpm qa | grep samba


this will return,





uninstall. ( Leave the dependencies as they are )

# rpm -e samba-common-2.2.1a-4 --nodeps
# rpm -e samba-client-2.2.1a-4 --nodeps
# rpm -e samba-2.2.1a-4 --nodeps


install the upgrade, ( With or without --force or --nodeps )

# rpm -ihv samba-2.2.7-3.7.2.rpm
# rpm -ihv samba-client-2.2.7-3.7.2.rpm
# rpm -ihv samba-common-2.2.7-3.7.2.rpm


B) Bruno

Link to comment
Share on other sites

  • Replies 375
  • Created
  • Last Reply

Top Posters In This Topic

  • Bruno


  • greengeek


  • havnblast


  • Peachy



TGZ ( slack-packages )


Slackware and Slack-based distro's like VectorLinux use .tgz packages.


Using the Midnight Commander, an ancient looking, but very effective tool, installing slack-packages are a breeze; su root, highlight the package, press F2 and choose install.


The Midnight Commander ( mc ) is a very powerful program, allowing you to manage files, copy, editing, moving, searching, installing, zipping, unzip, converting from one zip format to another, send files to a remote host, undelete files ( ext2 only ), link, symlink, chown, chmod, all those actions can be done with this "Miracle Commander".


MC is available for almost every Linux distro, also Mandrake and RedHat, see install CD's, install it on your computer and have a look, just type < mc > in a console for the program to start. ( Warning: it's an ugly ******* compared to modern GUI interfaces ! )


Also you could use the package manager: "pkginstall" like this:

# pkginstall name_of_package.tgz


That will take care of the installation for you


Using RPM's in Slackware means that you have to convert them to .tgz with a tool called rpm2tgz. VectorLinux is less picky it accepts RedHat's rpm's without complaining.


Tar.gz ( tarballs ) can not be used in Slack or Slack-based distro's


Don't forget to check out SWARET if you use Slackware !!


B) Bruno

Link to comment
Share on other sites


TARBALLS ( compiling from source )


Before we start: check if you got a "c" compiler, "gcc" installed on your computer. ( usually if you choose "development packages" during install gcc will be on your system.:

$ whereis gcc


If no gcc is installed, now is the time to do so, the rpm's are on your CD !




Here is what needs to be done to install a tarball package:

Unpack gkrellm.tar.gz ( we take gkrellm as example )

$ tar -xvzf gkrellm.tar.gz
$ cd gkrellm
$ ./configure
$ make
$ su
< password >
# make install



Download the gkrellm-2.0.tar.gz package to your /home directory.

Open a console

# tar -xvzf gkrellm-2.0.tar.gz  ( Will unzip the package to a new directory gkrellm-2.0 )
Note: for .tar.bz2 packages we do < tar -xvjf >, for .tgz packages < tar -xvfz >
# ls ( Check the name of the new directory, it might be gkrellm2 )
# mv gkrellm-2.0 /usr/src  ( Will move it to your sources directory )
# cd /usr/src/gkrellm-2.0  ( Will put you right inside the directory )
# ls ( Will list all the files in the directory )


IMPORTANT: Do read all relevant files like README and INSTALL they contain essential info about dependencies and install instructions. If no special install instructions are given:

$ ./configure

( That is dot slash configure )


If any errors occur during the configure process read the config.log, see what went wrong. If it misses a special lib file, see if the file is installed, if not install it and start again. If it is installed but the script can't find it consult the troubleshoot section below.


If configure did not report any errors:

$ make ( Might take some time )
$ su
< password >
# make install ( bingo ! )
Ctrl+d ( back to normal user )
$ cd ( back to home directory )


In the last few lines printed to your screen, make install will tell you where to find the executable, relevant files and doc's. Note this down it saves you searching for it as you want to change the config file for the program.If the compiling was successful you can now run the program by typing "gkrellm" at the prompt. ( most likely the executable will be in your path" /usr/bin or /usr/local/bin )


If you like, you can remove the sources if you're done "rm -rf gkrellm-2.0" but if you've got enough space on your HD just leave it there, makes a re-install ( only "make" and "make install" ) easy.


Well if you're still there with me, BRAVO !


B) Bruno

Link to comment
Share on other sites

( just to keep you all interested)




Multi Media Keys under Linux ( tomorrow ! )

Tweaking the prompt

File permissions

Md5sum and iso's

Autostart programs at boot

Bash script

Brief introduction to C

More suggestions anyone ???


B) Bruno

Link to comment
Share on other sites

Multi Media Keys under Linux ( tomorrow ! )
Greengeek: this includes the "windows"-key B) Bruno
Link to comment
Share on other sites



NOTE: Described here are actions for Mandrake, it will work for other distro's too, but names may be slightly different.


INTRO: These are the 4 steps:

1) use xev for getting the keycodes,

2) make a script mapping the keys,

3) make a new directory in the startmenu for odd actions

4) use kmenuedit to assign the keys to entries in the startmenu.


1) Open a console and type < xev > ( if nothing comes up, install xev: < urpmi xev > or < urpmi X11R6-contrib > ) xev will open a window, look for the line:


state 0x10, keycode 116 (keysym 0xff20, Multi_key), same_screen YES,


Now press a key and note down the keycode, repeat this for every key you want to assign an action to ( also volume up/down, right and left "windows" key, logitech-key, any key on your board ! )

A total of 22 Multi Media keys can be mapped.


2) Next step is making a text file in the autostart directory of your window manager ( or put the lines in /etc/rc.d/rc.local )

$ vi /home/bruno/.kde/Autostart/multikeys


( replace "bruno", dot kde )

< i > ( to get vi in insert mode )

This is the text for that file:

#!/bin/bash xmodmap -e 'keycode 116=F13'

xmodmap -e 'keycode 229=F14'

xmodmap -e 'keycode 236=F15'

xmodmap -e 'keycode 178=F16'

etc. ( you can use F13 - F35 )

#End script


< Esc > ( vi back to command mode )

< ZZ > ( save the file and close )


# chmod 0755 /home/bruno/.kde/Autostart/multikeys

( change permissions for the file )


3) Specialy for actions like volume up/down, mute, reboot etc. we have to make a new section in the startmenu: ( mail and browser are already in the menu )

$ menudrake


I made a new directory in "amusement", "toys", called multikeys

The entries made in that directory are:


Volume up < aumix -v+10 > ( Command )

Volume down < aumix -v-10 >

Mute < aumix -v-50 >

Fwd < xmms -f >

Rew < xmms -r >

Play/pause < xmms -m -t >

Stop xmms < xmms -s >

Reboot < shutdown -r now > ( in MDK 9.1: < reboot > )

Sleep < xset dpms force standby >

Shutdown < shutdown -h now > ( in MDK 9.1 < halt > )

Screensaver < dcop kdesktop KScreensaverIface save >

Lock Screen < dcop kdesktop KScreensaverIface lock >

( for more commands see < kdocp > )


Now SAVE menudrake !


4) In a console type:

$ kmenuedit


This will bring up a different menu-tool, with in the left pane the entries in the startmenu and down to the right the hotkey assignment.

Simply select the "program" on the left, press: current key "none" and you will get a dialog, press the multi-key you want it associated with, press apply, and you're ready for the fun of your fancy keys. ( Don't forget your mail and browser )


In kmenuedit you can set any key combination to your favorite programs ( Alt+x for xine, Alt+h for home, Alt+g for gimp, etc. Warning: the Ctrl key is already used for many shortcuts, see Control Center --> Look and Feel --> Shortcuts for a complete list. )


TIP: Get your console under an easy key too. After all it is your most used app !!


B) Bruno

Link to comment
Share on other sites

@ Greengeek: Did you get the stickers ? Send me some . . . . . LOL Glad you're happy ! :blink: Bruno

Link to comment
Share on other sites



If you want to be able to: ~ " ` ' ^ ´ ¨ change your keyboard settings to "us international"


The only downside is that you'll have to press the key twice in order to get ~ " ` ^ ´ . or press the " followed by a space to get the accent print to screen. There is even a clear difference between ¨ and " . . the first is pressed twice and the second is the same key pressed once followed by a space . . . ( only pressing the " prints nothing to screen )


B) Bruno

Link to comment
Share on other sites


$ cd ..

( Is shorthand for go back one step in the directory tree )

$ cd ~

( Is for /home/bruno, if you got more then one user ~bruno or ~anna )

$ cd ~/Downloads/Backgrounds

( Is for /home/bruno/Downloads/Backgrounds ) For really fast typing don't forget the tab-key for autocompletion:

$ cd ~/D "tab-key" /B "tab-key"

( Will give the same as above. )

B) Bruno

Link to comment
Share on other sites

Guest LilBambi

Another tip for the cd command:Just type cd at any command prompt and it will take you directly to your /home/username/ directory (meaning the username you used to log in) ... no muss, no fuss B)

Link to comment
Share on other sites

Hey guys and gals these are great tips - keep em coming, I have learned lots of neat tricks.Does uprmi work for RH too? - I use apt-get with RedHat

Link to comment
Share on other sites

NOTE FROM THE EDITOR: :lol: :) :) Looking up a specific topic is made easy: I'm editting an up to date index in the first post on this thread. :) Bruno

Link to comment
Share on other sites



There have been several questions in other threads about partitions. LilBambi gave some good suggestions, let me try to make an overview:


For the current situation on your HD:

$ df -h


( partitions their sizes and space usage )

Do note down on what hda? lives what partition, this might come in handy at re-install, repartition and crash recovery.

( hda is the first HD, hdb the second, hdc the third etc. etc. hda1 is the first primary partition, hda5 the first logical partition on the first HD )


Everything in one partition is not a good idea, at least you should have a separate /home partition and give it space enough to grow. The clever thing about a /home partition is that when you do a re-install or upgrade you can leave it as it is, saving all your personal settings, mail, addressbook etc.


The minimum number of partitions and their size are ( if you have 5G to spare and full install of modern distro ) :

3 G for /

1+ G for the /home partition

500 MB for the /swap ( more swap is waste )


( Sure you can do with a lot less, some distro's are happy with -500MB and still have X )


A more comfortable partition table is ( 10G to spare ):

5 G for /

4+ G for


500 MB for /swap


A "deluxe" and more complicated partition table is ( 15+ to spare ):

2 G for /

4 G for /usr

1 G for /var ( a lot of writing is done in the /var/log's )

500 MB for /swap

5+ G for /home

7+ G for /backup ( storage )


Any extra space could be added to /home and /backup.


B) Bruno


Thanks to LilBambi ;)


NOTE: An important note from Prelude76:

SuSE users should have a fairly large /opt partition, as this is where most 3rd party apps get installed.
Link to comment
Share on other sites

Guest LilBambi

Bravo Bruno!


Excellent outline of partition sizes. That certainly gives folks a great starting point and they can adjust percentage wise as needed for their specific needs.


BTW: df -h is my favorite one ... puts those sizes in to human easily readable format ;)


Great idea on putting an Index in the first posting for easy searching!

Link to comment
Share on other sites



Most of you are familiar with the Fat16, Fat32 and NTFS filesystem for windows. In linux we have Ext2, Ext3, Reiserfs and Xfs. The last 3 are journaled filesystems, in fact Ext3 is the same as Ext2 but only with a journal added. A journaled filesystem allows quicker recovery in case of system crash or power faillure.


Reiserfs and Xfs are very new systems partly still under development. I would advice the Ext3. You can easily convert Ext2 ( Linux native ) to Ext3 without re-format or re-install:

# tune2fs -j /dev/hda?

( where you replace the "?" with the number of the partition, see previous text about "partitions" )


After you have done this for all your partitions you'll have to change the entries in your /etc/fstab :

$ su
< password >
# mcedit /etc/fstab


Change the ext2 in ext3 for the partitions you converted ( sure you can use vi as editor too ! :) ) There you go ! Now you have a journaled filesystem.


B) Bruno

Link to comment
Share on other sites


( filesystem check )


Every 20 to 30 times you boot up your computer, after an improper shutdown or power-faillure, the system will perform a filesystem check.


In most cases no problem, however, sometimes in rare cases it may ask you if you want to repair inconsistencies; you press "y" and "Enter" a few times and it will proceed booting.


In some very rare cases it will tell you that you have to do a manual fsck and give you a prompt: ( Now you have to know what partition ( hda? ) was the critical one ! )

# fsck -p /dev/hda?

(replace the "?" with the number of the partition ) The "-p" stands for repair automatically.


# e2fsck -f /dev/hda?

(replace the "?" with the number of the partition ) e2fsck is a modern, more powerfull version of fsck. The "-f" option forces a more elaborate check.


Sometimes however the system tells you to do the check without the "-p" argument, this just means you will have to say "y" a lot of times ! :)


In some very, very rare cases an emergency console will come up, just do the above at the prompt and when done close the console with < Ctrl+d >, the system will continue booting.


If you get these errors often:

# e2fsck -c /dev/hda?

( This will mark bad blocks on your HD and no more data will be written in those blocks. )


( !!! fsck and e2fsck should only be performed on unmounted partitions !!!! )


In very, very, very rare cases a "Super-Block" might get damaged:

( First make some strong coffee ! :) )


A super-block is the first block of each ext2 or ext3 partition. It has important data about the file system, like size, free space, etc.


A partition with a damaged super-block cannot be mounted. But, ext2 and ext3 keep several super-block backup copies scattered over the partition.


Boot your system with a boot disk. ( I hope you did make one ! ) The location of the super-block backup copies depends on the block size of the file system.


For file systems with 1 KB block size it is at the beginning of each 8 KB (8192 bytes), for file systems with 2 KB sizes it is at the beginning of each 16 KB (16384 bytes) and so on.


You can use

# mke2fs -n /dev/hda?


to find out at which byte positions the super-block copies are. With a 1 KB block size, the first backup copy is in byte number 8193 ( 8192+1 ).


To restore the super-block from this copy, do

# e2fsck -b 8193 /dev/hda?


If that block also happens to be damaged, try the next one at byte number 16385, and so on until you find a good one.


Reboot to activate the changes.


B) Bruno

Link to comment
Share on other sites

( !!! fsck and e2fsck should only be performed on unmounted partitions !!!! )
:unsure: How do you do this, Bruno? Just when I think that I'm starting to grasp a few things, I see that it's like grasping water (to me). :( Hope you don't mind, but I'm printing out this entire thread; by Christmas it should be enough for a novelette. :unsure:
Link to comment
Share on other sites

Quint, no problem !In the cases mentioned above the partitions are not mounted yet ! The warning is just to let you know that once the system is finished booting and you are logged in, you might think: hey, let's open a console and try that filesystem-check stuff, to get used to the procedure, so that in case stuff goes bad I know what to do. See, that's a bad idea ! That was what I was warning for !:unsure: Bruno

Link to comment
Share on other sites

Quint, in addition to above:Printing is no bad idea, once your computer starts acting wierd you might be unable to read this on line !:unsure: Bruno

Link to comment
Share on other sites



There is a big chance your command prompt will look like this: [localhost.localdomain:~]$ , or if your computer is on a network or has a name: [localhost.vector:~]$. It's functional, but if you're like me you won't be happy with it.


You can customize the prompt into something short and fancy, like [bruno:~]$ , ( ~ stands for the current directory and will change as the directory you are in changes ) here is how to do it:


First backup the current prompt



If after tweaking you want the old one back



These are the codes we will use:

\u = username of current user

\w = current directory

\h = first part of the hostname

\H = the full hostname

\d = the current date

= the current time 24hrs format

\T = the current time 12hrs format

@ = @


Now we can edit the ".bashrc" file ( dot bashrc ):

$ vi /home/bruno/.bashrc


< i > ( insert mode )

Leave the first few lines as they are.

PS1="[\u:\w]$ " ( a space between the $ and " ) ( this will set the prompt like mine above )

< Esc >

< ZZ >

Close the console, open it again and you'll see the prompt has changed !


Some examples:

PS1="[\H:\w]$ " will give the old [localhost.localdomain:~]$

PS1="[\u:\d @\w]$ " will give [bruno: Tue Apr 29 19:04:59 @~]$

PS1="[ \u@\w]$ " will give [19:04:59 bruno@~]$


If all this was way to easy for you :) and you want something really different, with colors and shapes, have a look Here

More basic info Here


Your 'root' prompt will not be changed, this makes it even more easy to notice the difference between being root and current user !


B) Bruno

Link to comment
Share on other sites



As we are doing more and more commands at the bash-prompt it's time to learn a neat little trick:


As you are at an empty prompt press the "arrow-up" key and you will see the previous command you typed in !

Press again, and again, and again, see all the commands that were stored in the "bash-history"


As current user you will only see the commands you typed in, as root you will see the commands you typed in as root.


More fun, type in:

$ history

And you'll get a full numbered list of all stored commands


$ !8

Will get you number 8 of that list


$ !v

And you will get the last command that started with v


Ctrl+R will let you do a search in the history Bash history won't be lost at reboot or shutdown, clever isn't it ?


B) Bruno

Link to comment
Share on other sites



Keeping it simple: You know by now that < rm > removes a file, permanently !

Wouldn't it be nice if we could move it to the recycle bin with a simple command instead ?


We're gonna make that command and call it: < del >

( YES ! making our own commands ! :D )


First a little script:

$ vi /usr/bin/del


< i >

Here is the text for the script:

mv $1 ~/Desktop/Trash
#End script


< Esc >

< ZZ >


Make it executable

# chmod 0775 /usr/bin/del


Now if we do

$ del tessst

( It will execute the script and do the same as: )


$ mv tessst /home/bruno/Desktop/Trash


Sure this was a very short example, a 3 line script, it only holds one command, but you could put as many lines in the script as you want and execute it with a four letter word. :)

If there are more commands in the script it will execute them in the order that they are noted down.


Because /usr/bin is in your "path" you only have to type "del" to execute it.


If you have to do complicated commands in a certain order on a regular basis, make a little bash script, put it in your "path" and give it a name that's easy to remember.


Next time we'll make a simple backup script, to backup and gzip the contents of your /home directory.


More about bashscripts see: Introduction to bash Shell Scripting


B) Bruno

Link to comment
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 drakx to do this automated on a regular basis.


However we could also make a simple script: :)

$ su < password ># vi /usr/bin/backup

< i >

Now, this is the text in that script:

rm ~/backup.tar.gz  #( removes old backup if there is one )
tar -cvzf backup.tar.gz $BACKUP_DIRS
#end script

< Esc >

< ZZ >


Make it executable:

# chmod 0755 /usr/bin/backup


And a script to restore the backup:

# vi /usr/bin/restore


< i >


The text in the script:

#end script

< Esc >

< ZZ >


Make it executable:

# chmod 0755 /usr/bin/restore

< Ctrl+d > ( return to normal user )


Right, that's it, we have made two scripts!

Now if we type backup at the prompt it will create a tar.gz file in your home directory.

And restore will restore the backuped files.

Remember before making your next backup to delete the old one first !


B) Bruno

Link to comment
Share on other sites



The mail configuration file of the Gkrellm system monitors ( giga cool ! ) could give you a major headache, particularly with the sound notification.


It's surprisingly simple though.


On the setup tab of the mail section:

- Mail reading program = evolution ( or whatever program you prefer )

- Notify ( sound ) program = /usr/bin/play /home/bruno/sounds/newmail.wav ( needles to say: the path to your soundfile is up to you ) If "/usr/bin/play" gives problems you can use "/usr/bin/artsplay" too.

- Check local mailboxes = 300 sec - Do remote checks every = 2 minutes


On the mailboxes tab:

- Select "remote mailbox" and you can fill in the pop server, username and password. Press add and do the next one if you've got more then one mail address to be checked.


The rest of the tabs won't give you any problems.


Now sit back and wait for the mail to arrive !


B) Bruno

Link to comment
Share on other sites



Lot's of people complain about the ugly fonts in the OpenOffice.org menu's.

They don't bother me, but then . . . . . . I changed them B)


Here is how to do it:

Go to --> Tools --> Options --> OpenOffice.org --> Font replacement

Click on "Andale Sans UI" and you will see "Andale Sans UI" appear in the "Font" box, in the "Replace" box choose "Helvetica" and apply.


No more squinting eyes !


B) Bruno

Link to comment
Share on other sites

This topic is now closed to further replies.

  • Create New...