Psst. Hey, would you like to hear an Ubuntu secret? OK, how about five secrets?
The quest to discover something new and fresh about Ubuntu, which is arguably the world’s most popular and best documented Linux distribution, is an almost ridiculous one to accept and an almost impossible one to fulfill. I felt like the Mission Impossible character, Jim Phelps, as I read the request from my editor. I expected to see the words, “This is your mission, Ken, should you choose to accept it. This email will self-destruct in five seconds” at the end of that message.
I felt no less trepidation at the request than I imagine that Mr. Phelps did at the beginning of every one of his assignments. I accepted the assignment, and here is, submitted for your approval, the result of that quest: Five Ubuntu features you didn’t know about.
My journey led me through every aspect of its installation, filesystem layout, GNOME desktop and graphical goody about which I could poke and ponder — all well-known, all well-documented. In my desperation, I returned my humble and faithful command line roots (big surprise there, huh?) where I struck Ubuntu gold. These five command-line based features are the result of my Ubuntu mining process.
Byobu: A Better Screen
Do you like screen? For the uninitiated, screen is a terminal screen window manager that allows you to multiplex between several different virtual terminals. Each screen session is independent of all others and can run applications or processes in each session allowing you to multitask without switching terminals.
If you’re familiar with screen, you know the power of it already. If you aren’t familiar with it, you’ll fall in love with byobu and gain an understanding of screen and its capabilities.
To invoke byobu, simply type byobu at the command line. Do not use the “&” since it must remain a foreground process.
Byobu is a group of python and shell scripts that enhance the screen program, making it easier to use and expanding its features into a true management interface. Each of the function (“F”) keys has significant keybindings for byobu. For an extremely well documented Help system, press the F9 key while in byobu. Here, you’ll find all aspects of byobu and its configuration and operation.
Byobu also provides you a constant system status at the bottom of your terminal window showing you name and number of virtual terminals, Ubuntu version, uptime, load average, memory used, date, time.
One of the oldest Unix features is the Message of the Day (MOTD) file. This static text file displays to users as they login to a system. Administrators edit the file to broadcast important messages to system users. With the release of Ubuntu 9.04, the rusty old MOTD that you’ve known for so long received a makeover. It now behaves like startup scripts that reside under /etc/rcX.d. The dynamic MOTD is no longer a single file but rather a set of scripts (shell scripts) that execute on login. If you have a newer Ubuntu version, check it out under /etc/update-motd.d.
Just like /etc/init.d or /etc/rcX.d, you can create your own MOTD files that must have two properties: They must have the executable permission bit enabled and must contain a shell reference as the first line in the script. The scripts may contain echoed text, references to other scripts, references to executables, comments and anything that you’d use in a standard shell script.
Remember that these scripts execute each time someone logs into your system, so it’s wise to use them thoughtfully.
One of the new enterprise features for the Ubuntu Enterprise Cloud (UEC) version of Ubuntu Server is in the schedule policy for deploying new virtual machines (VMs) to cluster nodes in the /etc/eucalyptus/eucalyptus.conf file. The default policy is ROUNDROBIN, which means that the cluster master selects one node after the other until the it finds a node that can run a new VM. The other option is GREEDY: Place and run the VM on the first node that can run it. The new option is POWERSAVE. In powersave mode, the cluster nodes not running VMs are put to sleep to save power and VMs will be placed onto awake nodes first followed by sleeping nodes.
The default policy in deploying VMs to cluster nodes is one VM per CPU core. This might prove limiting to those who have lower CPU requirements for the virtual machine-bound applications. To change this limitation, edit the /etc/eucalyptus/eucalyptus.conf parameter, MAX_CORES. You may set this value to any multiple of 2. Nodes with Quad-Core CPUs can, by default, run 8 VMs but boosting this parameter will increase that density to 16 or more.
PowerNap is a configurable daemon that runs at a specified interval that executes an action or actions when a list of monitored processes in the process table is missing for a contiguous period. It’s described as “sort of a screensaver for servers.” PowerNap has two configuration files, action and config, located under /etc/powernap
The action file instructs the powernap daemon on how to handle a situation according to the config file settings. Possible actions are: suspend, hibernate, power off, send a message via email or SMS or execute some other script or executable that you designate.
Ubuntu doesn’t have many secrets left but these five, until now, were perhaps the last of their kind. I encourage you to explore them in more detail and let us in on your adventures.
Special thanks to Dustin Kirkland, Ubuntu Enterprise Cloud Developer for his assistance and information with this material.
Kenneth Hess is a Linux evangelist and freelance technical writer on a variety of open source topics including Linux, SQL, databases, and web services. Ken can be reached via his website at http://www.kenhess.com
. Practical Virtualization Solutions by Kenneth Hess and Amy Newman is available now.