FreeBSD

Find and replace text within a file using sed

Find and replace text within a file using sed

The procedure to change the text in files under Linux/Unix using sed:
  1. Use Stream EDitor (sed) as follows:
  2. sed -i 's/old-text/new-text/g' input.txt
  3. The s is the substitute command of sed for find and replace
  4. It tells sed to find all occurrences of ‘old-text’ and replace with ‘new-text’ in a file named input.txt
  5. Verify that file has been updated:
  6. more input.txt

Setting up SSH to use key pairs

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

$ ssh-keygen

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

Install NGINX on FreeBSD

Installing NGINX
  1. Install NGINX $ pkg install nginx
  2. Create folder $ mkdir /data/www
  3. Find configuration file nginx.conf It’s either in /usr/local/nginx/conf, /etc/nginx or /usr/local/etc/nginx
  4. Edit conf file, comment out everything then add a new server block http { server { } }
  5. Add a location into the server block location / { root /data/www; } location /images/ { root /data; }
  6. Create a basic html file in /data/www <html> <head></head> <body><h1&gt
Tags:

Installing VMware tools on Freebsd 10

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 inst
Tags:

Installing Gnome on FreeBSD 10

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 gnome_enable="YES" moused_enable="YES" dbus_enable="YES" hald_enable="YES" Reboot the machine. It will boot into Gnome login screen.
Tags:

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer