How to: FreeBSD Popular Commands
Verified and Tested 08/28/15
Nothing is more frustrating than wanting to do something and not knowing how to do it. In this How-to, we will be going over the some of FreeBSD’s more popular commands so we could make our lives easier and work more effective.
You need a FreeBSD server that is configured with a static IP address.
Hierarchy Manual in FreeBSD
In FreeBSD, sometimes it can be difficult to remember so many directories and what they contain. Similar to Linux systems there is a manual that you can bring up and refresh your memory and continue working on your task. This is the directory Hierarchy manual, and it can be view with the following command.
Hard Drive and Memory Information in FreeBSD
To find out information about your hard drive and how much space you have available or are consuming, the following command can help you accomplish this task. It will display this information in a very simple way. Go for it!
If you would like to see how much RAM is available or assigned to your FeeBSD server, grab the following command that will display the real memory (total amount) and the available memory (available amount).
grep memory /var/run/dmesg.boot
Current OS Version in FreeBSD
If you are not sure of the exact version of FreeBSD that is on your system, this can be completed with the following command. It will display the running version of FreeBSD on your system.
Package Information in FreeBSD
Knowing what you currently have installed on your FreeBSD server is very important because it helps in keeping things in order. To find out what Packages and version of those packages, copy the command below and paste it in your terminal.
Installing and Uninstalling Packages in FreeBSD
FreeBSD uses Packages as their program/software name convention. If you would like to install any package into your FreeBSD system, this could be accomplished with the command replacing the brackets and package with the one you want to be installed:
pkg install [package]
You can also run the following command replacing the brackets and package with the one you want to be removed:
pkg remove [package]
Listing Files, Changing Directories and Printing current Directory in FreeBSD
The ls(list) command is used to view files within specified directories. To view the files under your current directory run the following command.
You can also change or navigate through different directories within FreeBSD with the following command:
Although the following command applies to many Linux Operating Systems, it can also be used in FreeBSD. It is beneficial because it prints the directory that is currently being used. This helps out if you are not sure in what directory you find yourself in. Give it a try!
Creating and Removing Files in FreeBSD
Creating files can be a bit can be tricky if you are not familiar with FreeBSD or Linux. To create a file in FreeBSD, it is done using the touch command. Input the following command replacing the brackets and myfile with the file that you want to be created(note: then you use your vi Text editor to make changes in the file):
You could also remove files with the rm command. Copy and paste the following command replacing the brackets and myfile with the file that you want to remove or deleted.
Moving and Copying Files in FreeBSD
Furthermore, you could move files from one place to the other following the command below replacing the myfile with your files name and location with the path that you want to place that file.
mv myfile location
To copy a file in FreeBSD, this can be accomplished by simply replacing the myfile with your files name and myfile2 with the name of the copied file.
cp myfile myfile2
Making/Removing Directories in FreeBSD
If you would like to create/make new directories in FreeBSD, this could be accomplished with the following command replacing the brackets and mydir with the new directory that you want to be created.
To remove a previous or newly created directory, this could be accomplished with the following command replacing the brackets and mydir with the specified directory that you want to be removed.
Congratulations! This completes this tutorial on FreeBSD Popular Commands. I hope that you find this information useful just like it was to me. Thank you for following along and feel free to check back with us for further updates, or learn more about our reliable HIPAA-compliant cloud hosting solutions.
Get a $250 Credit and Access to Our Free Tier!
Free Tier includes:
G3.2GB Cloud VPS a Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year