Jump to content

Tips for Linux Explorers


Recommended Posts

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:

/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
Link to comment
Share on other sites

  • 2 weeks later...
  • Replies 375
  • Created
  • Last Reply

Top Posters In This Topic

  • Bruno


  • greengeek


  • havnblast


  • Peachy


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:

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:
#!/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
Link to comment
Share on other sites

  • 4 weeks later...

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

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-networks.org/vistabootpro/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: . . . . VistaBootPro.png 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
Link to comment
Share on other sites

  • 4 weeks later...

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:

-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:

-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:

drwxr-xr-t 2 root root 4096 Sep 20 20:44 testdirectory/
A quote from the man page:
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:

-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:

----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
Link to comment
Share on other sites

  • 4 weeks later...

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


# 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

Link to comment
Share on other sites

  • 4 weeks later...

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:

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:
# 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
Link to comment
Share on other sites

  • 2 weeks later...

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:

kernel /boot/vmlinuz-2.6.17 ro root=/dev/hda6
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
Link to comment
Share on other sites

  • 4 weeks later...

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:

#!/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 ´

Link to comment
Share on other sites

  • 2 months later...

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

Link to comment
Share on other sites

  • 4 weeks later...

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.linuxquestions.org/wiki/Urpmi;) Bruno

Link to comment
Share on other sites

  • 4 weeks later...

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:

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
Link to comment
Share on other sites

  • 1 year later...

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:

Next if I want to know more about the Mandriva gkrellm package I can do:
# urpmq -i gkrellm

and will see this

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

Link to comment
Share on other sites

  • 1 month later...

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:screen-01.pngYou 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 ).screen-10.pngClick on that empty space and you will see that you get a button in the right panel with the text: "Create" press the button:screen-03.pngIn 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:screen-04.png. . . . . 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:screen-05.pngPress 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 )

Link to comment
Share on other sites

  • 4 weeks later...

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:screen-06.pngIf in the right panel there is only one button, "Unmount": press that button:screen-07.pngAfter you pressed the unmount button there will be more buttons to choose from, one of them will be "Resize":screen-08.pngPress that button and you will get to see: screen-09.pngJust 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:screen-05.pngPress 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

Link to comment
Share on other sites

  • 11 months later...

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

Link to comment
Share on other sites

  • 7 years later...
This topic is now closed to further replies.

  • Create New...