background preloader

Unix spells

Facebook Twitter

The magic behind configure, make, make install. If you’ve used any flavour of Unix for development, you’ve probably installed software from source with this magic incantation: .

The magic behind configure, make, make install

/configure make make install I know I’ve typed it a lot, but in my early days using Linux I didn’t really understand what it meant, I just knew that if I wanted to install software this was the spell to recite. Recently I’ve been building my own Unix tools, and I wanted to tap into this standard install process; not only is it familiar to many Unix users, it’s also a great starting point for building a package for Homebrew and the various Linux and BSD package managers.

It was time to dig into the Unix Grimoire and find out what the incantation does. What does all of this do There are three distinct steps in this process: 1. The configure script is responsible for getting ready to build the software on your specific system. Unix programs are often written in C, so we’ll usually need a C compiler to build them. 2. 3. Where do these scripts come from autotools . . . Simple howtos. Public key | Fingerprint | SCP | Tunneling See other tricks 25 ssh Public key authentication Connect to a host without password using public key authentication.

Simple howtos

The idea is to append your public key to the authorized_keys2 file on the remote host. For this example let's connect host-client to host-server, the key is generated on the client. . # ssh-keygen -t dsa -N '' # cat ~/.ssh/id_dsa.pub | ssh you@host-server "cat - >> ~/.ssh/authorized_keys2" Using the Windows client from ssh.com The non commercial version of the ssh.com client can be downloaded the main ftp site: ftp.ssh.com/pub/ssh/. Using putty for Windows is a simple and free ssh client for Windows. Check fingerprint At the first login, ssh will ask if the unknown host with the fingerprint has to be stored in the known hosts. Now the client connecting to this server can verify that he is connecting to the right server: # ssh linda The authenticity of host 'linda (192.168.16.54)' can't be established.

Ssh - How do I do Multihop SCP transfers? How to sync when you can't connect directly to the remote computer. As i stated here:Performing operation on each file synced with Unison I'm writing simple backup utility, and for providing reasonable level of incremental backup in easy way i decided to use Unison as my "engine".

How to sync when you can't connect directly to the remote computer

I'm handling above question problem (how to perform an action on each synced file) by using python watchdog (since i got no answers and haven't have better idea), here is code: watcher = Observer() handler = BackupHandler() watcher.schedule(handler, destination, True) watcher.start() try: sync_result = subprocess.call(['unison', '-batch', '-ignorearchives', source, destination]) while True: time.sleep(1) except Exception: watcher.stop() watcher.join() BackupHandler() is at the moment simple placeholder printing some dummy message on any event, destination and source are correct paths to folders read from config file (this is not an issue, but just saying)

Untitled. Bash Input Redirection. If you use the shell you surely know about redirection: # echo 'hello world' >output # cat <output The first line writes "hello world" to the file "output", the second reads it back and writes it to standard output (normally the terminal).

Bash Input Redirection

Then there are "here" documents: # cat <<EOF > hello > world > EOF A "here" document is essentially a temporary, nameless file that is used as input to a command, here the "cat" command. A less commonly seen form of here document is the "here" string: # cat <<<'hello world' In this form the string following the "<<<" becomes the content of the "here" document. Another less commonly seen form of redirection is redirecting to a specific file descriptor: # echo 'Error: oops' >&2 This redirects the output of the "echo" command to file descriptor 2, aka standard error. These features work in bash and may not be available in other shells.