from small one page howto to huge articles all in one place

search text in:

Other sites:

Last additions:
How to make X listen on port 6000

How to make X listen on port 6000






average rating: 1.5 (4 votes) (1=very good 6=terrible)

May, 25th 2007:
April, 26th 2007:
Apr, 10th. 2007:
Druckversion . pdf icon
You are here: Tutorials per portage category->sys-devel->make

Thanks to Lars Weiler for providing this week's tip.

Usualy make from sys-devel/make is known as a tool for compiling applications. But it could also be used to provide often used commands so that they can be accessed easily.

Quite everybody wants to do backups. This could be done by packing them with tar. For instance, we want to pack the ~/Mail folder and name the file with a date:

Code Listing 1: tar ~/Mail with date included

$ tar cvjf ~/Backups/Mail-`date +%F`.tar.bz2 ~/Mail

After that we copy that file (and possibly more) to another computer by using rsync and delete all the files in ~/Backups afterwards:

Code Listing 2: Copy backup-file to another computer with rsync

$ rsync -avute ssh ~/Backups/ user@othermachine:~/Backups/
% rm ~/Backups/*

And now comes the clue with make. After a week you already forgot the commands. Why not store them in a Makefile located in the home-directory, so that you only have to call make backup?

Inside the Makefile (beware of the uppercased 'M') we provide two targets for the commands, so that we can call them separately, e.g. if you only want to copy the files. The first target backup will only call the other targets in the given order:

Code Listing 3: Sample Makefile for backups

backup: compress \

tar cvjf ~/Backups/Mail-`date +%F`.tar.bz2 ~/Mail

rsync -avute ssh ~/Backups/ user@othermachine:~/Backups/
rm ~/Backups/*

Now we can call make backup in the home directory and the ~/Mail-folder will be compressed and copied to the other computer. The restore-command-set will be your homework ;-)

Of course, there is a wide use for batched processes with Makefiles. Think about all the things you ever wanted to have scripted with easy usability. You can find more instructions in the info make pages.
rate this article:
current rating: average rating: 5.0 (1 votes) (1=very good 6=terrible)
Your rating:
Very good (1) Good (2) ok (3) average (4) bad (5) terrible (6)


Other free services
Shorten long
URLs to short
links like
Reverse DNS lookup
Find out which hostname(s)
resolve to a
given IP or other hostnames for the server

New Packages

- as rdf newsfeed
- as rss newsfeed
- as Atom newsfeed
rdf newsfeed | rss newsfeed | Atom newsfeed
- Powered by LeopardCMS - Running on Gentoo -
Copyright 2004-2018 Sascha Nitsch Unternehmensberatung UG(haftungsbeschänkt)
Valid XHTML1.1 : Valid CSS : buttonmaker
- Level Triple-A Conformance to Web Content Accessibility Guidelines 1.0 -
- Copyright and legal notices -
Time to create this page: 79.3 ms