December 2008
The Archives
-
12.30.08rsync with ssh-rsa+authorized_keysMuch like explained in a previous post, one can use a passwordless RSA key to set up a cron job doing an rsync of one's computer on a remote server, via ssh. The relevant part of the authorized_keys file is (everything in the same line): command="rsync --server -vlogDtpr . /home/pfortuny/backup/",no-port-forwarding, no-agent-forwarding,no-X11-forwarding,no-pty ssh-rsa ..... Taking into account that the -vlogDtpr depends on the specific options of the rsync command you issue. In my case, the script is simply (right now) $ cat ./bin/backup.sh #!/bin/sh cd /home/pfortuny /usr/bin/rsync -av -e "ssh -i /home/pfortuny/.ssh/backup_key" --filter ": .rsync.dirs" \ ~/ pfortuny@remote.server.mine:"~/backup/" Comments: The option -av is expanded to -vlogDtpr on the server, ...
-
12.28.08Last system boot date$ who -b reboot ~ 16 nov 22:02 Shows the system's boot date and time.
-
12.26.08Updating freebsdfreebsd-update is one of the ways available to update your FreeBSD system. In the simplest form, you can use it this way: % freebsd-update fetch % freebsd-update install These two commands above, fetch and install updates for your release. freebsd-update can also perform a rollback, be scheduled to fetch updates automatically and used to fetch new packages from a different release. freebsd-update's behaviour is ruled by the /etc/freebsd-update.conf. You can specify which components you want to be monitored by freebsd-update (base system, kernel, sources...) Though BSDs systems can be tough, this is an example of how easy things can turn out from time to time :)
-
12.24.08screen: a short list of commandsHaving already introduced screen in detail, I am now listing some specific commands. Recall that once a screen "session" is started, in order to get a screen command executed, you need to press C-a (that is, Ctrl and a) and then another key (C-a is the prefix for 'screen' and the other key is the specific command). To the point (notice that commands are case-sensitive): C-a c (we mentioned this one in the previous article): create a new screen (and give it the focus). C-a S: split the tty in "one part more". If a screen occupies the whole terminal, this command splits ...
-
12.22.08Disabling promiscuous mode on an interface# ifconfig eth0 -promisc Disables promiscous mode on the eth0 interface.
-
12.20.08Whereis?The whereis command shows information about paths for binary, sources and man pages for a given program: $ whereis ls ls: /bin/ls /usr/share/man/man1/ls.1.gz /usr/src/bin/ls On BSD systems it shows the location at the ports hierarchy from which you can install the program.
-
12.18.08Cron job every 5 minutes$ cat < /var/cron/tabs/pfortuny */5 * * * * /usr/bin/my_task The specified task is run every 5 minutes.
-
12.16.08TTYtter: twitter client for real commandlinersIf you are a twitter adict (I know you are already a commandliner ;) TTYtter is your client. TTYtter requires only Perl 5.005 or better, and either cURL or Lynx. It supports encryption as long as your Lynx or cURL does. If your client supports it you can configure TTYtter to use SSL changing the relevant URLs. These can be changed using TTYter options (-url, -rurl, -uurl, -wurl, -update, -dmurl and -frurl) or you can cut and paste the following code into your .ttytterrc file in your $HOME directory: url=https://twitter.com/statuses/friends_timeline.json rurl=https://twitter.com/statuses/replies.json uurl=https://twitter.com/statuses/user_timeline wurl=https://twitter.com/users/show update=https://twitter.com/statuses/update.json dmurl=https://twitter.com/direct_messages.json frurl=https://twitter.com/friendships/exists.json The default cURL's certificate bundle is old and may not support Twitter's current ...
-
12.14.08Dealing with imagesIt is usual to think it is not possible to deal with images if we work from the command line. However convert, part of the ImageMagick suite is able to do a great job. Example $ convert file.gif file.jpg Converts from GIF to JPG format.
-
12.12.08awk specifying the field separator$ awk -F'=| ' '{print $3}' < code.pl Prints the third field in each line of regr_FF, using the regexp '=| ' as the field separator (FS). The example regexp means "either an equal sign or a space'.