UNIX is an operating system. And your known equivalent is Windows or the Mac. You may even know about Linux. The purpose of an OS is to accommodate programs in order to get some work done. Editing pictures, browsing the web or serving data from a database. It is the thing that lets you operate with the computer and the programs you install on it. Okay, this is not primary school. But sort of is.
UNIX and Linux (which are inspired in the former) are the operating systems which work behind the scenes in many sites. From banking systems, to communications, robotics, aeronautics, etc. Even your phone works on it. Android uses the Linux kernel and a lot of java in order to work. iOS from Apple uses large bits from the BSD’s and software of their own creation.
In UNIX design everything is represented as a file. Even devices are identified as files in the system. And UNIX is old. Painfully old. It dates back to the seventies and at the time computing wasn´t envisioned the way it is today nor the GUI (Graphical User Interface) had been invented. It was being designed at Xerox Park. Therefore the only way to edit files wasn’t very graphical so to speak. Everything was done at the command line and nowadays this is still a very useful method but a pain in some ways. Don´t think about it as an inferior method. Windows Server 2012 can be also installed and operated as a non graphical system. You should start getting used to computing as being served in different ways for different purposes.
So in UNIX, specially in the server side of UNIX, you will end up editing lots of files in order to accomplish a task. Configuring a desktop environment, a web server, many things are set up via editing files at the command line. Obviously modernity has come in and there are graphical ways to administer desktops and servers. If you are just looking for an OS to do the classical desktop work, editing pictures, filling cells on a spreadsheet with your own accounts, email, etc you can pick anything from a Linux distribution like OpenSUSE or Ubuntu, to a UNIX such as OpenIndiana, Mac OS X or Solaris. And ,of course, you can also do that with FreeBSD. However the latter comes with no GUI. If you want one you can install and configure one yourself but you can just download PC-BSD. It is vanilla FreeBSD with the graphical arrangements for a desktop already set for you to get stuff done. Great OS.
Editing files in UNIX
Editing files in a UNIX server is a basic task but it is cumbersome for the newbie. If you happen to have an Apple Macintosh you have an UNIX system but designed for the desktop. Although it still has the UNIX bits underneath. So grab the Finder, go to Applications, go to Utilities and look for an application called Terminal. (Linux or PCBSD users should look for the same kind of application. It can be called in different ways, terminal, konsole, etc.) Open it up. Welcome to the UNIX arena. Don´t you know what to do? If computing was well taught you could do stuff. Since it isn’t you can’t. Let me teach you one thing.
There is a realm of small programs built into that application called Terminal. One of them is called vi. Vi is a plain text editor. And vi is used to edit files in UNIX. Apple uses an improved type of vi, called Vim. Don’t look for buttons to push or boxes to tag. The same applies in a Linux distribution, any BSD and the proprietary UNIX left today. The terminal is a command line interpreter and you launch all those programs by typing commands in it. There are some list of commands (which are programs) for UNIX so you can have a basic idea of a common few. The wikipedia entry is an starting point but there are several others. For now, let’s edit our first file.
Select the Terminal.app and open it up. Now type vi and the name you want to give to that file. A blank page appears. Don’t type yet.
Vi is complicated. So if you start typing you won’t see anything happening. To get letters in you have to first press the letter “i” and then vi is in interactive mode. Press the letter “i”. And type something like: This is a test.
Now you want to stop editing the file and save it to disc. To stop editing, and that means being off the interactive mode press the key “ESC”. And to save the file press :wq. The : stands for input for orders. W stands for write. And the Q for quit.
You are now back at the terminal and you’ve just edited your first file in UNIX. Don’t you see it? Launch another program to enlist the content. Type ls. See your file listed? Do you want to remove it? If so type rm filename. rm stands for remove. And the filename must be the name you gave to the file. So if you entitled it as Test, to remove it you just have to type rm Test. And yes upper case and lower case matter in UNIX. A file called test is not accounted as the same file called Test.
If you find the articles in Adminbyaccident.com useful to you, please consider making a donation.
Use this link to get $200 credit at DigitalOcean and support Adminbyaccident.com costs.
Get $100 credit for free at Vultr using this link and support Adminbyaccident.com costs.
Mind Vultr supports FreeBSD on their VPS offer.