Jump to content


Tips for Linux Explorers


  • This topic is locked This topic is locked
375 replies to this topic

#351 OFFLINE   Bruno

Bruno

    Le Professeur Pingouin

  • Admin Emeritus
  • 37,904 posts

Posted 11 September 2006 - 01:39 PM

KDESU and GKSUThe official line for "kdesu" and "gksu" is: "Runs a program with elevated privileges" . . . Now, in real life what does this mean ? Let me have a go at it.Imagine there is a program or tool you want to run as "root", if this is a command line tool we already know we have to do "su" ( or "sudo" in case of Ubuntu ). But if it is a GUI tool you want to run as root, and you simply do "su" and start the program from the command line there is a big chance you will be presented a screen full of errors ( or even worse get the Xlib Error ). In these kind of situations the "kdesu" ( for KDE ) and the "gksu" ( for Gnome ) are the ticket.Here is an example, you are running KDE and you want to open a file in Kedit because you want to have an easy way to edit the ( /etc/X11/xorg.conf ) file as root, what you do is give the following command as user:
$ kdesu kedit /etc/X11/xorg.conf
The "kedit /etc/X11/xorg.conf" part of the command is for opening the file in Kedit, but the "kdesu" that precedes that command triggers a box to pop up where you are asked to give the root-password. After you give the password Kedit will open with the file loaded and you can edit it ( as if you were root ).The same story goes for the "gksu" command if you are a Gnome user. It avoids error messages and allows you to run any GUI based tool as root without actually having to log out as "user" and log in as "root". . . .  Using kdesu and gksu is a much safer practice.Keep your system safe.:thumbsdown: BrunoPS: In some distros "gksu" is replaced by "gnomesu" or "gtksu"

#352 OFFLINE   Bruno

Bruno

    Le Professeur Pingouin

  • Admin Emeritus
  • 37,904 posts

Posted 19 September 2006 - 01:21 PM

NO CAPSLOCK !Does this happen to you ? Ever had the urge to violently remove the Cap Lock key from your keyboard because you accidentally kept hitting it ? Relax, I think we have a solution for this problem.Linux offers you an effective way to disable Caps lock and if you want you can even add a new function to that key.Basically the command to disable the Caps Lock key ( for the current session only ) would be:
$ xmodmap -e "remove Lock = Caps_Lock"
Now, there are a few ways to make this permanent, just pick the one that works best for you: 1). Add remove Lock = Caps_Lock to the /etc/X11/Xmodmap or the ~/.xmodmaprc  file ( But in my  Mandriva this did not help so see the next option )2). Make a bash script called nocapslock with the text:

Quote

#!/bin/bashxmodmap -e "remove Lock = Caps_Lock"#End script
And make the file executable with
$ chmod 755 nocapslock
Finally if you run KDE place the script in /home/bruno/.kde/Autostart, if you run Gnome you can make a directory /usr/share/gnome/autostart and place the script in there and at next login you get a dialog that will ask you if you want to enable the script for future logins in Gnome.This should take care of disabling the Caps Lock key. But that is not all you can do, you could even give the Caps Lock key another function ( make it another Enter-key with "keycode 66 = Return" ) or even swap the Ctrl key with the Caps Lock key with the following script:

Quote

#!/bin/bashremove Lock = Caps_Lockremove Control = Control_Lkeysym Control_L = Caps_Lockkeysym Caps_Lock = Control_Ladd Lock = Caps_Lockadd Control = Control_L#End script
Have a look in "man xmodmap" and get creative with your keyboard.:happyroll: Bruno

#353 OFFLINE   Bruno

Bruno

    Le Professeur Pingouin

  • Admin Emeritus
  • 37,904 posts

Posted 03 October 2006 - 01:50 PM

COUNTING WORDS The "wc" commandThere are people that love to count beans, myself at the end of the day I love to count the words I have written. <g>And sure, Linux has just the command for that: "wc"The "wc"command comes with a few options:

Quote

-c, print the byte counts-m, print the character counts-l, print the new line counts-L, print the length of the longest line-w, print the word counts
When I execute the command on this little bit of text I am typing right now I get:Words:
$ wc -w test.txt184 Desktop/text.txt
Lines:
$ wc -l test.txt50 Desktop/text.txt
Characters:
$ wc -m test.txt1045 Desktop/text.txt
Longest line:
$ wc -L test.txt118 Desktop/text.txt
Sure you can feed the "wc" command more then one file in a different format at once:
$ wc -w test.txt xgl.doc NewTips.txt post.kwd 184 test.txt 280 xgl.doc 209 NewTips.txt1161 post.kwd1834 total
And here is one to try at home . . . . cd to your Documents folder and do "wc -w *.odt" ( or "wc -w *.doc" if that is your preferred format )Isn't that fun . . . . . . at least you get the impression you weren't all that lazy after all  . . . . ;)B) Bruno

#354 OFFLINE   Bruno

Bruno

    Le Professeur Pingouin

  • Admin Emeritus
  • 37,904 posts

Posted 17 October 2006 - 02:46 PM

RPM: SPECIAL TRICKSThere is a lot more to the rpm command then you might suspect on first sight. What I want to do in this tip is to cherry pick some real nice nuggets from the endless list of options.You probably already know the most basic way to install/upgrade an RPM package:Installing:
# rpm -ivh amarok-1.4.1-4mdk.i586.rpm
Upgrading:
# rpm -Uvh amarok-1.4.1-4mdk.i586.rpm
Removing:
# rpm -e amarok
But now for the special tricks, did you know you can also let the rpm command download and install the file for you ? ( works on http and ftp )
# rpm -ivh http://kev.coolcavemen.com/static/repository/mandriva/2006.0/RPMS/amarok-1.4.1-4mdk.i586.rpm
And that you can downgrade the package you installed ( because the new one has a bug ? ):
# rpm -Uvh --oldpackage amarok-1.3.1-3mdk.i586.rpm
You can get detailed information on the package before installing it:
# rpm -qip amarok-1.4.1-4mdk.i586.rpm
This even works on a file you did not yet download:
# rpm -qip http://kev.coolcavemen.com/static/repository/mandriva/2006.0/RPMS/amarok-1.4.1-4mdk.i586.rpm
Also, you can get a complete list of all the files a package will install:
# rpm -qlp amarok-1.4.1-4mdk.i586.rpm
And sure this works on a file you have not yet download too:
# rpm -qlp http://kev.coolcavemen.com/static/repository/mandriva/2006.0/RPMS/amarok-1.4.1-4mdk.i586.rpm
Now 4 commands to get some info on packages that are already installed . . . first put a complete listing in your /home:
# rpm -qa | sort -f > installed_rpms.txt
( Note: There is a nice Tip at Distrowatch showing how to get a package list in other distros )Here is how you get info on a single package:
# rpm -qi amarok
And a full list of the files belonging to an installed package:
# rpm -ql amarok
Finally if you are curious what package installed a file you found on your computer:
# rpm -qf /usr/share/apps/zeroconf/_shoutcast._tcp
Well, you'll have to admit, the rpm command is pretty versatile  . . . . and there is more, just have a look at "man rpm" and you will see there is at least a hundred different options listed.:P Bruno

#355 OFFLINE   Bruno

Bruno

    Le Professeur Pingouin

  • Admin Emeritus
  • 37,904 posts

Posted 21 October 2006 - 12:55 PM

* Due to limitations of the forum software this how-to is split over 2 postsINSTALLING MANDRIVA 2007( General instructions )Please first read the erratum: http://qa.mandriva.com//twiki/bin/view/Main/MandrivaLinux2007Errata- PreparationIf this is your first Linux install, check out Basic Rules for InstallIf you are replacing a previous Mandrake Install back up:- Your browser plugins located in /usr/lib/mozilla/plugins- The ~/.evolution directory ( When I restore it, I chown (change ownership) it back to "chown -R bruno:bruno evolution" )- The ~/.galeon/bookmarks.xml ( or other bookmarks )- Personal things in your /home directory- Your /etc/lilo.conf ( if you are booting mutiple distros )- Your /etc/hosts, /etc/aliases, /etc/sensors.conf, /etc/rc.d/rc.local, ~/.bashrc, ~/.exrc if you made any modification to these files.- Your /usr/local/bin if it holds any of your custom scripts.- Set your BIOS to boot from CD and disable PNP aware OS.- Put the first CD in the CD-ROM drive and boot your computer.- Install1st screen: The welcome screenSelect "Installation" with your arrow keys and Press EnterBefore the GUI comes back, the installer is loading into memory and devices are being configured.2nd screen: Language selectionPosted Image  <------- Click to enlargeThe default is US English, Press Next3rd screen: License agreementPosted Image  <------- Click to enlargeSelect "accept" and Press Next4th screen: Is this an install or an upgrade ?Posted Image  <------- Click to enlargeTick the box of "install" and Press Next. Advice: NEVER use Upgrade !!!5th screen: Security levelPosted Image  <------- Click to enlargeATTENTION: By default the security level is set to "high", change this to "Standard"Fill in "root" or your email address and Press Next6th screen: The DrakX Partitioning wizard found etc. etc.Posted Image  <------- Click to enlarge- If you have your partitions already made: tick the box "use existing partitions" and Press Next- If you still have to make partitions, or want to change the size of the existing ones: tick the box "Custom Disk Partitioning" and Press Next You will be taken to the very intuitive and easy partitioning tool. Make a 6G partition for / and a 2G for /home.7th screen: Choose file Mount pointsPosted Image  <------- Click to enlargeChose the partitions where you want / and /home and Press Next( Everybody using partitions for /tmp and /usr too . . you know what to do )8th screen: Choose the partitions you want to formatPosted Image  <------- Click to enlarge. . Leave the /home box unchecked if you want to keep your mail addresses and personal settings Press Next9th screen: Installation mediaPosted Image  <------- Click to enlargeHere you are asked to check the installation media ( CDs, DVD ) only check those you have and Press Next10th screen: Packageshttp://brunolinux.net/Images/INSTALL_2007/2007-DRAKX-screenshots/7.png  <------- Click to enlargeDo like in the screen shot: tick all the boxes on the left, KDE and Gnome on the right and Press NextNOTE: Including Gnome will also give you all the gnome programs you can also use in KDE . . so even if you intend to never use Gnome it is better to install it anyway.Now the install really starts. It takes about 16 minutes and you have to change CDs a few times* Will be continued in next post . . . . . .

#356 OFFLINE   Bruno

Bruno

    Le Professeur Pingouin

  • Admin Emeritus
  • 37,904 posts

Posted 21 October 2006 - 01:14 PM

11th screen: Root passwordPosted Image  <------- Click to enlargeFill in your root password twice and Press Next12th screen: Adding a userPosted Image  <------- Click to enlargeFill in name twice and password twice and Press Accept user13th screen: Adding a user ( again )Posted Image  <------- Click to enlargeHere you can add another user, or leave it empty and Press Next14th screen: Auto loginPosted Image  <------- Click to enlargeDe-select the box, you do not want this, and Press NextNOTE: It is safer to not use this feature, and it makes sure that you can choose at boot what window manager to start. Also if you ever get a corrupted /home directory the non-autologin makes fixing a lot easier.15th screen: Boot loaderPosted Image  <------- Click to enlargeSelect "First sector of drive ( MBR )" and Press NextNOTE: It will automatically include your Windows partition for dual boot16th screen: SummaryThis is very important . . check all the settings by clicking on the Configure button, look at the difference I have in the two screenshots:Posted Image  <------- Click to enlargeBefore configuringPosted Image  <------- Click to enlargeAfter configuringNOTE: While configuring the Graphic interface you can be pesented this sreeen:Posted Image  <------- Click to enlargeIf you don't have a recent model Graphics card it is safer to uncheck "Enable translucency" and "Use hardware accelerated mouse pointer"( You could experiment with these settings any time after the install by running XFdrake )17th screen: UpdatesNOTE: This feature rarely works, you will have to do the updates in the MCC after the first reboot.So . . . say NO and Press Next18th screen: Complete. . remove your CD and Press Reboot- After the install:After the reboot you absolutely have to install: "anacron", and get the Updates ( see and subscribe to This thread )Additionally you can add: xmms, xmms-alsa, aumix, galeon, gkrellm, kedit, mplayer, xine etc. etc.NOTES: Here are a few quick bug-fixes.1). Fix LinDVD error:
# cp /usr/share/lindvd/libivimandriva.so /usr/lib/# ldconfig
2). KDE menu, errormessage when choosing "System" --> "Configuration" --> "Packaging" --> "Install, Remove and Update Software"The fix: Start up the menueditor and change the command in the relevant menu entry from "/usr/bin/drakconf --start-with=install-software" to "rpmdrake --root"3). Updatedb errorThe fix: Install mlocate ( will replace slocate )4). Problems with k3b when trying to burn a dvd iso. It is a conflict with available memory and growisofs v6.0The fix: Give the command "# ulimit -l unlimited" as root prior to starting k3b (as root) to burn dvd's.Also read the release notes: HereHave FUN !;) Bruno

#357 OFFLINE   Bruno

Bruno

    Le Professeur Pingouin

  • Admin Emeritus
  • 37,904 posts

Posted 31 October 2006 - 02:22 PM

INSTALLING FEDORA CORE 6( Short instructions )Please first read the releasenotes: RELEASE-NOTES-en_US.html- Install1st screen: The welcome screen Press Enter2nd screen: Install or UpgradeMy choice was "Install Fedora Core", Press Next3rd screen: PartitionsPosted Image  <------- Click to enlargeIf you are using existing partitions, do as in the screenshot and change the box to "Create custom layout" and Press Next4th screen: The partition toolPosted Image  <------- Click to enlargeHighlight the partition you want to use and click the Edit button and you will see:Posted Image  <------- Click to enlargeIn the pop-up select the mount point ( / ) and check the box to format the partition, then Press OK5th screen: BootloaderPosted Image  <------- Click to enlargeATTENTION: If you want to add fedora to the bootloader of another distro, please install the fedora grub in the / partition: check the box "Configure advanced bootloader options" and Press NextIf you want to use the Fedora bootloader the default settings are fine.6th screen: Install the bootloader record onIn case you did choose "Configure advanced bootloader options" in the 5th screen you get:Posted Image  <------- Click to enlargeHere you can check the box that will install the grub bootloader of Fedora in the / partition ( in the example above it is /dev/hda11 ) . .  this way you can easily add it to the to the bootloader of the distro you are currently using. Press Next7th screen: Network DevicesPosted Image  <------- Click to enlargeIf you use DHCP . . . accept the default and Press Next8th screen: LocationPosted Image  <------- Click to enlargeThis is where I live  . . . . Change yours to suit your location and Press Next9th screen: The Root PasswordPosted Image  <------- Click to enlargeType in the root password twice and Press Next10th screen: Packageshttp://brunolinux.net/Images/fedora-6-screenshots/screenshot-0011.png  <------- Click to enlargeDo like in the screen shot, "Office and Productivity" is checked by default, choose  "Software development" as well and Press NextNOTE: If you want KDE, check the box "Customize now" and in the next screen you can check the box for KDENOTE 2: When choosing "Fedora Extras" you need a fast broadband connection because it will download a lot of files from the FTP server and this might be a major increase of the time your install will take.11th screen:  Now the install really starts.http://brunolinux.net/Images/fedora-6-screenshots/screenshot-0012.png  <------- Click to enlarge. . . when finished you have to reboot and after rebooting you will get Stage 2 of the install where it will let you create a user with user password.Have FUN !:hysterical: Bruno

#358 OFFLINE   Bruno

Bruno

    Le Professeur Pingouin

  • Admin Emeritus
  • 37,904 posts

Posted 14 November 2006 - 02:20 PM

CHANGE YOUR SHELLThere was a question on the forum: "How do I change shell ?" . . .  And the answer is simple, but let me first tell you something about shells.The default shell for most distros is the bash shell ( see Bash ), but there are more shells available, just type the following command and the ones for your distro will be listed:
$ chsh -l
This commands will show you the shells that are mentioned in the /etc/shells file.On my distro the above command will show:

Quote

/bin/bash/bin/csh/bin/ksh/bin/sh/bin/tcsh
Now imagine I would want to switch to the /bin/sh shell, I can do that just for the session or permanently:1). For temporary changing the shell you just give the command:
$ /bin/sh
and you will see the prompt changing to a different one ( again, on my system it shows: "sh-3.00$" ).You can change it back by simply giving the command:
$ /bin/bash
2). For permanently changing the shell you can use the "chsh" command:
$ chsh -s /bin/sh
You will be prompted for a password and for confirmation it will show you for what user you are changing the shell.Now, that was an easy one, wasn't it ?:P BrunoA note from finotti on the forum: In some systems (using NIS) you might have to use:
$ ypchsh <user>
and answer the questions.

#359 OFFLINE   Bruno

Bruno

    Le Professeur Pingouin

  • Admin Emeritus
  • 37,904 posts

Posted 21 November 2006 - 05:58 PM

URPMI SOURCES MANDRIVA 2007Here are the extra sources you can add to the package manager of Mandriva 2007 in order to get extra software. Most everybody can add, but a few ( the last 3 ) are only for Mandiva Club Members.Please take a serious note of the following:1). Only have the Main, Contrib and Update source active all the time. And only if you can not find the software you are looking for, activate the additional sources in the MCC - but remember to de-activate them immedeately after installing the package !2). Because sources need updating do a regular "# urpmi.update -a"3). If you are on dialup you can replace the "hdlist.cz" in the code with "synthesis.hdlist.cz" this means you will get a condensed list with less details in the description of the packages . . but you'll get it faster.4). "# urpmq --list-media active" will list the "active" sources.[/color]Here they are: ( Dont click on the links but paste them in a root-terminal ) YOU HAVE TO BE ON LINE !All commands are ONE line.- STANDARDMain:
# urpmi.addmedia --wget "2007_main.release" ftp://ftp.nluug.nl/pub/os/Linux/distr/Mandrakelinux/official/2007.0/i586/media/main/release/ with ./media_info/hdlist.cz
Contrib:
# urpmi.addmedia --wget "2007_contrib.release" ftp://ftp.nluug.nl/pub/os/Linux/distr/Mandrakelinux/official/2007.0/i586/media/contrib/release/ with ./media_info/hdlist.cz
- BACKPORTS ( Warning: Only use with great care, can lead to dependency problems ! ) Main Backports:
# urpmi.addmedia --wget "2007_main.backports" ftp://ftp.nluug.nl/pub/os/Linux/distr/Mandrakelinux/official/2007.0/i586/media/main/backports/ with ./media_info/hdlist.cz
Contrib Backports:
# urpmi.addmedia --wget "2007_contrib.backports" ftp://ftp.nluug.nl/pub/os/Linux/distr/Mandrakelinux/official/2007.0/i586/media/contrib/backports/ with ./media_info/hdlist.cz
- TESTING ( Warning: Only use with great care, can lead to dependency problems ! ) Main Testing:
# urpmi.addmedia --wget "2007_main.testing" ftp://ftp.nluug.nl/pub/os/Linux/distr/Mandriva/official/2007.0/i586/media/main/testing/ with ./media_info/hdlist.cz
Contrib Testing:
# urpmi.addmedia --wget "2007_contrib.testing" ftp://ftp.nluug.nl/pub/os/Linux/distr/Mandriva/official/2007.0/i586/media/contrib/testing/ with ./media_info/hdlist.cz
- PLFPLF Free: ( Needs the Contrib source )
# urpmi.addmedia --wget "plf-free" ftp://ftp.free.fr/pub/Distributions_Linux/plf/mandrake/2007.0/free/release/binary/i586 with hdlist.cz
PLF Non-Free: ( Free to download and use, non-free as in licence ) ( Needs the Contrib source )
# urpmi.addmedia --wget "plf-nonfree" ftp://ftp.free.fr/pub/Distributions_Linux/plf/mandrake/2007.0/non-free/release/binary/i586 with hdlist.cz
- PLF BACKPORTS ( Warning: Only use with great care, can lead to dependency problems ! ) PLF Free Backports:
# urpmi.addmedia --wget "plf-free-Backports" ftp://ftp.free.fr/pub/Distributions_Linux/plf/mandrake/2007.0/free/backports/binary/i586 with hdlist.cz
PLF Non-Free Backports:
# urpmi.addmedia --wget "plf-nonfree-Backports" ftp://ftp.free.fr/pub/Distributions_Linux/plf/mandrake/2007.0/non-free/backports/binary/i586 with hdlist.cz
- EXTRAMandrivaClub-NL:
# urpmi.addmedia --wget "MandrivaClub.NL" ftp://ftp.nluug.nl/pub/os/Linux/distr/mandrakeclubnl/2007/i586 with hdlist.cz
Eslrahc:
# urpmi.addmedia --wget "charles-edwards" http://www.eslrahc.com/2007.0/ with hdlist.cz
MandrivaUser-DE:
# urpmi.addmedia --wget "MandrivaUser.de" ftp://ftp.mandrivauser.de/rpm/GPL/2007/RPMS with hdlist.cz
SeerOfSouls:  ( Warning: Only use with great care, can lead to dependency problems ! )
# urpmi.addmedia --wget seerofsouls http://seerofsouls.com/mandriva/2007/i586/main/ with hdlist.cz
Thac: ( Warning: Only use with great care, can lead to dependency problems ! )
# urpmi.addmedia --wget Thac http://anorien.csc.warwick.ac.uk/mirrors/thac//2007.0/RPMS with hdlist.cz
- CLUB >>> Only Mandriva Club-Members Club Commercial:
# urpmi.addmedia --wget "club.commercial_x86-32_2007" https://bruno%40forum.com:PASSWORD@dl.mandriva.com/rpm/comm/2007.0/i586/ with hdlist.cz
( Do not forget to replace "bruno%40forum.com:PASSWORD" which are the login: <bruno@forum.com> and the <password> for the club . . the @ in your email address is replaced by a %40 )*** Club Testing:
# urpmi.addmedia --wget "club.testing_x86-32_2007" https://bruno%40forum.com:PASSWORD@dl.mandriva.com/rpm/test/2007.0/i586/ with hdlist.cz
( Do not forget to replace "bruno%40forum.com:PASSWORD" which are the login: <bruno@forum.com> and the <password> for the club . . the @ in your email address is replaced by a %40 )*** Club Club:
# urpmi.addmedia --wget "club.club_x86-32_2007" https://bruno%40forum.com:PASSWORD@dl.mandriva.com/rpm/club/2007.0/i586/ with hdlist.cz
( Do not forget to replace "bruno%40forum.com:PASSWORD" which are the login: <bruno@forum.com> and the <password> for the club . . the @ in your email address is replaced by a %40 )NOTE 2: The sources marked *** are not yet available !:( Bruno

#360 OFFLINE   Bruno

Bruno

    Le Professeur Pingouin

  • Admin Emeritus
  • 37,904 posts

Posted 05 December 2006 - 02:40 PM

UBUNTU RESCUE MODEAlmost every distro has its own way to enter "rescue-mode", a text terminal where you have root permissions and can give the badly needed commands to save your install or restore the access to the GUI environment.There are 2 ways to enter "rescue-mode" in Ubuntu ( Kubuntu, Xubuntu ):1). The easiest one is to choose:

Quote

Ubuntu, kernel 2.6.XX-XX-XXX (recovery mode)
from the boot menu.If the boot menu is hidden, simply press the Esc key to make it show up.2). The other way is to use the installation CD, and at the very first screen, at the "boot:" prompt type "rescue" and next follow the instructions that are given.o:) BrunoYou can find a lot of helpful Ubuntu info in the Ubuntu Starter Guide

#361 OFFLINE   Bruno

Bruno

    Le Professeur Pingouin

  • Admin Emeritus
  • 37,904 posts

Posted 16 January 2007 - 02:09 PM

NUMLOCK in XFCE, IceWM and FLUXBOXIf you are using another window manager other than KDE or Gnome and you want to have numlock set at login, this tip is for you.What you need is "numlockX" . . . a tar.gz package . . .  http://ktown.kde.org/~seli/numlockx/  This little program allows you to start X with NumLock turned on WARNING: - From the README -Make sure this package isn't already included in your distribution ( e.g. Mandrake includes it ). If you distribution already includes NumLockX, use their package instead ( it needn't be necessarily called NumLockX, it may be e.g. part of some other package ). KDE and Gnome already include an application to set the numlock so don't install this package, you will have other ways to set numlock in the preferences.Here is what you do:
$ tar -xvzf numlockx-1.1.tar.gz$ cd numlockx-1.1$  ./configure$  make$ su<password>#  make install#  make xsetup#  make xinitrc
Next if you use the xfce window manager, edit the "/etc/X11/xinit/xinitrc.xfce4" file and put somewhere near the top of the file as first un-commented line:

Quote

/usr/X11R6/bin/numlockx on
then save the file, restart X and the numlock will be on.  :DThere are files for each window manager in "/etc/X11/xinit/"  so if you use IceWM of Fluxbox you can edit those files the same as the xinitrc.xfce4.After this tweak you can get your numbers right . . . have fun !;) Bruno

#362 OFFLINE   Bruno

Bruno

    Le Professeur Pingouin

  • Admin Emeritus
  • 37,904 posts

Posted 30 January 2007 - 02:27 PM

NUMLOCK IN TEXT-MODEThere are people, like myself, that absolutely want numlock enabled in every instance when the computer is booted. ( Maybe because their password has numbers ? )In KDE and Gnome there are settings for numlock in the control, but they only kick in as soon as you start the window manager. ( for other window managers like XFCE, IceWM or Fluxbox see Here )So, imagine you want numlock enabled in text-mode ( without X ). Basically the trick is pretty simple: you need a little script that starts in runlevel 1 and every level above.That way even when you do Ctrl+Alt+F1 or even in single user mode you will have numlock enabled.There are two ways to achieve your goal: 1). Either add these lines at the bottom of the /etc/rc.local file:

Quote

for tty in /dev/tty[1-9]*; dosetleds -D +num < $ttydone
Note, the same file is called differently in several distributions:Fedora: /etc/rc.localSlackware: /etc/rc.d/rc.localSUSE: /etc/init.d/boot.localMandriva: /etc/rc.localPCLos: /etc/rc.local2). Or, if your distro has no rc.local file you can place the next script in /etc/init.d:

Quote

#!/bin/bashfor tty in /dev/tty[1-9]*; dosetleds -D +num < $ttydone #End script
and link it to the /etc/rc.d/<runlevels> like described in  Init ( Startup Scripts )Now, if you type your password you can be sure that the numbers match.:thumbsup: Bruno

#363 OFFLINE   Bruno

Bruno

    Le Professeur Pingouin

  • Admin Emeritus
  • 37,904 posts

Posted 27 February 2007 - 02:22 PM

REMOVING VISTA FROM YOUR BOOT OPTIONSHere is a tip from our ever restless OS hopping Julia ( aka teacher ):

Julia, on Forum 2006, said:

You have been dual or triple booting with Vista as one of your options.  Now you want to go and dump Vista from your boot menu yet it is not listed in Lilo.  How do you do it?1. You need to install Vista Boot Pro http://www.pro-netwo...otpro/index.php  It will allow you to remove the boot configuration.  You can do it from within Vista or from another version of Windows.  I used it from XP.  Here is what I did:2. Run Vista BootPro.  You will then see a window that looks like this: . . . . Posted Image 3. Click on Manage Entries.  Then select the version of Vista you wish to remove.  Click on the delete icon.  Then press Save.  When finished look for the Configure Tab.4. Click on Configure.  At the top tell it your default "Windows" operating system. Then press save.   At the bottom you may then click on that same operating system and change the name to what you want to call it.  Do not, however, change the drive letter.  Then click save.5. Exit out of Vista Boot Loader.  When you reboot you will find that your Lilo is unchanged but now your windows entry will only lead to one entry rather than a second menu to give you options.
Thanks teach, I will not be needing this myself but I am sure there will be penguins who do.B) Bruno

#364 OFFLINE   Bruno

Bruno

    Le Professeur Pingouin

  • Admin Emeritus
  • 37,904 posts

Posted 26 March 2007 - 05:08 PM

SUID, STICKY and CHATTR ( Advanced permissions )There are some very special and advanced file permissions: the SUID/SGID Flag, the Sticky Bit and Change Attribute. In this Tip I will give a brief description.The "SUID flag" ( Allow user ID access ) This mode gives normal users permission to execute files they normally would not be allowed to:
# chmod u+s testfile
If you use chmod with numbers the number for SUID is 4000.An example what "ls -l" will show:

Quote

-rwsr-xr-x  1 root root 0 Sep 20 20:40 testfile*
The "SGID flag" ( Allow group ID access ).  Same as SUID but then for groups:
# chmod g+s testfile
If you use chmod with numbers the number for SGID is 2000.An example what "ls -l" will show:

Quote

-rwxr-sr-x  1 root root 0 Sep 20 20:40 testfile*
NOTE: There are security issues with the SUID and SGID flags so only use it when absolutely needed.The "Sticky Bit" ( Only the user that created the file, in the directory with the Sticky Bit, can delete it ):
# chmod +t testdirectory
If you use chmod with numbers the number for the Stick Bit is 1000.An example what "ls -l" will show:

Quote

drwxr-xr-t   2 root  root     4096 Sep 20 20:44 testdirectory/
A quote from the man page:

man chmod said:

STICKY FILESOn older Unix systems, the sticky bit caused executable files to be hoarded in swap space. This feature is not useful on modern VM systems, and the Linux kernel ignores the sticky bit on files. Other kernels may use the sticky bit on files for system-defined purposes. On some systems, only the superuser can set the sticky bit on files. STICKY DIRECTORIESWhen the sticky bit is set on a directory, files in that directory may be unlinked or renamed only by root or their owner. Without the sticky bit, anyone able to write to the directory can delete or rename files. The sticky bit is commonly found on directories, such as /tmp, that are world-writable.
And finally "chattr" ( Change file attribute ) has many options, one of them is "i", the immutable flag, meaning nobody, even root, can make changes to a file:
# chattr +i testfile
In this case "ls -l" will show nothing special:

Quote

-rwxr-xr-x  1 root root 0 Sep 20 20:40 testfile*
But related to the chattr command is "lsattr" it lists attributes set for a file:
# lsattr testfile
An example of what "lsattr" will show:

Quote

----i-------- testfile
To remove the immutable flag simply do "chattr -i"See "man chattr" for more options of the chattr command.There you go, this all makes part of the complex file permissions system that keeps a Linux box safe and secure.B) Bruno

#365 OFFLINE   Bruno

Bruno

    Le Professeur Pingouin

  • Admin Emeritus
  • 37,904 posts

Posted 24 April 2007 - 01:26 PM

THE DD COMMANDThis is one of the more complex Linux commands and actually not really suited for new Linux users. But still I would like to give you a little taste of it.The dd command copies an amount of data block by block. The most basic syntax is:
# dd if=xxxxx of=yyyyy bs=zzzzzz
( Where if=xxxxx is the source, of=yyyyy is the target and bs= both read and write zzzzz bytes at a time )But as you might have guessed, the dd command it is much more than that, it can optionally convert data ( ASCII to EBCDIC ), skip blocks, continue after read errors, change uppercase letters to lowercase, etc, etc. ( type "info dd" in a terminal to get the full list of options )I will now give you a few examples of what dd can do, but I do urge you to have a look at the links posted below to get more detailed information before you really start experimenting with the dd command.Copy a hard disk partition to another hard disk:
# dd if=/dev/hda2 of=/dev/hdb2 bs=4096 conv=notrunc,noerror
Cloning an entire hard disk:
# dd if=/dev/hda of=/dev/hdb conv=notrunc,noerror
Copy a disk partition to a file on a different partition. ( Do not copy a partition to the same partition ! ):
# dd if=/dev/hdb2 of=/home/bruno/partition.image bs=4096 conv=notrunc,noerror
Restore a disk partition from an image file:
# dd if=/home/bruno/partition.image of=/dev/hdb2 bs=4096 conv=notrunc,noerror
Copy MBR only of a hard drive:
# dd if=/dev/hda of=/home/bruno/MBR.image bs=446 count=1
Reverse:
# dd if=/home/bruno/MBR.image of=/dev/hda bs=446 count=1
Wipe a hard drive of all data ( you would want to boot from a cd to do this ):
# dd if=/dev/zero of=/dev/hda conv=notrunc
Make an iso image of a CD:
# dd if=/dev/hdc of=/home/bruno/TEST.iso bs=2048 conv=notrunc
( CD sectors are 2048 bytes, so this copies sector for sector. )Copy a floppy disk:
# dd if=/dev/fd0 of=/home/bruno/floppy.image conv=notrunc
You can back up your MBR ( including partition table ):
# dd if=/dev/hda of=mbr.bin count=1
Put this on a floppy you make with:
# dd if=boot.img of=/dev/fd0
Boot from the floppy and restore the MBR:
# dd if=mbr.bin of=/dev/hda count=1
Again, I urge you to be very careful with the DD command . . . switching if= with of= can have catastrophic results.An extensive how-to of the dd command can be found here: Learn The DD Command Please read it before you start typing "dd" !!More info: Codecoffee and here: Tuxbrothers ( second section is in English ):hmm: Bruno

#366 OFFLINE   Bruno

Bruno

    Le Professeur Pingouin

  • Admin Emeritus
  • 37,904 posts

Posted 22 May 2007 - 02:19 AM

MULTI-BOOT GRUB ( "Chainloading" )Imagine you want to use the Grub of your favorite distro to include the options to boot all the other distros you want to install ( or already have installed ) on your computer.The trick is, that if you have all boot loaders ( except the one from your favorite distro ) installed in the / partition of the distros they belong to, you can use "chainloading":  You will only need to add 3 lines in the /boot/grub/menu.lst ( of your favorite distro ), using an example of Fedora on partition hda13:

Quote

title FedoraCore6root (hd0,12)chainloader +1
This way ( and this is very important ) if the Fedora kernel gets upgraded during an ( automatic ) update process you will automatically boot the new installed kernel even when using the Grub bootloader that lives in the MBR.You can chainload as many distros as you like, here are a few more examples taken from a forum post to Urmas who has PCLos, Mandriva, OpenSUSE and Slackware booting from his Ubuntu Grub:

Quote

# for PCLos on hda5title PCLos-92root (hd0,4)chainloader +1# for mandriva on hda7title Mandriva-2007root (hd0,6)chainloader +1# for SUSE on hda9title OpenSUSE-102root (hd0,8)chainloader +1# for Slackware on hda11title Slackware-11root (hd0,10)chainloader +1
NOTE: For the way Grub numbers the partitions please read: Grub, The Bootloader:thumbsup: Bruno

#367 OFFLINE   Bruno

Bruno

    Le Professeur Pingouin

  • Admin Emeritus
  • 37,904 posts

Posted 05 June 2007 - 01:22 PM

BOOTING IN RUNLEVEL 3 ( With Grub )There are occasions you want to boot in non-graphical mode ( in runlevel 3 ) for troubleshooting because the system fails to boot the usual way, X fails to start or some module it fails to load.Here is how you do it when Grub is your boot loader:At the grub boot menu press the E key. Next select the distro you want to boot and press the E key again. Now select the line with "kernel /boot/vmlinuz" and hit the E key one more time. Now type a space and the number 3 at the end of that line, so for example from:

Quote

kernel /boot/vmlinuz-2.6.17 ro root=/dev/hda6
to:

Quote

kernel /boot/vmlinuz-2.6.17 ro root=/dev/hda6 3
Finally press the B key and your distro will boot in runlevel 3NOTE: Runlevel 3 does not work in Ubuntu  . . . . use the "rescue mode" you see in the Ubuntu boot menu.NOTE 2: In recent Mandriva versions Grub has a graphical menu where you can press F2 to edit boot options . . . simply add the number 3 and press the Enter key to boot in runlevel 3.:hysterical: Bruno

#368 OFFLINE   Bruno

Bruno

    Le Professeur Pingouin

  • Admin Emeritus
  • 37,904 posts

Posted 03 July 2007 - 01:17 PM

SCREENSHOT SCRIPT( Fast, easy and time stamped screenshots )Currently in most KDE distros the Print Screen key is assigned to the Ksnapshot program, but you can re-assign it to another program.The command to make a screenshot of the full screen is: "import -window root screenshot.png"Now, you can make a bash-script that includes this command and place it in /usr/local/bin, like this:
$ kdesu kwrite /usr/local/bin/ScreenShotScript
and in the file paste:

Quote

#!/bin/bashimport -window root  `date +%d-%m-%y_%H:%M:%S`_sreenshot.png#End script
NOTE: This will give each screenshot a date and time stamp. Next make the script executable:
# chmod 775 /usr/local/bin/ScreenShotScript
Finally you make a new menu item with "kmenuedit", call it ScreenShotScript and in the box "command" write "/usr/local/bin/ScreenShotScript" (  deselect the box for "enable launch feedback" ) . . . . and  in the dialog of kmenuedit you can re-assign the hotkey to the PrintScreen button.This way no dialog or feedback will pop up when you press the Print Screen key and you will find the screenshots nicely time stamped in /homeB) BrunoNOTE: the ` in the script are NOT ' or

#369 OFFLINE   Bruno

Bruno

    Le Professeur Pingouin

  • Admin Emeritus
  • 37,904 posts

Posted 02 October 2007 - 01:26 PM

HARDWARE INFO COMMANDSSure you need to know all about your hardware, and to help you find the info here are a few commands that will help you find your information needed:$ dmesg ( debugging messages from kernel )# lshw > lshw.txt ( makes txt file with list of hardware in /home/user )# lshw -html >lshw.html ( same as above in a nice html file )$ lspci  ( lists PCI devices, more elaborate with the -vv option )$ lspcidrake ( same as above but only in Mandriva and PCLos )# scanpci ( to scan PCI buses and report information about the configuration space settings for each PCI device.)# dmidecode ( the computer's DMI ( SMBIOS ) table in readable format )# lsusb  ( lists USB devices, more elaborate with the -vv option )$ lshal ( lists all devices with their properties, "lshal --monitor" monitors the changes )$ cat /proc/devices ( list loaded hardware devices )$ cat /proc/dma ( what dma channels are used )$ cat /proc/interrupts ( what IRQs are used )$ cat /proc/ioports ( what I/O are used )$ cat /proc/meminfo ( info about memory use )$ cat /proc/modules ( loaded kernel modules )$ cat /proc/cpuinfo ( info about the processor )$ cat /proc/pci ( plugged in PCI devices )$ cat /proc/scsi/scsi ( SCSI devices )$ cat /proc/buddyinfo ( check memory fragmentation )There you go, that should help you hunt down the specs.:wacko: Bruno

#370 OFFLINE   Bruno

Bruno

    Le Professeur Pingouin

  • Admin Emeritus
  • 37,904 posts

Posted 30 October 2007 - 02:14 PM

URPMQ and URPMFBoth urpmq and urpmf commands are part of the urpmi family ( see Installing Software URPMI ). They can display detailed information about packages and the databases.URPMQThe command urpmq is a tool to search local and remote rpm sources for info about installed/available packages.
# urpmq --list-media
Shows all the urpm repositories configured on your system
# urpmq --list-media active
Only shows the active urpm repositories
# urpmq -i k3b
Information about the k3b package
# urpmq -f k3b
Shows the version and architecture of the k3b package
# urpmq --sources k3b
What remote urpm repositories holds the k3b package
# urpmq --fuzzy  k3b
Shows all packages on the urpm repositories with the name k3bURPMFThe command urpmf is a tool to search for a specific file in all installed/available packages on local and remote urpm repositories.
# urpmf kcutlabel.h
Will show that the kcutlabel.h file is part of the k3b-devel package.
# urpmf --summary k3b
Shows which packages have the word "k3b" in their summary
# urpmf --provides k3b
Will list which files are in the k3b package
# urpmf --requires k3b
Gives you which files are needed for to run k3b
# urpmf --conflicts k3b
Shows which files would conflict with k3b
# urpmf --size k3b
Will show the size of the k3b package
# urpmf -m k3b
Shows which repositories have packages with k3b in the name of the packageIf you would like to know more about urpmi and the related commands have a look here: http://wiki.linuxque....org/wiki/Urpmi;) Bruno

#371 OFFLINE   Bruno

Bruno

    Le Professeur Pingouin

  • Admin Emeritus
  • 37,904 posts

Posted 27 November 2007 - 02:27 PM

SLACKWARE TIPS ( 5 )( Vi behavior and the plugdev group )ViIf you want a better behaving Vi ( with syntax highlighting and proper backspace behavior ) do this:
# ln -sf /usr/bin/vim /usr/bin/vi# cp /usr/share/vim/vim71/vimrc_example.vim  /usr/share/vim/vimrc
NOTE: The /vim71 in the command above is for the version of vi in Slackware 12.0 . . . . if you use another version of Slackware adapt the command to the version of vim installed.CD / DVDIn Slackware 12.0, whenever you insert a cd or dvd, konqueror asks if you want to open it and then you'll get the error:

Quote

A security policy in place prevents this sender from sending this message to this recipient, see message bus configuration file (rejected message had interface "org.freedesktop.Hal.Device.Volume" member "Mount" error name "(unset)" destination "org.freedesktop.Hal")
The solution is to add your username to the "plugdev" group and reboot.Here is how that is done: The Groups Command:hysterical: Bruno

#372 OFFLINE   Bruno

Bruno

    Le Professeur Pingouin

  • Admin Emeritus
  • 37,904 posts

Posted 10 December 2008 - 03:27 AM

INSTALLING SOFTWAREURPMI ( part 2 )In the first part of this Tip  ( See  Here ** ) I did show you how easy it is to install packages using urpmi. Now imagine you want to install a system monitor to watch CPU usage, net connection activity and memory use . . but you don't know what package to install.What I usually do when I do not know the name of a package is go to http://www.google.com/linux and/or http://freshmeat.net/ and search for "system monitor" . . . it will for example suggest "gkrellm".To see if the gkrellm package is available in Mandriva I open a terminal and do:
# urpmq --fuzzy gkrellm
and it will find these packages on the mandriva urpm repositories:

Quote

gkrellmgkrellm-develgkrellm-pluginsgkrellm-plugins-kamgkrellm-plugins-mmsgkrellm-plugins-shootgkrellm-plugins-snmpgkrellm-plugins-stockgkrellm-plugins-wmhdplopgkrellm-servergkrellm-themes
Next if I want to know more about the Mandriva gkrellm package I can do:
# urpmq -i gkrellm
and will see this

Quote

Name        : gkrellmVersion     : 2.3.1Release     : 1mdv2009.0Group       : MonitoringSize        : 2320888                      Architecture: i586Source RPM  : gkrellm-2.3.1-1mdv2009.0.src.rpmURL         : http://gkrellm.netSummary     : Multiple stacked system monitorsDescription : GKrellM charts SMP CPU, load, Disk, and all active net interfacesautomatically. An on/off button and online timer for the PPP interfaceis provided. Monitors for memory and swap usage, file system, internetconnections, APM laptop battery, mbox style mailboxes, and cpu temps.Also includes an uptime monitor, a hostname label, and a clock/calendar.Additional features are:  * Autoscaling grid lines with configurable grid line resolution.  * LED indicators for the net interfaces.  * A gui popup for configuration of chart sizes and resolutions.
Right, that was exactly what I was looking for, so now I can install it:
# urpmi gkrellm
For more special urpm tricks please read: urpmq and urpmf :devil: Bruno** URPMI part 1 is a complete revision of the old text

#373 OFFLINE   Bruno

Bruno

    Le Professeur Pingouin

  • Admin Emeritus
  • 37,904 posts

Posted 12 January 2009 - 02:24 PM

DISKDRAKE Part 1New ParitionsThere is a choice of partition tools available in Linux. In my opinion there is one program that is best suited for new Linux users: Diskdrake, the graphical partition tool that is included in the PCLos and Mandriva Control Center.Diskdrake has an easy interface with many options to create and resize partitions and can even restore a lost partition table.Diskdrake can run from a Live CD, so even if you want to install another distro you still can do the partitions with Diskdrake.In this first part we will see how to create new partitions starting from an empty hard disk. In the second part we will see how to resize an existing ( Windows ) partition in order to make space for your Linux distro.So, let's get started: You will find Diskdrake in the Mandriva Control Center ( in PCLos the "PCLos Control Center" ) but you can also start the program by typing "diskdrake" in a root terminal. It will look like this:Posted ImageYou see 2 tabs in the left top . . sda and sdb . . . representing the 2 hard disks  I have in this computer. On sda you see in dark red the existing linux partitions ( the swap partition in green )  / is 21GB and /home is 39GB.On sdb, pictured below,  you see that the 2nd hard disk has a windows partition and a large empty space ( the white part ).Posted ImageClick on that empty space and you will see that you get a button in the right panel with the text: "Create" press the button:Posted ImageIn the popup you will get a few things that are very important:1). The size: grab the slider and make it large enough, minimum 7 to 10 GB for a Linux install.2). The Filesystem Type: make it "Journalised FS Ext3"3). The Mount point: make it look empty . . . so no mount point ! see pic below:Posted Image. . . . . yes, there is a "blank" option and that is the one to use !!Next press the "format" button and it will format the newly made partition.In general it is good practice to have a separate /home  and swap partition so repeat the above to make additional partitions. ( 1 GB for the swap will do fine, the "Filesystem Type" is swap ) )Also here, assign no mount points, this will only be done later when installing the distro of choice.Finally press "Done" and you will see:Posted ImagePress OK . . . close the main window and reboot to write the new partition table to disk.:thumbsup: BrunoAdditional info to read: Primary, Extended and Logical PartitionsPartitioning Tools ( And which ones not to use )

#374 OFFLINE   Bruno

Bruno

    Le Professeur Pingouin

  • Admin Emeritus
  • 37,904 posts

Posted 09 February 2009 - 02:21 PM

DISKDRAKE Part 2Resize PartitionsOkay, in Diskdrake Part 1 we learned how to make partitions on an empty part of your hard disk. But now what if your hard disk has plenty of space but the full disk is formatted as Windows ?Here we go for the next step: So boot from your Live CD and start Diskdrake. In this example we want to shrink the Windows partition in order to make space for your Linux install. So you will see something like this: one big fat blue line representing your hard disk:Posted ImageIf in the right panel there is only one button, "Unmount": press that button:Posted ImageAfter you pressed the unmount button there will be more buttons to choose from, one of them will be "Resize":Posted ImagePress that button and you will get to see: Posted ImageJust move the slider so the size of sdb1 is about 12 GB ( a few MB more or less is not important )  . . then press OKOkay that is it for now. We leave the empty space we made untouched for now because I first want to see what the damage is after the resize . . so we finish this off and press "Done", you might see:Posted ImagePress OK . . . close the MCC and reboot into Windows to see if all is still okay.After you checked your Windows partition you reboot to the Live CD and can start making new partitions ( see Part 1 ) in the empty space we made.:thumbsup: Bruno

#375 OFFLINE   Bruno

Bruno

    Le Professeur Pingouin

  • Admin Emeritus
  • 37,904 posts

Posted 12 January 2010 - 12:38 AM

NOTE: The Offline-Tips are still available for download !!! 1). The Linux version, about 6.7 MB: "Tips_Linux_Explorers.tar.gz"2). The one suited to extract with Windows software, 7,2 MB: "Tips_Linux_Explorers.zip"3). And the "XXS" Version, the special "dailup version" ( 12 convienient small downloads ) where the "basic" package is only 521 kB ! After that one can choose what pics of what Tips they like to add in 11 additional downloads ranging from 94 kB to 1.4 MB )A request for the Offline-Tips can be addressed to the Moderators and Admins of Bruno's All Things Linux Forum. They will provide you the URL.:) Bruno




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users