Jump to content

Tips for Linux Explorers


Bruno

Recommended Posts

DIRDIFF SCRIPT( Diff the content of 2 directories )In the previous Tip we combined the "find' command with the "diff" command to find the difference in the files located in 2 almost similar directories. It did involve a bit of work but we got the result we were after. Now imagine if there was a script that could do all the work for you ? Here is the "dirdiff" script that Ragnar sent me a while back. It compares the contents of two directories ( with the -r option also recursively ) An example of usage is:

$ dirdiff -r -q  /home/bruno/test-1  /home/bruno/test-2

The results will look similar like this:

$ dirdiff -r -q  /home/bruno/test-1  /home/bruno/test-2FILE: colors.txt6c6< # indigo---> # indigo-blue10d10< # sienna12a12> # darkblue15c15< # tomato---> # tomato-red
It searches the directory, finds the file that is different and shows us where the differences are in that file . . . . . really clever and it saves us the trouble of giving all the commands we had to give in the previous Tip.Next to the -r and -q options I gave in the example above there are also:
  -b        ignore trailing blanks  -B        include comparison of binary files  -c        ignore trailing carriage returns  -e file  exclude file from comparison  -E dir    exclude subdirectory from comparison  -l        list filenames only  -q        quiet mode (only list filename if there are differences)  -r        recursive mode (descend all subdirectories)  -L        show contents of files that only exist in leftdir  -R        show contents of files that only exist in rightdir  -T        ignore files that are text in one directory  -X        ignore files that only exist in one directory
Okay, so here is the script, paste in a text-editor, call it "dirdiff" make it executable with "chmod 755" and move it to /usr/local/bin
#!/bin/bash# dirdiff  compares the contents of two directories# made by Ragnar Paulson 2004SCRIPT=`basename "$0"`FILELIST=/tmp/$SCRIPT.list$$DIFFS=/tmp/$SCRIPT.diffs$$BADUSAGE="Type \"$SCRIPT -h\" for command usage."EXCLUDE_LIST=EXCLUDE_DIRLIST=BINARY=falseIGNORECR=falseIGNOREEXIST=falseLISTONLY=falseQUIET=falseRECURSIVE=falseSHOWLEFT=falseSHOWRIGHT=falseIGNORETEXT=falseDIFFOPTS=CMPOPTS=OPTIND=1while getopts bBce:E:hlqrLRTX switch; do    case "$switch" in    b)	DIFFOPTS="$DIFFOPTS -b";;    B)	BINARY=true;;    c)	IGNORECR=true;;    e)	EXCLUDE_LIST="$EXCLUDE_LIST $OPTARG";;    E)        EXCLUDE_DIRLIST="$EXCLUDE_DIRLIST $OPTARG"     ;;    h)	echo "$SCRIPT -- Compare files in two directories."	echo "Usage: $SCRIPT [options] leftdir rightdir"	echo "Options:"	echo "   -b        ignore trailing blanks"	echo "   -B        include comparison of binary files"	echo "   -c        ignore trailing carriage returns"	echo "   -e file   exclude file from comparison"	echo "   -E dir    exclude subdirectory from comparison"	echo "   -l        list filenames only"	echo "   -q        quiet mode (only list filename if there are differences)"	echo "   -r        recursive mode (descend all subdirectories)"	echo "   -L        show contents of files that only exist in leftdir"	echo "   -R        show contents of files that only exist in rightdir"	echo "   -T        ignore files that are text in one directory"	echo "   -X        ignore files that only exist in one directory"	exit 0;;    l)	LISTONLY=true	QUIET=true;;    q)	QUIET=true;;    r)	RECURSIVE=true;;    L)	SHOWLEFT=true;;    R)	SHOWRIGHT=true;;    T)	IGNORETEXT=true;;    X)	IGNOREEXIST=true;;    \?)	echo "$BADUSAGE" >&2	exit 1;;    esacdoneshift `expr $OPTIND - 1`if [ $# -ne 2 ]; then    echo "$BADUSAGE" >&2    exit 1elif [ ! -d "$1" ]; then    echo "Invalid directory: $1" >&2    echo "$BADUSAGE" >&2    exit 1elif [ ! -d "$2" ]; then    echo "Invalid directory: $2" >&2    echo "$BADUSAGE" >&2    exit 1ficdir=`pwd`	# current directorycd "$2"rdir=`pwd`	# right directorycd "$cdir"cd "$1"ldir=`pwd`	# left directoryif [ "$ldir" = "$rdir" ]; then    exit 0fiNODIRS=`(for name in $EXCLUDE_DIRLIST; do    find "$ldir" -name "$name" -type d -print | sed "s;^$ldir/;;"    find "$rdir" -name "$name" -type d -print | sed "s;^$rdir/;;"done) | sort | uniq`if $RECURSIVE; then    (	find "$ldir" -type f -print | sed "s;^$ldir/;;"	find "$rdir" -type f -print | sed "s;^$rdir/;;"    ) | sort | uniq >"$FILELIST"else    (	'ls' -a1 "$ldir" | while read f; do     if [ ! -d "$ldir/$f" ]; then         echo "$f"     fi	done	'ls' -a1 "$rdir" | while read f; do     if [ ! -d "$rdir/$f" ]; then         echo "$f"     fi	done    ) | sort | uniq >"$FILELIST"fiwhile read f; do    if [ -n "$EXCLUDE_LIST" ]; then	doexclude=false	for exclude in $EXCLUDE_LIST; do     if [ "`basename \"$f\"`" = "$exclude" ]; then  doexclude=true  break     fi	done	if $doexclude; then     continue	fi    fi    if [ -n "$NODIRS" ]; then        doexclude=false        for dir in $NODIRS; do            quit=`expr "$f" : "$dir"`            if [ $quit -gt 0 ]; then                doexclude=true                break            fi        done        if $doexclude; then     continue        fi    fi    lfile="$ldir/$f"    rfile="$rdir/$f"    if [ -f "$lfile" ]; then	if [ -f "$rfile" ]; then     if file "$lfile" | grep "text\$" >/dev/null; then  if file "$rfile" | grep "text\$" >/dev/null; then      if $IGNORECR; then 	 lfile=/tmp/$SCRIPT.lfile$$ 	 sed "s;*$;;" "$ldir/$f" >"$lfile" 	 rfile=/tmp/$SCRIPT.rfile$$ 	 sed "s;*$;;" "$rdir/$f" >"$rfile"      fi      if $QUIET; then 	 diff $DIFFOPTS "$lfile" "$rfile" >"$DIFFS" 	 if [ -s "$DIFFS" ]; then       if $LISTONLY; then    echo "$f"       else    echo "FILE: $f"    cat "$DIFFS"       fi 	 fi      else 	 echo "FILE: $f" 	 diff $DIFFOPTS "$lfile" "$rfile"      fi      if $IGNORECR; then 	 rm -f "$lfile" "$rfile"      fi  else      if $IGNORETEXT; then 	 continue      elif $LISTONLY; then 	 echo "$f"      else 	 echo "FILE: $f is not a text file in $rdir"      fi  fi     elif file "$rfile" | grep "text\$" >/dev/null; then  if $IGNORETEXT; then      continue  elif $LISTONLY; then      echo "$f"  else      echo "FILE: $f is not a text file in $ldir"  fi     elif $BINARY; then  if $QUIET; then      cmp $CMPOPTS "$lfile" "$rfile" >"$DIFFS"      if [ -s "$DIFFS" ]; then 	 if $LISTONLY; then       echo "$f" 	 else       echo "FILE: $f"       cat "$DIFFS" 	 fi      fi  else      echo "FILE: $f"      cmp $CMPOPTS "$lfile" "$rfile"  fi     fi	else     if $IGNOREEXIST; then  continue     elif $LISTONLY; then  echo "$f"     else  echo "FILE: $f does not exist in $rdir"  if $SHOWLEFT; then      if file "$lfile" | grep "text\$" >/dev/null; then 	 cat "$lfile" | sed "s;^;<;;"      fi  fi     fi	fi    else	if $IGNOREEXIST; then     continue	elif $LISTONLY; then     echo "$f"	else     echo "FILE: $f does not exist in $ldir"     if $SHOWRIGHT; then  if file "$rfile" | grep "text\$" >/dev/null; then      cat "$rfile" | sed "s;^;>;;"  fi     fi	fi    fidone <"$FILELIST"rm -f "$FILELIST" "$DIFFS"exit 0

Thanks Ragnar for this easy to use script !:lol: Bruno

Link to comment
Share on other sites

  • Replies 375
  • Created
  • Last Reply

Top Posters In This Topic

  • Bruno

    321

  • greengeek

    5

  • havnblast

    4

  • Peachy

    4

HEAD and TAIL We already know that for reading text files ( config and logs ) we can use the command "cat" or for longer files print them in pages in the console with "less" and "more".Now imagine you just want to see the first 10 or last 20 lines of a file. Or even follow what is written to a log file "live". For this we use the commands "head" and "tail"A few examples:I want to see the last 20 lines of /var/log/boot.log:

# tail -n 20 /var/log/boot.log

Or the first 30 lines of /etc/sensors.conf:

# head -n 30 /etc/sensors.conf

The default is 10 lines so you only need the -n option if you want to see more then 10 lines.Now something a bit more interesting and fun . . . . imagine you want to follow what is been written "live" to the /var/log/messages file ( one of the most important log-files ):

# tail -f /var/log/messages

This will first show the last 10 lines of the file but it will grow as new lines are added . . . . ( just open another console and log in as root and you will see that that action gets logged by /var/log/messages ) When you get tired of looking at the logfile you can stop the printing of the messages to the terminal with Ctrl+C and it will then return your prompt.:hmm: Bruno

Link to comment
Share on other sites

INSTALLING MANDRIVA 2005 Limited Edition( General instructions ) . . . . . * Due to limitations of the forum software this how-to is split over 2 posts First read erratum: Here Links to ISO images can be found Here- PreparationIf this is your first Linux install, check out Basic Rules for Install If 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.xbel ( 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/rc.d/rc.local, ~/.bashrc, ~/.exrc if you made any modification to these files. - 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 screen. Press Enter Before the GUI comes back, the installer is loading into memory and devices are being configured. 2nd screen: Language selection 1.png ( Click to enlarge )The default is US English, Press Next 3rd screen: License agreement 2.png ( Click to enlarge ) Select "accept" and Press Next 4th screen: Is this an install or an upgrade ? 3.png ( Click to enlarge )Tick the box of "install" and Press Next ( Advice: NEVER use Upgrade !!! ) 5th screen: Security level 4.png ( Click to enlarge )ATTENTION: By default the security level is set to "high", change this to "Standard"Fill in "root" or your email address and Press Next 6th screen: The DrakX Partitioning wizard found etc. etc. 5.png ( 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 5G partition for / and a 2G for /home. 7th screen: Choose file Mount points 6.png ( Click to enlarge )Chose 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 format 7.png ( Click to enlarge ). . Leave the /home box unchecked if you want to keep your mail addresses and personal settings Press Next 9th screen: Media 8.png ( Click to enlarge )Here it shows what install media it has found and asks you if you want to add additional installation media . . . . . . . Choose "None" and Press Next ( NOTE: You will have less CDs listed because these screenshots are from the Club-Edition )10th screen: Packages 9.png ( Click to enlarge )Do like in the screen shot: tick all the boxes on the left, and only the last 3 on the right and Press Next NOTE: 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 twice . . . . . * Will be continued in next post

Link to comment
Share on other sites

. . . . . 11th screen: Root password 10.png ( Click to enlarge )Fill in your root password twice and Press Next 12th screen: Adding a user11.png ( Click to enlarge )Fill in name twice and password twice and Press Accept 13th screen: Adding a user ( again ;) )Press Next 14th screen: Auto login13.png ( Click to enlarge )De-select the box, you do not want this, and Press Next NOTE: 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 loader, 14.png ( Click to enlarge )Select "First sector of drive ( MBR )" and Press Next NOTE: It will automatically include your Windows partition for dual boot 16th screen: Summary, . . . . This is very important . . check all the settings, look at the difference I have in the two screenshots: 15.png ( Click to enlarge )Before configuring 16.png ( Click to enlarge )After configuring 17th screen: Updates . . . say NO and Press Next NOTE: This feature rarely works, you will have to do the updates in the MCC after the first reboot B) 18th screen: Complete . . remove your CD and Press Reboot 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.Also read the notes Here :huh: BrunoSpecial tweaks:Menu and kdm: http://forums.scotsnewsletter.com/index.php?showtopic=11825Smaller fonts: http://forums.scotsnewsletter.com/index.php?showtopic=11824Nvidia & dkms: http://forums.scotsnewsletter.com/index.php?showtopic=11791

Link to comment
Share on other sites

URPMI SOURCES MANDRIVA 2005 LEWant access to 100 GB extra software ??There are the new sources you can add to the package manager of Mandriva 2005 to get extra software. Some of them everybody can add, but a few ( the last two ) are only for Club Members.For those new to this concept, here how it's done:

Go to a console, log in as 'su' and paste the line after the prompt and hit enter.Now it should work and get the list . . . be patient, it takes a while.Then as you get the prompt back, close the console ( Ctrl+d , 2x ).Now that we have added the source to your software manager, we can have a look at all the packages:Go to the MCC --> Software Management --> 'Look at installable software and install software packages' ( the icon with the + ). Now you will see the text : 'All packages' under the search-box., 'All packages' 'by group' change the by group in: 'by medium repository' and you will get a list with the sources you can choose from: CD1, CD2, CD3 and also the Update source and the just added source. Click in the little triangle in front of the new source, and a list will fold out with all the packages you can choose from . . . . FUN, MAGIC, BLISS !
Here they are: ( Don't click on the links but paste them in a root-console ) YOU HAVE TO BE ON LINE ! Contrib
# urpmi.addmedia contrib ftp://ftp.nluug.nl/pub/os/Linux/distr/Mandrake/official/2005/i586/media/contrib  with hdlist.cz

PLF-Free ( Needs the Contrib source )

# urpmi.addmedia plf-free ftp://ftp.easynet.fr/plf/mandrake/free/10.2 with hdlist.cz

PLF-NonFree ( Free to download and use, non-free as in licence ) ( Needs the Contrib source )

# urpmi.addmedia plf-nonfree ftp://ftp.free.fr/pub/Distributions_Linux/plf/mandrake/non-free/10.2 with hdlist.cz

Thacs

# urpmi.addmedia thacs http://anorien.csc.warwick.ac.uk/mirrors/thac/10.2/RPMS/ with hdlist.cz

Jpackage

# urpmi.addmedia jpackage-test ftp://ftp.nluug.nl/pub/os/Linux/distr/Mandrake/official/2005/i586/media/jpackage/  with media_info/hdlist.cz

Club Contrib

# urpmi.addmedia club.contrib ftp://ftp.uni-bayreuth.de/pub/linux/Mandrakelinux/devel/testing/Mandrakeclub/10.2/i586 with hdlist.cz

>>> Only club-members commercial packages

# urpmi.addmedia club.comm_i586_2005LimitedEdition http://NICKNAME:PASSWORD@www.mandrivaclub.com/downloads2/comm/10.2/i586/ with ./media_info/hdlist.cz

( Do not forget the replace NICKNAME:PASSWORD :blink: )Club Testing

# urpmi.addmedia testing_i586_2005LimitedEdition http://NICKNAME:PASSWORD@www.mandrivaclub.com/downloads2/test/10.2 with hdlist.cz

( Do not forget the replace NICKNAME:PASSWORD :hmm: ):huh: BrunoIMPORTANT NOTESNOTE 1: If you add the sources today . . and you want to use them, let us say next week, you first have to update them because new packages might have been added, and old packages might have been removed . . . so each time before using them do "urpmi.update -a" as root in a console !!NOTE 2: Usually I only have the CD, Main and Contrib sources active all the time . . and only make all others active if I can not find the desired package looking in those 3 ( CD, Main and Contrib ) . . . . You will just get too many different versions of the same package if you have all the sources active all the time. Sticking to the native Mandriva ones is in general recommended !

Link to comment
Share on other sites

BOOTING in RUNLEVEL 3 ( Trick with Lilo )Sometimes when troubleshooting you will want to boot in run-level 3 ( This is the non-graphical mode ) because X is using the wrong driver or the system fails to boot the usual way, hanging on some module it fails to load.Here is a simple trick for the people using Lilo as their boot-loader:Imagine your Lilo menu usually shows you:PCLosMandrakeFedoraDebianSlackwareAnd it is PCLos you want to boot in run-level 3 . . . . When you get the lilo-screen where you can choose what distro to boot press the Esc-key and you will get a prompt . . . at that prompt type:

PCLos 3

( Basically it is the name of the menu entry you want to boot and a 3 ) . . . . It will then boot in level 3 . . . then you can login as "root" ( not "su" ) and do "XFdrake" to set the correct driver for your graphics card, or any other troubleshooting operation you need to perform. When you are ready you can either type "reboot" or log out as root with Ctrl+D, then log in as user and type "startx", . . . and it will magically continue booting from level 3 to level 5.NOTE: Sure you can type "PCLos 1" too so it boots in "single user mode" giving you a root-prompt, so in case you forgot the root-password you can just type "passwd" and change it to one you can remember next time you need it.:) Bruno

Link to comment
Share on other sites

START NEW SESSIONYou might have noticed there is an entry in your KDE and Gnome menu called "Start New Session" ( In some distros "Switch User" ). I will try to explain a few things about this feature. In the "old" days you could at any time do Ctrl+Alt+F1 ( to F6 ) to get a text console you could log in as another user ( also as root ) to perform needed tasks and at the same time have your X running under F7. So switching up and down between the X session and the text session was easy as pressing a few keys on your keyboard.Now, these days it is possible to start a second X-session and log in as another user ( also root ) on that second X-session and switch between the 2 X-sessions with a simple Ctrl+Alt+F7 and Ctrl+Alt+F8.Here is how it is done: You select "Start New Session" from the menu and you get the following message:

You have chosen to open another desktop session.The current session will be hidden and a new login screen will be displayed.An F-key is assigned to each session; F7 is usually assigned to the first session, F8 to the second session and so on. You can switch between sessions by pressing CTRL, ALT and the appropriate F-key at the same time.
Pressing OK will give you the kdm or gdm ( the login manager your distro uses ) to log in and after logging in you will have the 2 sessions running . . . . hint: you can even have a KDE and a Gnome session running at the same time.As soon as you log out in one session you will automatically be switched over to the other session . . . isn't that cool ??Note: Next to the F8 you can start additional X-sessions on the F9, F10, F11 and F12 keys too, so you can have a maximum of 6 text- plus 6 X-sessions which is total of 12 sessions running at the same time on only one computer.:) Bruno
Link to comment
Share on other sites

LOOPING AN ISOCan you see what is in an ISO file without burning it to CD ? Yes, that is what the "loop" command does.. You mount the file as a loop device and then you can browse the ISO like any normal directory. Here is what you do ( we will take Fedora as example: FC4-i386-disc1.iso ).

# mkdir /mnt/loop# mount -o loop FC4-i386-disc1.iso /mnt/loop# ls /mnt/loop

That last command will show you the contents of the ISO file . . . you can read it, copy files from it, but ( of course ) not write to the ISO.But what you can do is copy the files to a special directory ( or partition ) and do an install from the HD. In the case of the Fedora example above you would put the files of the 4 ISO's in a directory. Then download the "boot.iso" from the ftp mirror ( For Fedora Core 4: Fedora4_boot.iso ). 1). Boot from the boot-CD 2). It will give you a dialog where you want to install from: choose "hard disk"3). The next dialog will ask you from which HD ( if you have 2 )4). After that a dialog will ask you on what partition the files are located5). And the next dialog asks "Directory or ISO image _________" type the path to the directory you copied the files to and press OKAfter that, the program will load into memory and proceed to go on as a normal install. This way you only have to burn 1 CD instead of 4.:hmm: BrunoNOTE: The Mandriva 2005 has a new feature in the boot.iso that can install directly from ISO files stored on the HD without having to "loop" them first.

Link to comment
Share on other sites

MANDRIVA SECURITY SETTINGS ( MSEC )Mandriva/Mandrake has a clever tool to control the security settings system-wide, it is called MSEC. There are 6 preconfigured levels you can choose from to secure your computer.I recently noticed that with a few of the installs of Mandriva 2005, the default security level ( on the 5th screen during the install (see Here ) is set to "high" . . . where for a regular desktop "normal" should be enough . . .Just to show you the different Mandriva security settings ( Msec ) here is a table of the levels 0 to 5 where 5 is "paranoid" and 0 is "none" . . . . 2 is the "normal" level you want . . . :hmm:

****************************Security level 0 :- no password- umask is 002 ( user = read,write | group = read,write | other = read )- easy file permission.- everybody authorized to connect to X display.- . in $PATH****************************Security level 1 :- Global security check.- umask is 002 ( user = read,write | group = read,write | other = read )- easy file permission.- localhost authorized to connect to X display and X server listens to tcp connections.- . in $PATH- Warning in /var/log/security.log****************************Security level 2 ( Aka normal system ) :- Global security check- Suid root file check- Suid root file md5sum check- Writable file check- Warning in syslog- Warning in /var/log/security.log- umask is 022 ( user = read,write | group = read | other = read )- easy file permission.- localhost authorized to connect to X display and X server listens to tcp connections.****************************Security level 3 ( Aka more secure system ) :- Global security check- Permissions check- Suid root file check- Suid root file md5sum check- Suid group file check- Writable file check- Unowned file check- Promiscuous check- Listening port check- Passwd file integrity check- Shadow file integrity check- Warning in syslog- Warning in /var/log/security.log- rpm database checks- send the results of checks by mail if they aren't empty- umask is 022 ( user = read,write | group = read | other = read )- Normal file permission.- X server listens to tcp connections.- All system events additionally logged to /dev/tty12- Some system security check launched every midnight from the ( crontab ).- no autologin- home directories are accesible but not readable by others and group members.****************************Security level 4 ( Aka Secured system ) :- Global security check- Permissions check- Suid root file check- Suid root file md5sum check- Suid group file check- Writable file check- Unowned file check- Promiscuous check- Listening port check- Passwd file integrity check- Shadow file integrity check- Warning in syslog- Warning in /var/log/security.log- Warning directly on tty- rpm database checks- Send the results of checks by mail even if they are empty to show that the checks were run.- umask 022 ( user = read,write | group = read | other = read ) for root- umask 077 ( user = read,write | group = | other = ) for normal users- restricted file permissions.- All system events additionally logged to /dev/tty12- System security check every midnight ( crontab ).- localhost authorized to connect to X display.- X server doesn't listen for tcp connections- no autologin- sulogin in single user- no direct root login- remote root login only with a pass phrase- no list of users in kdm and gdm- password aging at 60 days- shell history limited to 10- shell timeout 3600 seconds- at and crontab not allowed to users not listd in /etc/at.allow and /etc/cron.allow* - Services not contained in /etc/security/msec/server.4 are disabled during package installation ( considered as not really secure ) ( but the user can reenable it with chkconfig -add ).- Connection to the system denyied for all except localhost (authorized services must be in /etc/hosts.allow).- ctrl-alt-del only allowed for root ( or user in /etc/shutdown.allow ).- most sensible files and directories are restricted to the members of the adm group.- home directories are not accesible by others and group members.- X commands from /usr/X11R6/bin restricted to the members of the xgrp group.- network commands (ssh, scp, rsh, ...) restricted to the members of the ntools group.- compilation commands (gcc, g++, ...) restricted to the members of the ctools group.- rpm command restricted to the members of the rpm group.- forbid exporting X display when switching from root to another user*******************************Security level 5 ( Aka Paranoid system ) :- Global security check- Permissions check- Suid root file check- Suid root file md5sum check- Suid group file check- Writable file check- Unowned file check- Promiscuous check- Listening port check- Passwd file integrity check- Shadow file integrity check- Warning in syslog- Warning in /var/log/security.log- Warning directly on tty- rpm database checks- Send the results of checks by mail even if they are empty to show that the checks were run.- umask 077 ( user = read,write | group = | other = )- Highly restricted file permission- All system events additionally logged to /dev/tty12- System security check every midnight ( crontab ).- X server doesn't listen for tcp connections- no autologin- sulogin in single user- no direct root login- no list of users in kdm and gdm- password aging at 30 days- password history to 5- shell history limited to 10- shell timeout 900 seconds- su to root only allowed to members of the wheel group (activated only if the wheel group isn't empty)* - Services not contained in /etc/security/msec/server.5 are disabled during package installation ( considered as not really secure ) ( but the user can reenable it with chkconfig -add ).- Connection to the system denyied for all (authorized services must be in /etc/hosts.allow).- ctrl-alt-del only allowed for root ( or user in /etc/shutdown.allow ) .- most sensible files and directories are restricted to the root account.- home directories are not accesible by others and group members.- X commands from /usr/X11R6/bin restricted to the members of the xgrp group.- network commands (ssh, scp, rsh, ...) restricted to the members of the ntools group.- compilation commands (gcc, g++, ...) restricted to the members of the ctools group.- rpm command restricted to the members of the rpm group.- forbid exporting X display when switching from root to another user******************* level4/level5 : "services disabled" explanations :- Some server aren't really considered as secure, these one, should for example be compiled from sources. server considered as secure are specified in /etc/security/msec/server.4/5 When enabling level4/5, all servers which aren't considered as secure are disabled ( NOT uninstalled, just disabled ) user can reenable them using the chkconfig utility ( server will be launched at next boot ). In these level, we are also denying rpm to enable any server considered as insecure ( off course rpm can install the server ). The user have the choise : chkconfig --add servername will enable the server. Or add the server in the secured server list*** Future Release : ***- Automatic tty locking ( unlock by passwd ) after X time of inactivity.***
If you want to change the msec settings after the install you can give the command ( as root )
# msec 2

;) Bruno

Link to comment
Share on other sites

SHA-1 CHECKSUMSSHA-1 is the successor of MD5 ( Read about MD5 here ) and is a tool to check the integrity of your downloads.The SHA-1 algorithm is the brainchild of the US-based National Security Agency (NSA) Basically it works the same as the MD5, a SHA-1 file is available on the FTP server where you downloaded your ISOs and when opening it you will see a string of numbers that you compare to the output of the command:

$ sha1sum /home/bruno/downloaded.iso

The string you get from this command typically looks like:

f560f26a32820143e8286afb188f7c36d905a735
You compare it to the string you find in the SHA-1 file on the FTP mirror. If both of them are identical you can be sure your downloaded ISO is okay and you can burn it to a CD.:drooling: BrunoNOTE: Windows users can download a tool Here to check MD5 and SHA1 hashes. ( works in all flavors of windows )
Link to comment
Share on other sites

CONFIGURE NDISWRAPPER in the CONTROL CENTERJulia ( aka teacher ) wrote us some words on an easy way to configure NDISwrapper:

Installing a windows wireless driver in Linux can be done through the use of a program called ndiswrapper. This is the way to go if your wireless card does not have Linux support. If you are using Mandriva/Mandrake or PCLinuxOS, then you may be able to install your NDISWrapper through the Control Center. The very first thing you need to do is locate the .inf file in Windows that supports your driver. If you do not have Windows on your computer, you will need to search on the Internet or the disks that came with your card for the .inf file. Make sure the file is somewhere you have easy access to it from Linux.With that said, we will now go through the easy way to install with NDISWrapper. The first thing to do after you have located your driver, is to make sure it is handy. I move mine from windows to my home directory. You can get it from the Internet by googling for it or checking some of the resources available or you can find it on a CD or in your Windows where it is usually under /WINDOWS/system32/Drivers/ and then in a folder. Mine is in Atheros/Wireless \LAN/ within the Drivers folder. Notice the backslashes in the folder name. Those represent spaces in the folder name. The easy way to get past that is to press the tab key after you start typing. If I type cd followed by the first part of the name, it will then fill in the rest of the name for me. Handy trick. B) I simply type
 cd At

and then press tab and it does the rest.Now that you have finally found that elusive driver we can go to the menus and go from here.Click on the menu-button down on your task bar across the bottom of your screen. Go up to configuration and then over and down to PCLinuxOS Control Center or Mandrake Control Center.. . . . . . . menucontrolcenter.pngA menu will pop up that starts off as "run as root". You will need to type your root password in the box and press enter. . . . . . . runasroot.pngNow you are in the control center. This is a good spot to explore around and see all the things that can be done the easy way - by clicking on links. But before you go off and exploring, let's take a look at the tab labeled "networking". Don't get distracted by the last menu entry either. That is for after your drivers are set up for your wireless device.. . . . . . networking.pngThe first thing to do is to click on that first entry - the one labeled "Create a new network interface (LAN, ADSL, Wireless, etc.)." Simple enough? Let's get going.Now under new connection we are going to click on the bottom button - wireless connection. Once you have done that then click next. . . . . . . newconnection.pngNext it asks about the network to configure. It gives you two choices. First you can select "manually load a driver" and see if you can follow it from there and if it works. If it does, great, you are done.. . . . . . manualload.pngIf not, you will use ndiswrapper, and you will go back to where you selected "manually load a driver," and this time click the bottom option to "use a windows driver with ndiswrapper" and once again click next. It will then ask if you want to install a new driver and that is what you will do. . . . . . . installdriver.pngThe next screen says "net device" and that is it. Simply click next. The next few screens will vary according to your boot situation. Since you are running wireless, I assume you are going through a wireless router and it holds your configuration. I simply click next through the next few screens but you will need to adapt them as necessary for your situation. The screens are: Automatic ip (boot/dhcp) or manual configurationAssign host name or defaultWireless parameters: You will need to think about this screen. You can simply click "auto" and "any" or you can change this. If you are using encryption you will use the word "managed" instead of "auto" and then you will indicate the network name and your encryption id. Otherwise, you can go with "auto" and "any". . . . . . . wirelessparameters.pngThe next screen is for the wireless parameters for your card. I have never needed to put anything here but if you know of specific parameters then you will enter them here. If in doubt, go take a look at the desktop link for the "man pages". Host name: If you need to enter something here, then go ahead. I leave it blank. It is the same for the next screen: zeroconference host. Do you want to allow users to connect? If you say no then only root will be able to connect. Finally, it tells you the network needs to restart and asks for your permission. Here you need to tell it yes and then wait a minute or two while it does its thing.Hasn't this been easy so far? Now it says the configuration is finished and wants you to restart your x environment. What on earth is that? Simple. All you need to do is to go back to your menu-button and click on log out and then you will log back in and everything should be working. If that does not work, it will be a good time to go post questions on the forum, giving as many details as possible about your wireless device. Happy Browsing.

Thanks Julia . . . . this looks so simple maybe it is time to get a wireless myself soon ! <g>B) BrunoPS: Here is an interesting link with a list of cards known to work with ndiswrapper
Link to comment
Share on other sites

THE GROUPS COMMANDJust as penguins live in large groups, we Linux users like to belong to a group too . . . . . <g>If you want to see to what groups your user belongs to, there is a simple command "groups", See here how it works. When I give the command in Slackware I get:

$ groupsusers audio video plugdev

So I belong to the group "users", "audio" "video"and "plugdev"Or giving the same command as root:

# groupsroot bin daemon sys adm disk wheel floppy

This shows that root belongs to 8 different groups.Now imagine that you want to add yourself to the "audio" group . . . there are 2 simple ways to achieve that:Either do

# usermod -G audio bruno

Or if the command usermod is not available on your system, just edit the /etc/group file and add your login name to to group . . . Here is an example of my /etc/group file:

# cat /etc/grouproot::0:rootbin::1:root,bin,daemondaemon::2:root,bin,daemonsys::3:root,bin,admadm::4:root,adm,daemontty::5:disk::6:root,admlp::7:lpmem::8:kmem::9:wheel::10:rootfloppy::11:rootmail::12:mailnews::13:newsuucp::14:uucpman::15:audio::17:brunovideo::18:brunocdrom::19:games::20:slocate::21:utmp::22:smmsp::25:smmspmysql::27:rpc::32:sshd::33:sshdgdm::42:shadow::43:ftp::50:apache:x:80:messagebus:x:81:haldaemon:x:82:plugdev:x:83:brunopower:x:84:pop::90:popscanner::93:nobody::98:nobodynogroup::99:users::100:console::101:
Each line has 4 parts separated by colons: The first part is the name of the group. The second part ( not in use here) is for storing a password to allow users of another group to log in, if a x is in this field, the shadow group passwords are used. The third part is the GID ( Group ID ) number. The fourth part lists the users that are member of that group separated by comma's. ( So there is where you want to add your name !! )For more info on the /etc/group file type "man 5 group" in a terminal.NOTE: If you want to add a new group ( like "penguins" ) you give the command "groupadd penguins" . . . LOLB) Bruno
Link to comment
Share on other sites

SRPMs ( Source RPMs )Maybe you noticed when searching for RPMs that sometimes you find packages that ends with ".src.rpm". These are Source RPMs, and although it will be a bit more work to install them, it might, in some cases, be just the ticket if all the other RPMs you find don't fit your distro-version or architecture.Source RPMs ( SRPMs ) allow you to build a RPM package tailored to your distro and system. They contain the program's source code and you need a special rpm command to compile them.Also you will need several development packages to be able to customize your own RPMs: rpm-build, autoconf, automake, spec-helper and rpm-devel ( + dependencies ) are the main ones.So, when you have all the needed devel packages, all you have to do is:

# rpm --rebuild name_of_package.src.rpm

This will build a RPM package suited to your system architecture and distro-version, after the compile and rebuild is finished you can find the "name_of_package.rpm" in your "/usr/src/rpm/rpms/<arch>/" directory. To install that new RPM you use the usual "rpm -ihv" command . . . <g>For more info and tricks on SRPMs see here: http://www.linuxnovice.org/main_how.php3?VIEW=VIEW&t_id=52:hysterical: Bruno

Link to comment
Share on other sites

  • 1 month later...

SHRED ( Really Delete )Some people make a living recovering data from old harddisks. If that knowledge makes you nervous, here is a command you will want to remember: "shred"Shred is a real powerful command . . . . much better then just deleting-- it shreds a file, or wipes a partition, so that absolutely no recovery is possible ( even those businesses specialized in data-recovery will not be able to get it back . . . so be careful )Here is the basics of the command:

$ shred -n 50 -z -u secret.txt

The -n 50 means that the file "secret.txt" will be overwritten 50 times. The -z means add a final overwrite with zeros to hide the shredding. The -u makes sure the file is removed after shred is done with it.You can shred a complete drive or partition too:

# shred -n 50 -z /dev/hda

This will make sure that no data will be found when you send this drive to the local dump <g>:unsure: BrunoNOTE: Shredding a single file on a partition with a journaled filesystem can be less permanent as one might think ( because of the journal ), shredding the complete partition is needed to be absolutely sure.

Link to comment
Share on other sites

CD SPELLCHECKIf, like me, you often make typos and find this annoying when typing cd commands here is the right Tip for you:

 $ shopt -s cdspell

This will turn on autocorrection when you mistype the name of a directory . . . so when you type

$ cd /ect/X11

the autocorrection will read this as

$ cd /etc/X11

The "shopt" command will last as long as you are logged in . . . if you want it permanently you will have to add a line to your ~/.baschrc so it gets enabled at every boot.Shopt has more nice options . . . have a look what "shopt -p" shows us:

shopt -u cdable_varsshopt -u cdspellshopt -u checkhashshopt -s checkwinsizeshopt -s cmdhistshopt -u dotglobshopt -u execfailshopt -s expand_aliasesshopt -u extdebugshopt -u extglobshopt -s extquoteshopt -u failglobshopt -s force_fignoreshopt -u gnu_errfmtshopt -u histreeditshopt -u histappendshopt -u histverifyshopt -s hostcompleteshopt -s huponexitshopt -s interactive_commentsshopt -u lithistshopt -u login_shellshopt -u mailwarnshopt -u no_empty_cmd_completionshopt -u nocaseglobshopt -u nullglobshopt -s progcompshopt -s promptvarsshopt -u restricted_shellshopt -u shift_verboseshopt -s sourcepathshopt -u xpg_echo
If you want to know exactly what all of those options do, have a look in "man bash" in the section "Shell Bulletin Commands" under "shopt"B) Bruno
Link to comment
Share on other sites

NICEIf you start a process that will take long to execute and is heavy on CPU resources, it may be a good thing to let it run in the background ( so you can continue doing other things ) and change the priority of the process.With adding a "nice" value before the command you can set the priority . . . and closing the command with an "&" you set it to the background and thus will get your prompt back so you can continue working. This Tip is about "nice", but we will handle forground and background processes more extensively in the next Tip.So let us give a simple example:

# nice -n 19 updatedb &

Here the nice priority is set to 19 ( its lowest value ) . . . You will see the command returns "[1] 8037" in your terminal, this is because "&" did place the process in the background, the "[1]" is the job number and the "8037" the process number. But like I said, more about that next time.If you want you process to have the highest priority ( so to be less "nice" to other processes ) you can go up to -20 ( the highest value ) so the process will finish quick:

# nice -n -20 updatedb &

B) Bruno

Link to comment
Share on other sites

BACK- and FOREGROUND PROCESSESLike promised in the previous Tip ( "nice" ) now we will tell how to send a process to the background and get it back to the foreground.There are 2 ways you can send a process to the background, the first is with the "&" sign:

# nice -n 19 updatedb &

Another way to do this is start it as usual:

# nice -n 19 updatedb

And then interupt it with Ctrl+Z, and then to continue the process in the background you give the command:

# bg

Now let us start 2 processes in the background:

# nice -n 19 updatedb &

This will return something like:

[1] 8697
Meaning job number "1" and process number ( PID ) "8697"Now the second command:
# ls -alR / >file-list.txt 2>&1 &

( makes a "file-list.txt" of all the files on your computer and sends the error messages to the same file )This will return something like:

[2] 8724[1] Running nice -n 19 updatedb
So the second command gets job number "2" and proces number "8724" and you can see that job number "1" is still running.Next if we give the command "jobs" we will see:
[2]+ Running ls -alR / >file-list.txt 2>&1 &[1] Done nice -n 19 updatedb
You see the first job is "Done" and the second job is still running. Now if we do:
# fg %2

It puts the second job back in the foreground and you will have to wait for the job to finish to get your prompt back. ( or do Ctrl+Z and bg again )So in a nutshell, the "&" sign at the end of a command puts it in the background, you get a job number and with that job number you can with "fg %<jobnumber>" and "bg %<jobnumber>" put it back and forth.Now, there are some restrictions:1). There should no input needed from the keyboad for the background process.2). Better send output from the process to a file and not to the screen.3). If you exit the shell the process is stopped ( you can prevent this by preceeding the command with "nohup" ):pirate: Bruno

Link to comment
Share on other sites

THE COMMAND "INFO"There is a lot of information installed by default on your Linux distro. Sure we all know about the "docs" and the "man" pages, but there is more: the command "info" ( They say it is easier to read than the man pages, but don't blame me if you don't agree with that statement <g> )You can use "info" from the commandline but also, and even easier to navigate, in konqueror thanks to info2html. ( note: konqueror works in Gnome too if properly installed )So have a look, open konqeror and type "info:/bash" in the address bar . . . you will see that the info-pages give in-depth info about the subject you are looking for. There are links you can click to go to the next level.If you want to know what subjects are handled by "info" type "info:/info/Top" in the konqueror address bar.Now I hear you thinking: "Bruno, what's up with you ? We thought you were a command line junkie" . . . . Okay okay, you asked for it:

$ info bash

And you will get the same page as above.Note that:"q" = exit"n" = next chapter"p" = previous chapter"space" = follow link in "* menu"More info on how to use "info":

$ info info

Sure there are "man" pages about "info" too . . . just try "man info" :D !!:) Bruno

Link to comment
Share on other sites

  • 2 weeks later...

INSTALLING A KERNEL-SOURCEImagine you want to compile drivers for your Nvidia Card, so you need the source for the kernel you are running . . . . and the distro does not provide the source for that kernel on their mirrors . . . . what can you do ??Well, for example if "uname -r" shows you "2.6.12.2" for the kernel you are running, go here: http://www.kernel.org/pub/linux/kernel/v2.6/ and look for the "linux-2.6.12.2.tar.gz", then download it to "/usr/src/" and do:( as root and after you cd to /usr/src )

# gzip -cd linux-2.6.12.2.tar.gz | tar xvf -

( Note the | is a "pipe"-sign and not an L or an i . . . and do not forget the - at the end of the command )This will make a /usr/src/linux-2.6.12.2 directory. ( NOTE: unpacked you will need about 190 MB free space )Next step is to make a symlink so the compiler of the driver you want to install can find it:

# ln -s /usr/src/linux-2.6.12.2 /usr/src/linux

Or if you already have a 2.6 or still the 2.4 source in /usr/src, you will have to change the symlink "linux" from that 2.4 source to the new one . . . so:

# rm -rf /usr/src/linux# ln -s /usr/src/linux-2.6.12.2 /usr/src/linux

After that you are all set to download the Nvidia drivers and install them.:hysterical: Bruno

Link to comment
Share on other sites

.* Due to limitations of the forum software this how-to is split over 2 postsINSTALLING MANDRIVA 2006( General instructions ) >>> As long as the free ISOs are not yet available you can do an FTP install following these instructions: HerePlease first read the erratum: http://qa.mandriva.com//twiki/bin/view/Mai...Linux2006Errata - PreparationIf this is your first Linux install, check out Basic Rules for Install If 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/rc.d/rc.local, ~/.bashrc, ~/.exrc if you made any modification to these files. - 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 screen. Press Enter Before the GUI comes back, the installer is loading into memory and devices are being configured. 2nd screen: Language selection 1.png ( Click to enlarge )The default is US English, Press Next 3rd screen: License agreement 2.png ( Click to enlarge ) Select "accept" and Press Next 4th screen: Is this an install or an upgrade ? 3.png ( Click to enlarge )Tick the box of "install" and Press Next Advice: NEVER use Upgrade !!! ) 5th screen: Security level 3b.png ( Click to enlarge )ATTENTION: By default the security level is set to "high", change this to "Standard"Fill in "root" or your email address and Press Next 6th screen: The DrakX Partitioning wizard found etc. etc. 4.png ( 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 5G partition for / and a 2G for /home. 7th screen: Choose file Mount points 5.png ( Click to enlarge )Chose the partitions where you want / and /home and Press Next ( Everybody using partitions for /tmp and /usr too . . you know what to do B) ) 8th screen: Choose the partitions you want to format 6.png ( Click to enlarge ). . Leave the /home box unchecked if you want to keep your mail addresses and personal settings Press Next 9th screen: Packages 7.png ( Click to enlarge )Do like in the screen shot: tick all the boxes on the left, and only the last 3 on the right and Press Next NOTE: 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 twice * Will be continued in next post . . . . . .

Link to comment
Share on other sites

. . . . . 10th screen: Root password 9.png ( Click to enlarge )Fill in your root password twice and Press Next 11th screen: Adding a user10.png ( Click to enlarge )Fill in name twice and password twice and Press Accept user 12th screen: Adding a user ( again B) )11.png ( Click to enlarge )Here you can add another user, or leave it empty and Press Next 13th screen: Auto login12.png ( Click to enlarge )De-select the box, you do not want this, and Press Next NOTE: 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. 14th screen: Boot loader, 13.png ( Click to enlarge )Select "First sector of drive ( MBR )" and Press Next NOTE: It will automatically include your Windows partition for dual boot 15th screen: Summary, . . . . This is very important . . check all the settings by clicking on the Configure button, look at the difference I have in the two screenshots:14.png ( Click to enlarge )Before configuring 15.png ( Click to enlarge )After configuring 16th screen: Updates16.png ( Click to enlarge ) . . . say NO and Press Next NOTE: This feature rarely works, you will have to do the updates in the MCC after the first reboot :D 17th 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.NOTE: I removed "kat" in the MCC after the install because it takes up to many resources ( kat = desktop search prog. )Info about "kat": http://kat.mandriva.com/After the first boot please issue the following command ( as root ) to fix a cron/msec bug:

# ln -s /etc/security/msec/security.conf /var/lib/msec/security.conf

Also read the release notes: HereSpecial tweaks:Menu and kdm: http://forums.scotsnewsletter.com/index.php?showtopic=11825Smaller fonts: http://forums.scotsnewsletter.com/index.php?showtopic=11824Extra software sources can be configured, have a look HereHave FUN ! B) Bruno

Link to comment
Share on other sites

URPMI SOURCES MANDRIVA 2006Want access to 100 GB extra software ??There are the new sources you can add to the package manager of Mandriva 2005 to get extra software. Some of them everybody can add, but a few ( the last two ) are only for Club Members.For those new to this concept, here how it's done:

Go to a console, log in as 'su' and paste the line after the prompt and hit enter.Now it should work and get the list . . . be patient, it takes a while.Then as you get the prompt back, close the console ( Ctrl+d , 2x ).Now that we have added the source to your software manager, we can have a look at all the packages:Go to the MCC --> Software Management --> 'Look at installable software and install software packages' ( the icon with the + ). Now you will see the text : 'All packages' under the search-box., 'All packages' 'by group' change the by group in: 'by medium repository' and you will get a list with the sources you can choose from: CD1, CD2, CD3 and also the Update source and the just added source. Click in the little triangle in front of the new source, and a list will fold out with all the packages you can choose from . . . . FUN, MAGIC, BLISS !
Please remember that after a while your sources might be outdated, so before searching and installing new packages you will have to update your sources with "urpmi.update -a" !!Here they are: ( Don't click on the links but paste them in a root-console ) YOU HAVE TO BE ON LINE !All commands are ONE line.Contrib
# urpmi.addmedia contrib  ftp://ftp.nluug.nl/pub/os/Linux/distr/Mandrakelinux/official/2006.0/i586/media/contrib with ../media_info/hdlist_contrib.cz

Main ( Distribution, what is on your CDs B) )

# urpmi.addmedia main ftp://ftp.nluug.nl/pub/os/Linux/distr/Mandrakelinux/official/2006.0/i586/media/main with ../media_info/hdlist_main.cz

PLF-Free ( Needs the Contrib source )

# urpmi.addmedia plf-free ftp://ftp.free.fr/pub/Distributions_Linux/plf/mandrake/free/2006.0/i586 with hdlist.cz

PLF-NonFree ( Free to download and use, non-free as in licence ) ( Needs the Contrib source )

# urpmi.addmedia plf-nonfree ftp://ftp.free.fr/pub/Distributions_Linux/plf/mandrake/non-free/2006.0/i586 with hdlist.cz

Jpackage

# urpmi.addmedia jpackage ftp://ftp.nluug.nl/pub/os/Linux/distr/Mandrakelinux/official/2006.0/i586/media/jpackage with ../media_info/hdlist_jpackage.cz

NL-Club

# urpmi.addmedia NL-Club  ftp://ftp.nluug.nl/pub/os/Linux/distr/mandrakeclubnl/2006/i586/ with hdlist.cz

Thacs rpms

# urpmi.addmedia thac_rpms http://anorien.csc.warwick.ac.uk/mirrors/thac//2006.0/RPMS with hdlist.cz

SeerOfSouls

# urpmi.addmedia SeerOfSouls http://seerofsouls.com/RPMS-2006/ with hdlist.cz

Borgnet

# urpmi.addmedia Borgnet ftp://ftp.planetmirror.com/pub/borgnet/2006.0/i586/ with ../hdlist.cz

>>> Only Mandriva Club-MembersCommercial Packages

# urpmi.addmedia "club.commercial_x86-32_2006" https://bruno%40forum.com:PASSWORD@dl.mandriva.com/rpm/comm/2006.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 "club.testing_x86-32_2006" https://bruno%40forum.com:PASSWORD@dl.mandriva.com/rpm/test/2006.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 "club.club_x86-32_2006" https://bruno%40forum.com:PASSWORD@dl.mandriva.com/rpm/club/2006.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 )Will be updated when there are more sources available . . . . !!:) BrunoIMPORTANT NOTESNOTE 1: If you add the sources today . . and you want to use them, let us say next week, you first have to update them because new packages might have been added, and old packages might have been removed . . . so each time before using them do "urpmi.update -a" as root in a console !!NOTE 2: Usually I only have the CD, Main and Contrib sources active all the time . . and only make all others active if I can not find the desired package looking in those 3 ( CD, Main and Contrib ) . . . . You will just get too many different versions of the same package if you have all the sources active all the time. Sticking to the native Mandriva ones is in general recommended !

Link to comment
Share on other sites

THE COMMAND "FILE"Here is a real short one, the command "file".This command can help to determine the type of file you are viewing. The file command performs 3 tests to check the file type: file system tests, magic number tests, and language tests. By default the magic number test is checked against the /usr/share/misc/file/magic.mgc or /usr/share/misc/file/magic but there are options to let it use another customized file. More about how exactly this command works and even a bit of history about this UNIX command existing since 1973 can be found by typing "man file"Here are a few examples, you will see the output on the second line:

$ file /etc/lilo.conf/etc/lilo.conf: ASCII text

Now if we add the -i option we sometimes get some more useful info ( uses another magic file ):

$ file -i /etc/lilo.conf/etc/lilo.conf: text/plain; charset=us-ascii

Or on another file:

$ file -i /usr/bin/top/usr/bin/top: application/x-executable, for GNU/Linux 2.2.5, dynamically linked (uses shared libs), stripped

And another:

$ file -i /usr/bin/startkde/usr/bin/startkde: Bourne shell script text executable

A few alternative options, the -z option looks in compressed files:

$ file -iz /usr/share/man/bg/man1/apropos.1.bz2/usr/share/man/bg/man1/apropos.1.bz2: text/troff; charset=iso-8859-1 (application/x-bzip2)

The -s option for reading block or special character files

$ file -s /dev/hda10/dev/hda10: Linux rev 1.0 ext3 filesystem data (needs journal recovery)

The command "file" is not prefect, it only makes a guess of what the file is you are looking at: text, executable or data ( everything else ) . . . so still can be of good use.:'( Bruno

Link to comment
Share on other sites

FTP on the COMMANDLINEThere are multiple tools to do your FTP jobs in a GUI, but the Tips for Linux Explorers would not be complete if there was not a hint about how to use FTP on the command line.The basics of FTP on the command line are simple, you type the address, login, cd to the directory where the file is you want, and you type "get <file_name>" and when the file is downloaded you type "bye" to close the connection.To show you that the FTP program is running your prompt will change to a special FTP prompt:ftp>Okay, let me show in an example how to download the D Small Linux ISO: "dsl-1.3.1.iso" using the commandline:We start with making a connection to ftp.nluug.nl, in the quote you will see in GREEN the text I typed and in GRAY the answer received:

[bruno:~]$ ftp -v ftp.nluug.nl Connected to ftp.nluug.nl.220-There are currently 183 users logged in (max 850).220-There are 50 extra sessions available for IPv6 clients220-This is an IPv4 session220-220-Welcome to the FTP archive of SURFnet BV and220-The Netherlands Unix Users Group (NLUUG).220-220-This server is located in The Netherlands, Europe.220-If you are abroad, please find an ftp site near you.220-Most information on this site is mirrored.220-220-Information about your login and any transfers you do are logged.220-If you don't like this, disconnect now.220-220-For statistics, see http://ftp.surfnet.nl/.statistics/220-Problems? Mail ftpmirror-beheer @ surfnet.nl220-220-You may login as "ftp" or "anonymous".220-220530 Please login with USER and PASS.530 Please login with USER and PASS.KERBEROS_V4 rejected as an authentication type
Now we are asked to login and we will use the name "anonymous":
Name (ftp.nluug.nl:bruno): anonymous 331 Please specify the password.
And give a password ( in most cases your email address ):
Password: ********230-230-================================================================230-Want to know where to find what data? See the file230- /pub/WhereToFindWhat.txt230-230-================================================================230-230 Login successful.Remote system type is UNIX.Using binary mode to transfer files.
Now we get the FTP prompt and we can cd to the directory where the file is located: ( Note, next to the cd command also ls and pwd are commands known by FTP, but more about that later ):
ftp> cd /pub/os/Linux/distr/damnsmall/current/ 250 Directory successfully changed.
Next we are going to download the file:
ftp> get dsl-1.3.1.iso local: dsl-1.3.1.iso remote: dsl-1.3.1.iso200 PORT command successful. Consider using PASV.150 Opening BINARY mode data connection for dsl-1.3.1.iso (50745344 bytes).226 File send OK.50745344 bytes received in 1.5e+02 seconds (3.3e+02 Kbytes/s)
And after seeing "File send OK" you can close the connection and get your usual prompt back:
ftp> bye 221 Goodbye.[bruno:~]$
See ? That was simple . . . . but sure you will want to know a bit more about FTP on the command line, like the command "put" to upload files, the command "bell" to have a signal when the file is finished downloading, or "hash" that prints # marks, one for each block of 1024 bytes recieved.If you want to see a full list of commands that your FTP program can handle just type a ? at the FTP prompt:
ftp> ?
For more elaboration on FTP check out: http://www.faqs.org/docs/Linux-mini/FTP.html:icon8: Bruno
Link to comment
Share on other sites

ACCESS LINUX PARTITIONS FROM WINDOWSWe all know that you can easily access your Windows partitions from Linux, but that the other way around is a problem. There is good news for the dual-booters, Alphaomega sent me the next interesting note:

Have you ever needed to access a Linux ext2/ext3 Partition from Windows?You can with the help of Explore2fs !When I first started with Linux...I set up my machine to dual boot with Windows XP Home and Mandrake Linux 9.2...so just in case I had problems...I could still get into Windows.Well wouldn't you know it...I had problems being the noobie that I wasso I kept having to jump into Windows to get on-line and look stuff up.That is when I realized that I could not access my Linux partitions fromwithin Windows...until I found explore2fs. This utility allows you to accessyour Linux partitions from Windows. It has a explorer like interface and navigation is similar to that of Windows Explorer. I have used it in Windows98 SE and Windows XP Home and have not had any problems. I have notput the program to any heavy duty testing...just copying over a few files hereand there when the need arises and it has not given me any problems (YMMV so be sure to check out the ReadMe).For more information about Explore2fs see:http://uranus.it.swin.edu.au/~jn/linux/explore2fs.htmCheersalphaomega
Note: Explore2fs works only for Ext2 and Ext3 partitions. It is supposed to work in Win 9x, ME, NT4.0, 2000, XP and server 2003. You simply unzip the file in Windows and you are set up to browse your Linux partitions.Also I would like to point out that the program only provides "read" access . . . no "read/write" access.Thanks for the tip Omega !:D Bruno
Link to comment
Share on other sites

AUTOMATIC TIME SYNCINGSure you want your computer to show the correct date and time.If your distro does not support ntp ( Network Time Protocol ) for syncing time with a remote time server, or you have a hard time configuring it, here is what you can do using the rdate command:First install rdate:

# apt-get install rdate

Then first test this command to make sure it reports no errors:

# rdate -s clock-1.cs.cmu.edu && hwclock --systohc

( If it does report errors, try leaving off the "&& hwclock --systohc" part which changes the hardware clock as well )Next, depending on your distro you can add that line at the bottom of the next file:Fedora: /etc/rc.localRed Hat: /etc/rc.localDebian: /etc/rc.bootSlackware: /etc/rc.d/rc.localSUSE: /etc/init.d/boot.localMandrake: /etc/rc.localPCLos: /etc/rc.localNow, every time you boot your computer the time will synced !:hysterical: BrunoNOTE: You should be connected to the internet at boot for this to work.

Link to comment
Share on other sites

  • 2 weeks later...

PCLOS .92 PERFORMANCE TWEAKS( Only for the advanced user ! ) Our good friend Ivan ( aka Ikerekes ) sent me some interesting tweaks for PCLos .92, but you do need a good basic knowledge of Linux before you throw yourself at it . . . but the result is certainly rewarding . . . here is the full and uncensored text:

A p.92 install and fine tune experience. First of all, I am a pclos developer, specialized in hardware and the maintainer of the mklivecd set of scripts.Painfully enough the only hardware I own a 3 year old Compaq Presario, with a VIA based KM266 mobo AMD XP2200+, 512M RAM, and 2 ATA-133 HD one is 60G the other is 120G. I have quite a few distro installed, Suse 10, Mandriva 2006, cooker, Knoppix 4, Kanotix, Mephis, Fedora FC4, Peanut, Arabian, Frugalware... Sorry I almost forgot (K)ubuntu ? - but above all PCLOS in a few flavours. I have pre4 fully unstable upgarded with kernel 2.6.14 the oldest but the most cutting edge.I have all kind of 8.1, 9, 9.1 upgraded with exp repo.You can imagine the junk what I have collected, tested and not removed during the years. Although my mail directory is shared between the different partitions, and I have a huge shared area, where I am downloading iso's mirroring repos, my home directory is not shared, since I have rpm, deb, tgz, and arch based distroes, and they all like to set up the .rc files differently.So as I used to do with winders, time to time I like to start from fresh, clear install, customize with the setup what I know I will use, and can't be without.Today morning when the .92 showed up, I set just to do that. My current "production" install is a fully upgraded .90, but I downloaded, tested all the 4 test iso's (sent a lot's of bug report, fixes, improvements to Texstar, so I knew fairly well what I can expect).After burning the iso, boot the livecd with the tried and trusted cheat codes,"livecd acpi=off nolapic xres=1280x1024 splash=no" my p.92 just came up perfect.Just a little explanations: My VIA mobo requires acpi=off nolapic, otherwise it has interrupt problems. I hate when I have to manually make my screen larger, or run XFdrake to adjust my resolution, and the splash=no because I like to see if there is anything a problem during the livecd boot.The first order of business is to install the dkms-7174 NVIDIA rpm. I have a Riva TNT-2 card, which is "legacy" so I can use only the legacy driver and I am lazy to reinstall the driver by hand every time I reinstall the kernel, and I do that a lot. The nicest thing about unionfs that you can install with synaptic any package while you are running off the livecd, and if you install after that to the HD, the modifications are remembered so the first time you boot form the HD it will already come with the needed NVIDIA driver. I know that Texstar plans to issue the NVIDIA, and ATI versions, where this step would be automatic, but patience is not my strong side.The only thing worth mentioning during this step, that when you first start synaptic, you have to click on the update button to get the full package list, which is not on the CD for obvious space constraint. (The stripped source code needed by the 3-rd party drivers, on the other hand, is preinstalled).Comes a rather un-eventful 25 minutes, until the livecd-install copies everything to my pre-allocated /dev/hdb15 and, reboot.I always install my lilo in the beginning of the install partition, I don't trust my MBR to the livecd-install, (after all it is my code), and so the first reboot is into my "production" partition. A quick check that the newly installed pclos92 partition has all the necessary kernel and initrd links in the /boot, rerun the lilo -v and comes the moment of truth, booting into p.92.Booting nicely, NVIDIA splash screen comes up as it supposed to, the KDM login screen has only my userid and root (guest is removed) all the passwords are working, so I can start on the customization.The first thing is to customize the initrd. Now, that requires a little bit of explanation. The kernel, starting with 2.4 is huge, doesn't fit on a standard floppy (That's why we can't create boot floppies easily), and the number of different device drivers is growing every day. If the kernel would have all the drivers compiled in it, it would require huge amount of RAM. To minimize the footprint in the memory, all the device drivers compiled as modules, and the kernel during the boot process loads only those drivers, which absolutely necessary. The livecd during the hwdetect phase loads all and every possible drivers in order to "catch" the right device driver required by the various sata, scsi, usb devices, but unfortunately there is no sure way to tell which driver is in use, which one is just loaded but not in use yet, or which one is not needed at all, because the pc doesn't have that type of device.After the hard disk install the first thing the loader loads (besides the kernel) an mini operating system, so small that it fits entirely in memory, that's why it is called initial ram disk, or initrd for short. This initrd has to have the necessary device drivers to mount the root (/) file system and all the programs and data it contains. If you install the livecd for example on sata, scsi, or usb hard disk, the initrd should contain the necessary sata, scsi or usb drivers. In order to not miss any, the livecd install includes all of them rather than miss some. It does this by editing the /etc/sysconfig/installkernel file's INITRDOPTS= parameter, telling which modules to include in the initrd. That has both advantages and disadvantages.* Pro: If you latter decide to upgrade your pc's slow ide harddrive with faster scsi or sata drive, it is just plug and play, the drivers are already there.* Cons: since you are loading a tons of drivers on every boot it is lot slower, and require more RAM, i.e. your performance suffers.* Solution: customize the initrd.To do this, you have edit the /etc/sysconfig/installkernel INITRDOPTS= parameter, leaving only those drivers which required.Since I don't have no scsi, no sata, no usb HD, my installkernel is rather simple:[root@localhost config]# cat /etc/sysconfig/installkernel# -*- Mode: shell-script -*-# $Id: installkernel.sysconfig,v 1.14 2004/06/29 04:50:42 prigaux Exp $# Configuration option when installing a kernel and initrscript.# Set this to yes if you never want link from /boot/vmlinuz to the# kernel.NOLINK=""# Set this to yes if you don't want to add entry to your bootloaderNOENTRY=""# If you want to pass options to the "make-initrd" helper script you# can do it here.INITRDOPTS=""More specific examples are here: http://www.pclinuxonline.com/modules.php?m...c=8201&forum=57After you customized the installkernel, you will have to regenerate the initrd.img. That's easily accomplished by reinstalling the current kernel, or installing a higher kernel. Note: If you reinstalling the current kernel you have to delete your current initrd.img (the file the /boot/initrd.img links to) to force the installkernel script to regenerate the initrd and rerun the lilo.I choose to install the 2.6.13-oci2 kernel, so I didn't have to delete the initrd.The next step was PCC->System->Configure System services.Quite logically the less nonessential services you start at the boot, faster your system will boot. How do you tell which are essential which are not?It is easy. If you see any service with the boot checkmark and, with stopped state, it is non-essential. In my case for example hplip since I don't have any hp printer, mdadm, since I don't have any raid device, or acpi and acpid, since I boot with acpi=off. If you don't know what the service is doing the info button will give you a short explanation, but clearly if the service marked stopped with the boot checkmark, it can't be essential otherwise you would not be able to boot. Next you might want to mark some services started on boot, that's strictly your preference and it requires a little bit of research.I marked the dkms service (since I want to recompile the NVIDIA driver if I change a kernel) and marked the sshd service, since some times I want to take over my home machine from the office.Once this was over, I edited my /etc/fstab to automount my shared directories and my "production" pclos partitions, copied over a few directories and files from my "production" pclos, to preserve such custom setups as .mozilla directory for bookmarks and cookies, .skype directory for contact lists. kontactrc from the ~/.kde/share/config for my email setup, but not much more.To setup the desktop to my liking is not more than a half an hour exercise, and if I redo from scratch, I know that I got a clean setup.After reboot (that one is really fast, because I normally set my desktop to autologin my userid into KDE) the only thing remained to issue an rpm -qa|sort>/tmp/p92.list command. Of course I had a similar command on my production pclos. BTW. this just creates a sorted list of all the rpm's installed on this system.Using Kompare it is very easy to identify the differences between my 2 installs, and install with apt-get or synaptic, only those packages what I know I am going to use (and maybe uninstall packages what i know for sure won't use)The result: A clean, streamlined, optimized, up to date system, ready for all the abuses, I normally inflict on my systems.
Thanks for sharing that with us Ivan !! :o BrunoPS: More tips for PCLos see: http://www.pclinuxonline.com/wiki/HomePage
Link to comment
Share on other sites

SLACKWARE TIPS ( 4 )

( Missing .bashrc in Slackware )

 

Terminal tweak in Slackware

 

You might have noticed that customizing your prompt ( see: Tweaking The_Prompt ) in Slackware seems impossible because there is no .bashrc in your /home, nor in /root

 

To overcome this problem you need to create 3 new files, and at the same time we will take the occasion to add a few more tweaks in order to make the use of the terminal more comfortable.

 

First we need a .bash_profile with the following text: ( please adapt the /home/bruno to your own username )

# /home/bruno/.bash_profile

 

# make sure .bashrc works

source ~/.bashrc

 

Next we make the .bashrc with this text:

# /home/bruno/.bashrc

 

# resize text to window

shopt -s checkwinsize

 

# custom prompt

PS1="\[\e[36;1m\][\u:\w]$ \[\e[0m\]"

 

# user aliases

alias l='ls'

alias la='ls -a'

alias lal='ls -al'

alias ll='ls -l'

alias lsd='ls -d */'

# just to be sure

alias rm='rm -i'

alias mv='mv -i'

alias cp='cp -i'

 

You see I added a few aliases, a customized prompt ( insert your own version if you have one ) and a trick to resize the text to the terminal window.

 

The last file you need is a /root/.bashrc: ( a /root/.bash_profile is not needed )

# /root/.bashrc

 

# resize text to window

shopt -s checkwinsize

 

# custom prompt

PS1="\[\e[35;1m\][\u@\h \W]# \[\e[0m\]"

 

# user aliases

alias l='ls'

alias la='ls -a'

alias lal='ls -al'

alias ll='ls -l'

alias lsd='ls -d */'

alias ls='ls -F --color=auto'

# just to be sure

alias rm='rm -i'

alias mv='mv -i'

alias cp='cp -i'

 

In the root version of the .bashrc you see an extra alias line "alias ls='ls -F --color=auto'" . . . this gives you, as root, the same colors in the terminal as the user has by default when giving the "ls" command.

 

Happy Tweaking !

 

cool.gif Bruno

Link to comment
Share on other sites

  • 4 weeks later...

PRINTING WEB PAGES AS .TXT( Using the command line )Imagine you want to print a web page as a simple text file, no pictures, no colors, just text for easy reading. In that case this could be an example:

$ lynx -dump http://www.damnsmalllinux.org >DSL.txt

( Sure you need to have "lynx" installed )The command above places a "DSL.txt" text file ready for printing in your /home directory so next you can send it to your printer:

$ lpr DSL.txt

That's all there is to it, simple, clean, efficient . . . . . ( you will notice that at the bottom of the file that all the links from the site are nicely numbered and listed ):) Bruno

Link to comment
Share on other sites

CHANGING HOSTNAME ( In Mandriva, PCLOS, Fedora, Slackware, Debian & Knoppix )There are 2 ways to change the host name, a temporary and a permanent way.1). Giving the command:

$ hostname jupiter

Will change the hostname to "jupiter" untill the next reboot.2). The "permanent" way is a bit different depending the distro you run:Fedora, Mandriva, PCLosIf you want the hostname to stick even after a reboot in Fedora,Mandriva or PCLos there are 2 files to change: the /etc/sysconfig/network and the /etc/hosts:In the /etc/sysconfig/network I added the line:

HOSTNAME=jupiter

Next in the /etc/hosts file I changed the "127.0.0.1 localhost.localdomain localhost" to:

127.0.0.1	   jupiter localhost

Finally reboot and you will see that the hostname is set.Slackware & DebianIn Slackware and Debian you set the hostname during the install, it is stored in /etc/HOSTNAME ( Slackware ) and /etc/hostname ( Debian )Knoppix ( HD install )For Knoppix see tip about changing hostname in D Small Linux: Here:thumbsup: Bruno

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

×
×
  • Create New...