Tips Linux Explorers   All Things Linux Forum   Great Linux Links   Hometown   Email 


Keeping it simple: You know by now that "rm" removes a file, permanently !
Wouldn't it be nice if we could move it to the recycle bin with a simple command instead ?

We're gonna make that command and call it: "del"
( YES ! making our own commands ! )

First a little script:

$ vi /usr/bin/del

Here is the text for the script:

QUOTE (Text @ Script)
mv $1 ~/Desktop/Trash
#End script

< Esc >

Make it executable

# chmod 0775 /usr/bin/del

Now if we do

$ del tessst

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

$ mv tessst /home/bruno/Desktop/Trash

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

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

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

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

More about bashscripts see: Introduction to bash Shell Scripting


-- Apr 29 2003 ( Revised Dec 9 2005 ) --

Tips Linux Explorers   All Things Linux Forum   Great Linux Links   Hometown   Email