March 2009

The Archives

  • 03.12.09
    nohup: put your computer to work and leave cmd, scripts | pfortuny | (0)
    $ nohup R -q -f batch & That was how I made my Department's computer run a lot of computations in R from a remote shell, while being able to log out without killing the process (it runs on even if you log out). You might redirect the output somewhere (it gets saved in a file called nohup.out by default). Nohup stands for "Do not comply with HUP signals".
  • 03.10.09
    Converting filenames to lowercase cmd | rafacas | (0)
    $ for i in *; do mv "$i" "$(echo $i|tr [:upper:] [:lower:])"; done Turns all uppercase characters in the present directory filenames into lowercase. There is no collision detection, so if some name gets repeated, the destination file will be overwritten and the first file will be lost. Use the above if you know that there will be no collisions.
  • 03.08.09
    System information cmd, shell | n0str0m0 | (0)
    $ echo $OSTYPE $MACHTYPE freebsd7.1 amd64-portbld-freebsd7.1 Easy way of getting information with bash
  • 03.06.09
    Accents everywhere (to be removed, obviously) scripts, shell | pfortuny | (2)
    Accents have again (I still live in Spain and do some work for the Spanish Administration) crept into my terminal. This time it was a group of University professors which had to create a lot of files and directories concerning a historical catalog and even though I remember telling the coordinator not to use accents or spaces or any funny characters, they did it. I should have known better... The problem was then to take away all spaces and non-ASCII characters from directory and file names. After thinking about it a bit, I came up with the solution below. There may be ...
  • 03.04.09
    Removing blank lines from a file shell | rafacas | (0)
    Sometimes I need to remove blank lines from a specific file. I usually do it with the two following commands: $ grep -v "^$" file or $ sed '/^$/d' file Obviously, if you want to save the output you should redirect it to another file, for example: $ sed '/^$/d' file1 > file2
  • 03.02.09
    Adding ‘tail -f’ behavior to ‘less’ cmd | rafacas | (0)
    $ less +F /var/log/messages The +F option turns on less 'follow mode'. It is similar to tail -f but you will have the benefits of less, like scrolling up and down. To stop tailing, use Ctrl-C and to resume it, press Shift-F.