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

How do you do this, Bruno? Just when I think that I'm starting to grasp a few things, I see that it's like grasping water (to me). Hope you don't mind, but I'm printing out this entire thread; by Christmas it should be enough for a novelette.

~ ® Linux User # 314972~® Ubuntu User # 12930 ~

If you tell the truth you don't have to remember anything. -- Mark Twain

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

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

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

First backup the current prompt

$ SAVE=$PS1

If after tweaking you want the old one back

$ PS1=$SAVE

These are the codes we will use:
\u = username of current user
\w = current directory
\h = first part of the hostname
\H = the full hostname
\d = the current date
= the current time 24hrs format
\T = the current time 12hrs format
@ = @

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

$ vi /home/bruno/.bashrc

< i > ( insert mode )
Leave the first few lines as they are.
PS1="[\u:\w]$ " ( a space between the $ and " ) ( this will set the prompt like mine above )
< Esc >
< ZZ >
Close the console, open it again and you'll see the prompt has changed !

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

As you are at an empty prompt press the "arrow-up" key and you will see the previous command you typed in !
Press again, and again, and again, see all the commands that were stored in the "bash-history"

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

More fun, type in:

$ history

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

$ !8

Will get you number 8 of that list

$ !v

And you will get the last command that started with v

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

Sure this was a very short example, a 3 line script, it only holds one command, but you could put as many lines in the script as you want and execute it with a four letter word.
If there are more commands in the script it will execute them in the order that they are noted down.

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

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

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

Be one step ahaid and backup your /home directory from time to time.
There are many different ways to do this, in Mandrake you can go to the Mandrake Control Center and use drakx to do this automated on a regular basis.

Right, that's it, we have made two scripts!
Now if we type backup at the prompt it will create a tar.gz file in your home directory.
And restore will restore the backuped files.
Remember before making your next backup to delete the old one first !

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

It's surprisingly simple though.

On the setup tab of the mail section:
- Mail reading program = evolution ( or whatever program you prefer )
- Notify ( sound ) program = /usr/bin/play /home/bruno/sounds/newmail.wav ( needles to say: the path to your soundfile is up to you ) If "/usr/bin/play" gives problems you can use "/usr/bin/artsplay" too.
- Check local mailboxes = 300 sec - Do remote checks every = 2 minutes

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

Lot's of people complain about the ugly fonts in the OpenOffice.org menu's.
They don't bother me, but then . . . . . . I changed them

Here is how to do it:
Go to --> Tools --> Options --> OpenOffice.org --> Font replacement
Click on "Andale Sans UI" and you will see "Andale Sans UI" appear in the "Font" box, in the "Replace" box choose "Helvetica" and apply.

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

They say that Linux is tweaker's heaven, here is why:
All of the configuration files are readable and quiete easy to understand, here is a list of the most common files and a short description what they are about. ( go on, do have a look with "cat" )

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

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

Be one step ahaid and backup your /home directory from time to time. There are many different ways to do this, in Mandrake you can go to the Mandrake Control Center and use darkx to do this automated on a regular basis.

O.K. we're starting the tour, not using the console this time but by simply clicking a few icons
Home --> /etc --> /rc.d ( rc.d ! not the other rc's !! )

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

We go one step back to /etc/rc.d and have a look at the "rc.local" file, right-click on it and choose "Preview in Embedded KDE Advanced Text Editor Component" that's a safe way to have see the file.
"rc.local" is a script where you could add your own lines of code at the bottom in order to get a program started at boot in the last runlevel. ( see the "#!/bin/sh" on the first line ? This is no bash script but a shell script ! )

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

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

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

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

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

In Linux we talk about "users" and "groups" I'm sure you know about this.
They have different permissions regarding access to files. There is a clever way to see how permissions are set.

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

$ ls -l

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

$ ls -l /etc/gnome/gnomerc

This is what you will get:

Quote

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

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

The first one tells you whether it is a file ( - ) a directory ( d ) or a link ( l )
The next three are for the "user" "r"ead "w"rite and e"x"ecute. The next three for the "group" and the last three for all "others"

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

$ ls -al /home/bruno

Will give a long list of all the files in your home directory and their permissions.
The list is even to long for your screen:
"ls -al /home/bruno >permissions"
Places a textfile called permissions in your home directory, do print it out for further inspection, there is a lot to learn there.

Changing the permissions can be done with names and numbers, I like the numbers:
( do you remember the chmod 755 command from a few posts ago ? )

# chmod 754 filename

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

Here is why:
4=read 2=write 1=execute.
The three numbers in the chmod above are for the "user" ( the first number ), "group" ( the second number ) and "others" ( the third number )

So if I want to give the user all permissions: 4+2+1=7
and i give the group read an execute permissions: 4+1=5
and all others only read permission 4=4

Chown and chgrp are two commands also related to permissions:

# chown

( Changes the owner of the file. )

# chown anna tessst

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

# chgrp

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

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

# chown anna:anna tessst

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

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

# chown -R anna:anna tessst

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

Bruno

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

Quote

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

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

I had this problem, I really do like Evolution for my mail and it used to open the links send to me in an email in Galeon, a nice fast browser.
Suddenly with the new Mandrake 9.1 it opened the links in Mozilla, that's a much slower browser.
So I found the tweak :

$ gnome-control-center

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

The main difference between hardlinks and symlinks ( symbolic or softlinks ) are:
1.) You cannot make a hardlink to a directory.
2.) If you remove the original file of a hardlink the link will still show you the content of the file.
3.) A symlink can link a directory
4.) The symlink is useless as you remove the original file.

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

Now if we would remove the original "fileA"

$ rm fileA

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

$ cat fileB

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

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

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