On FreeBSD if you use the "-i" flag with sed you must specify a backup file. The simple fix, if you don't want a backup file is to use "" (two quotes, no space between them). You could also use any other filename you wished.
Examples:
BAD: sed -i s/192.168.1.1/192.168.1.44/g file.txt
GOOD: sed -i "" s/192.168.1.1/192.168.1.44/g file.txt
Monday, April 23, 2012
Wednesday, April 18, 2012
Updating the Locate database in FreeBSD (updatedb)
When I was running CentOS boxes if I needed to find a recently installed program or new file I would just run updatedb. That however doesn't work as expected on FreeBSD (9.0 in my case).
When I first installed the machine I tried to run locate SOMETHING and got the error message locate: "database too small: /var/db/locate.database"
My first instinct was to run updatedb, which of course returns "updatedb: Command not found.". It turns out there is a weekly cron job that will update the locate database, but if your server isn't on then (as is the case for me, since its a virtual machine on my local PC to toy around with) then you need to run the command manually.
Just run the following script: "/etc/periodic/weekly/310.locate". It may take a few minutes to run so just let it do its thing, or run it in a screen session.
By the way, I will most likely be posting a lot of FreeBSD tips and tricks in the coming months, as my new company runs mostly FreeBSD and Perl.
When I first installed the machine I tried to run locate SOMETHING and got the error message locate: "database too small: /var/db/locate.database"
My first instinct was to run updatedb, which of course returns "updatedb: Command not found.". It turns out there is a weekly cron job that will update the locate database, but if your server isn't on then (as is the case for me, since its a virtual machine on my local PC to toy around with) then you need to run the command manually.
Just run the following script: "/etc/periodic/weekly/310.locate". It may take a few minutes to run so just let it do its thing, or run it in a screen session.
By the way, I will most likely be posting a lot of FreeBSD tips and tricks in the coming months, as my new company runs mostly FreeBSD and Perl.
Subscribe to:
Posts (Atom)