Journaling With Linux

Standard

I have found journaling to have a lot of benefits. It’s a form of life documentation, and it helps me solidify and build memories of the experiences I have gone through. Also, it gives me a fun activity to keep my writing skills sharp on a daily basis.

I like creating digital copies of everything whenever I can. Information is stored more efficiently and conveniently on a memory cell or on a hard drive platter than it does on a notebook. Creating a journal on a computer can be as simple as using Microsoft Word and saving word documents; however, I personally prefer a more simplistic approach that isn’t dependent on Microsoft Word, Libre Office, or one of many journaling applications out there. Something I can create and have direct control over; something that follows the UNIX philosophy.

Getting Started: Basics of Journaling the Linux Way

A list of files in a directory; they are all plain text files.

Plain Text Files

All of my journals are stored in plain text files. It’s done that way, as it makes the files really easy to work with in the terminal. Whatever editor one likes works; I personally use vi, but I’ll have nano in the commands ahead. Simple, huh? To get started one just has to create the directories, and type in the command line:

nano ~/journal/generaljournal/2013-07-03.txt

There are some shortcuts that make this easier. Needing to type that long command to get started is not very efficient. There’s a better way using alias command.

alias dream="nano ~/journal/dreamlog/"$(date +"%Y-%m-%d")".txt"
alias grat="nano ~/journal/gratitudelog/"$(date +"%Y-%m-%d")".txt"
alias journal="nano ~/journal/generaljournal/"$(date +"%Y-%m-%d")".txt"

These aliases creates a quick shortcut that automatically starts editing the appropriate and current day’s journal. There’s a command substitution using the ‘date’ command to automatically name the file the correct date. To make the alias commands permanent, add it to one’s .bashrc file:

A .bashrc file with various alias commands

Alias commands in the .bashrc file

I have different commands for my different journals. The dream command is for my dream log, the grat command is for my gratitude log (Gratitude should be something felt on more than a single day of the year, Thanksgiving), and journal is for my general journal. Whenever I start a new shell, I can immediately get started by simply typing the name of the journal I want to work on.

Reading, Searching, and Getting Random Journals

There are additional handy shortcuts and techniques that can be used to make everything better.

What if I want to read one of my journals like I would in a notebook, and read through the entries in sequence? This is pretty easy with the right commands, and a little know-how on regular expressions. Here’s an example:

tail -n +0 ~/journal/generaljournal/2013-06-*.txt | less
Showing what tail piped into less looks like

Output of tail piped into less

The tail command can be used to follow a series of text files, -n +0 makes tail follow the entire file, and piping that into less reads through the entries one at a time. Regular expressions can be used to match a specific year, month, or set of days. In the example above, the regular expression matches everything in June 2013.

Moving along, what if I want to search one of my journals for a specific key term?

grep -i "Happy" ~/journal/generaljournal/2013-06-*.txt
A happy journal entry

Output of grep

The grep command searches through the series of text files for the term used. The -i option makes the search case insensitive. No index is needed. If I want to search for a specific place or person, I can do so without shuffling through hundreds of journal entries.

Let’s say I want to pick out a random journal entry to read? This command is a little more complex, but it can be done with a little cleverness:

less $(ls ~/journal/generaljournal/2013-06-*.txt | shuf -n1)

This command works using ls to list the directory contents. Piping that into shuf -n1 picks one of the files at random. The file that is picked gets read using less.

I know a lot of people who use the fortune command to get a little surprise whenever they open up the terminal. In my case, I use the above command to pick a random entry from my gratitude log to help remind me of the amazing life I’ve lived. Only difference is that cat is used instead of less to keep my shell usable when it starts up.

Shortcuts for Reading, Searching, and getting Random Journals

Remember how alias commands were used to make writing to each journal easier? What about the three examples up above? Alias commands won’t work very well since the commands used above are dependent on parameters and regular expressions. Thankfully, bash has something called a shell function that was made exactly for this purpose!

dreamread() { tail -n +0 ~/journal/dreamlog/$1.txt | less ; }
gratread() { tail -n +0 ~/journal/gratitudelog/$1.txt | less ; }
journalread() { tail -n +0 ~/journal/generaljournal/$1.txt | less ; }
dreamsearch() { grep -i $1 ~/journal/dreamlog/$2.txt ; }
gratsearch() { grep -i $1 ~/journal/gratitudelog/$2.txt ; }
journalsearch() { grep -i $1 ~/journal/generaljournal/$2.txt ; }
dreamrandom() { less $(ls ~/journal/dreamlog/$1.txt | shuf -n1) ; }
gratrandom() { less $(ls ~/journal/gratitudelog/$1.txt | shuf -n1) ; }
journalrandom() { less $(ls ~/journal/generaljournal/$1.txt | shuf -n1) ; }
All the shell functions showcased in the .bashrc file

All the shell functions in .bashrc

Everything so far is now in a nice shortcut. Here are examples of the new shell functions being used:

dreamread 2013-03-*
gratrandom 2013-03-*
journalsearch linux 2013-*

Notes About Securing the Journal

Naturally, a personal journal will probably have a lot of sensitive information that would be awful if it were released publicly. Just as a teenage girl doesn’t want her younger brother reading her private journal, I don’t want other users snooping and reading mine.

The file permissions for the journal should be set properly:

chmod 700 ~/journal -R
chmod g+s ~/journal -R

The first command sets the file permissions of the journal directory to read, write, and execute by the owner only. The second command enables the SGID bit, which causes all new files added to the journal to inherit the correct file permissions.

If setting file permissions isn’t enough, the next step is to look into encryption. I’m going to recommend using Truecrypt, and either securing the entire hard drive, or creating a Truecrypt Volume to contain the journal.

Obviously, there’s a tradeoff between security and convenience. If one encrypts the entire hard drive, they have to put in the password when you turn on your computer. If one creates a Truecrypt Volume, they have to mount it every time one wants to edit the journal.

A First Dive into Windows Server 2012

Standard

Last time, I did a quick first dive into Windows 8. Since I want to look at the new OS from the sysadmin point of view, I decided to go through the process of creating a new Windows Domain, and having the Windows 8 machine join that Domain using Windows Server 2012.

First, Microsoft is not offering 32bit copies of Windows Server 2012. That’s not a big deal; most hardware that doesn’t support 64bit shouldn’t be running Windows Server 2012. Even if one plans on running Windows Server 2012 on a virtual machine or hypervisor, 64bit should not be an issue at all.

For this article, I will be following Microsoft’s guide here, and using these settings:

  • Server Name/NetBIOS: xyzcorp
  • Domain Name: xyzcorp.local
  • Server IP address: 192.168.10.100/24
VMWare VirtualBox with Windows Server 2012 and Windows 8.

Time to start the install

Something popped up for me in the install:

Windows Server 2012 install asking if I want a GUI or not

The GUI can be turned off

That’s actually pretty cool; the GUI can be turned off. I always hated that Windows Servers before 2012 didn’t give one a choice whether to run a GUI or not. Servers don’t need GUIs. However, for the sake of my own convince, I’ll install the GUI so I don’t have to use SConfig, or search for PowerShell commands to do everything.

Windows Server 2012: Metro

With the GUI, Windows Server has Metro.

Alright, I won’t harp on Microsoft too badly for this one. Windows Servers tend to be recreations of current Windows OSes, and it’s natural that Windows Server 2012 would have Metro. At least the server isn’t pulling RSS feeds for sports, weather, and news.

Still, one isn’t going to run Windows Server 2012 on a phone or a tablet. Having just the desktop would have been perfectly okay.

I configured the IP address, the server’s computer name, and created a snapshot in VirtualBox.

Windows Server 2012: Add Roles and Features

Add Roles and Features

Windows Server usually does a good job guiding administrators with wizards. This is not an exception in Windows Server 2012. I actually like the Dashboard given here; it makes the server feel more like a server and not a re-skin of Windows 8.

Windows Server 2012 showing the features that will be installed.

Power to the wizard

Once that wizard is done, the next step is to promote the server to a Domain Controller.

Promoting the server to a domain controller

Promoting to a Domain Controller

More wizards to click through.

Option to export to a Powershell script

Exporting the settings to a Powershell script

I like this option a lot. Exporting everything the wizard does to a Powershell script means I could easily tweak the script and apply it on many different servers. Or, I could run a virtual server with the GUI to get the Powershell commands, and copy those to the real server without the GUI.

One reboot later, and we have a domain controller! Next, create a new user, and test to see if the domain controller works. To do that, I have to create a new user, and configure my Windows 8 VM to join the domain.

The create user screen in Windows Server 2012

Bob Buzz is the new employee

Let’s see if it all went well.

Windows 8 successfully joining a Windows Server 2012 domain.

Success!

It works!

I personally like the graphical update to Windows Server 2012. If one forgets about Metro, the interface actually feels like it was made for system administration. Previous incarnations of Windows Server always felt like a reskin of the current version of Windows out there. As noted already, the GUI can be turned off. I’m personally not at a level to administer a Windows Server without the GUI, but the option is there for those at that level.

Overall, I’m much more impressed by Windows Server 2012 than Windows 8. It’s got options sysadmins are looking for, the GUI makes sense (except for Metro), and it did what I needed it to do without a lot of hassle. I could see myself administrating a Windows Server 2012 without a huge headache. Compare that to Windows 8; I can’t see myself using Windows 8 without making various registry changes and using custom tools.

A First Dive into Windows 8

Standard

A First Dive into Windows 8

Well well well. It’s almost been an entire year since Windows 8 was released. Much has been said, especially hate for Microsoft’s new OS. I haven’t used it beyond playing with it in a store, and I wanted to experience for myself what kind of mess Microsoft made in this new OS.

After downloading the evaluation copy from Microsoft, I setup a new VM in Virtualbox:

VMWare Virtualbox Manager Screen

Ready to get muddy

I won’t go too much into the start of the installation. It was just like Windows 7 and Windows Vista, except it had different colors and images.

Installing Windows screen. Looks like Windows Vista and Windows 7s install screen.

This hasn’t changed. That’s a good thing.

Until the end. Take a look at this:

Windows 8 is asking me to personalize my color settings.

I get to choose a color pallet?

Well, I have to admit Microsoft. Your installation process for Windows has become friendlier over time. I still have bad memories of having to press F6 to install third-party RAID drivers, and using obsolete floppy drives to do so.

Regardless, I like green, and am going with green.

After I sign into my Microsoft account, I am greeted with some friendly messages and a screen that continuously changes color:

Windows 8 is putting on a display of rainbow colors while setting up.

Now’s a good time to calibrate your monitor.

Once it’s done, I am greeted with the Metro Interface.

Windows 8's new Start Screen: The Metro Interface

That screenshot doesn’t do complete justice to the experience. Some of the tiles like the NASDAQ tile, the weather tile, and others are animated. I’m okay with that, but I can’t help but feel that’s really distracting.

Anyway, time to do what I always do on a new Windows Machine:

I used the new Internet Explorer to install Firefox right away.

Install Firefox

Running the Firefox installer kicked me into the desktop mode. Install went smoothly without much of a problem. However, it was then that I notice:

Firefox is up and running, but where the heck is the start button?

The start button is gone!

Okay, there’s a shortcut for the start button, the Windows Key. Pressing that kicks me back into the Metro mode.

For everyone who had a habit of pressing that Start button (or glowy orb in the corner), they’re going to have a troubling time. It’s been around since Windows 95. I wonder how many people have trouble because they keep launching IE when they mean to press start.

I don’t mind change if it’s for the purposes of making people more productive, but I don’t understand the rational here. On the bright side, you can get the start button back if you really want to.

Regardless, I can live without the start button easily. I’ve grown a very strong habit of pressing the Windows Key, then typing in the search field what I need to open. It’s fast, quick, and gets the application or file I need opened fast.

I press the Windows Key, start typing, and my entire screen gets taken over.

But, having my ENTIRE SCREEN get taken over when I do that is not something I look forward to.

Going back to try to use the metro interface with a few applications, the full screen view works quite well, but, I’m working in a virtual machine. I can’t help but feel that it’s a waste if I were to use it on my main computer. I have a 23” monitor, and I like having multiple windows open. Right now, as I’m writing this, I have four different windows open on my desktop on my main machine running Windows 7. I don’t need my entire screen dedicated to reading articles, checking the weather, or seeing if I lost my retirement fund in the stock market. I like copy-pasting stuff from one window into another. Only when I’m watching a video do I like having a full screen display.

Windows 7's PC settings page.

Where’s the large/small icon option Microsoft?

Regardless, my first impression is that this OS isn’t that bad because I could easily just install Classic Shell, and use it just like I use my Windows 7 machine. All the new features in this new OS feel like it was made for tablet and phone use. While I agree on the theory of convergence, and that eventually the desktop will probably not exist as it does today, I don’t think we’re there yet. And from an IT perspective, I wonder, what benefit does Windows 8 have to end users?

Next time, I will install Windows Server 2012, and get a Domain setup with Windows 8.

Update: I happened to post this just around the time Microsoft released the Windows 8.1 preview: http://windows.microsoft.com/en-us/windows-8/preview. Looks like Microsoft added the start button again.