Find and replace text within a file using sed
The procedure to change the text in files under Linux/Unix using sed:
- Use Stream EDitor (sed) as follows:
- sed -i 's/old-text/new-text/g' input.txt
- The s is the substitute command of sed for find and replace
- It tells sed to find all occurrences of ‘old-text’ and replace with ‘new-text’ in a file named input.txt
- Verify that file has been updated:
- more input.txt
How to mount a ISO in FreeBSD/NAS:
mount -t cd9660 /dev/`mdconfig -f cdimage.iso` /mnt
If you SSH to the same server a lot and don’t want to type the password each time you can configure SSH so you don’t have to.
First login to your terminal as normal and run
This will ask you the name of the key pair file you want to use.
It will suggest ~/.ssh/id_rsa
It will also create an id_rsa.pub file.
Next you need to “copy” that file to the server you want to connect to, you do by using the ssh-copy-id command.
$ ssh-copy-id user@hostname
You will be prompted for your password one last time, but from that point on you should be able to connect without using your password.
NOTE: If you want to do the same thing to another host, all you need to do is use the ssh-copy-id command again and replace the hostname with the new hostname.
Using FreeBSD ports means compiling software by executing make install clean. This is great since it automatically fetches the dependencies then compile them.
using make install clean, most of the packages have configuration options in which I have to manually choose the options. So if I install packageA with a lot of dependencies, those dependencies may have each a configuration option in which I have to select.
To select default Configuration i know 3 options that you can make use :
For csh-based Shell:
# setenv BATCH yes
OR for sh-based Shell:
# export BATCH=”yes”
# make -DBATCH install clean
# make config-recursive
usually to get all of the options displayed for you to choose upfront. I say “usually” because not all ports support it, but most do.
Installing VMware tools on Freebsd 10
- When installing OS, add kernel src
- Once installed, start the tools installer
Player, Manage, Install VMware tools
- Mount the tools cd in the OS
# mount -t cd9660 -o -e /dev/cd0 /cdrom
Assumes /dev/cd0 is your cdrom and that /cdrom exits
- Copy install from cd to local file system
# cp /cdrom/vmware-freebsd-tools.tar.gz /tmp
- Eject cdrom
# umount /cdrom
then Click Player, Manage, Cancel VMware tools installation
- Install required packages
# pkg install compat6x-i386
# pkg install perl5
# pkg install xf86-input-vmmouse
- Create link to perl (so vmware tools can find it)
# ln -s /usr/local/bin/perl /usr/bin/perl
- Extract vmware tools installer ad start installer
# cd /tmp
# tar zxvf vmware-freebsd-tools.tar.gz
# cd vmware-tools-distrib
I just press enter to accept all the defaults, you may want to read all the options and change some if required.
To install enlightenment your need to do something like this :
# pkg install enlightenment
to your .xinitrc file in your home directory
then when you start X11, enlightenment will also start.
to start X11/enlightenment use
For installing Gnome desktop environment in FreeBSD 10, the following steps can be used.
Install the needed packages
pkg install gnome-desktop gdm xorg xf86-video-fbdev
Add the following lines in /etc/rc.conf
Reboot the machine. It will boot into Gnome login screen.
Upgrading Using “FreeBSD Update”
# freebsd-update fetch
# freebsd-update install