Archive for the 'FreeBSD' Category

Adding Shell to Vim Using Screen

When programming in Perl or any language that requires you to run it from shell it is often helpful to have two screens open at once. One screen for your editor and one screen for running the program. This is how most IDEs (Integrated Development Environment) are structured; however, since I love Vim and the Linux command line I use a program called screen to make my own IDE type setup. Read more »

How Do I Find Open Ports on FreeBSD?

Sometimes it is helpful to know which ports are currently open on your server. On my FreeBSD servers I like to use the sockstat command. It is very similar to the netstat command for Windows or Linux. You can configure it to show IPv4 ports, IPv6 or both. Read more »

Detecting a Mount in BASH

Often times we will use bash to create scripts for backing up or transfering files. A lot of times these files are transfered over a mounted network share or an external usb drive. Since these mount points are not always mounted we need to come up with a script that will detect the mount before we perform our operation. I have come up with a script that I think is simple enough that uses df and grep to detect the mount. Read more »

Installing Mysql 5.1 on FreeBSD 7.0

Well we all love Mysql and a lot of times it is the first things we install on a server. I recently installed it on my FreeBSD 7.0 server and it went pretty smooth. You can install mysql from the FreeBSD Ports Collection. Read more »

Using Markers in Vim

Vim is a powerful text editor that pretty much rivals anything out there. Once you get used to the commands and hotkeys you can wiz through config files. Vim is also very popular for programming, not only for its productivity reasons but also because it incorporates syntax highlighting, aliases, code folding, line numbers, and more. Read more »

Creating Useful Bash Aliases

Bash can be configured to recognize any word you want and link it to a command. This is called an alias. This is can be used for many reasons. For instance, you could assign a short word like dvdbackupnow to execute a very long command that you don’t want to memorize each time you want to back up a DVD. We will explore a few useful aliases and how to add them to bash. Read more »

Encrypt a File on Linux or FreeBSD with GnuPG

If you ever wanted to quickly encrypt a file in Linux or FreeBSD without complicated keyrings and key files this is the post for you. In this guide we will use gnupg to quickly encrypt any file in Linux or FreeBSD. We will keep it simple and easy and leave out public/private key ring authentication and stick with simple password phrase encryption. Unlike password protection in zip files and other weak security implementation, PGP or GnuPG is a very secure way of encrypting files. It is pretty easy to set up so lets get going. Read more »

Numbering Each Line in a Text File

Sometimes we are given an error message that references a line number in a text file. We can number each line so we can find the error message right a way. In fact, we can print out the exact line that contains the error. This is often useful for finding errors in PHP. If there is an error in the syntax of PHP it will give you the line number it is on. Often times I don’t work in an environment that shows line numbers and I am not about to count each line by hand. Read more »

Next Page »