Useful Linux Desktop Tools for System Administrators

September 8, 2016

Though the demand for Linux Systems Administrators is growing, the sysadmin world is still dominated by Windows in many ways: company laptops will come pre-installed with Windows, Outlook e-mail servers, Microsoft Office formatted company documents, etc. Most businesses now see the value in replacing windows with Linux on their servers, but stop short of replacing the familiar Windows desktop with Linux. But a growing number of systems administrators (like myself), have made the switch to working solely on the Linux desktop. Let me tell you both why I did, and the awesome open source tools I used to do it.

Why Linux?

First off, let me preface this by saying that not all sysadmins will be able to make the switch. I happen to work for a great company that supports my decision (or at least tolerates it so long as I get my work done), but not everyone will be so lucky. Also, some companies will use proprietary in-house tools that only work on Windows, or they may require more integration with Active Directory than is practical with Linux. Still some others will wish to take the path of least resistance, and focus on making their Windows experience work for them.

For me, Linux isn’t just some OS I throw on a server to deploy a Web app; it’s a way of life. I love free and open source software and everything it has done for the world. Using open source software and reporting bugs is part of the price we pay for that greatness. But aside from that, Linux offers a range of possibilities to increase your productivity.

Most Linux distributions offer the ability to choose from multiple desktop environments, each with their own paradigm and workflow. And each of those DEs offer loads of customization options to further tweak them to your preferences. I have found that one of the best ways to increase your productivity is to get your desktop ‘just right’ so that it works and behaves exactly how you want it to.

Additionally, because open source software is free and Linux distributions have massive repositories of software that can be installed in seconds with a single command; it becomes trivial to try a different software solution if your current app isn’t getting the job done. There’s no hassle of purchasing, licensing, registering, or activating the software: you just install it and use it. You also don’t have to worry about the security risk of executing some random executable you downloaded off the internet, compiled from code no one but that company or programmer has seen. And because Linux distros have centralized package managers, system and software updates can be handled easily, in one place; rather than clicking through dozens of popups and bloated system tray applications that phone home separately to check for updates and report back who knows what kind of usage statistics, or worse …

Ok, enough of my rant against Windows. Let’s get to the software! Most Linux sysadmin software guides I see on the net focus either of monitoring tools for the server, or command line tools. This guide is geared more towards desktop tools. All of the apps listed here have been used by me personally in a professional capacity. This isn’t just some list I threw together from Google, these are the tools I rely on every day to get my work done. I hope this post can help make your switch to Linux as productive and satisfying as mine has been.

Distributions

Fedora

Personally, I use Fedora 24 on my company laptop. The reasoning behind this is I have to maintain a lot of CentOS and Red Hat Enterprise Linux servers. Fedora is a cutting edge distro, dedicated to pushing out the latest packages and pushing the boundaries of technology. The changes and innovations made in Fedora will eventually trickle down to RHEL and CentOS, and I’ll already be familiar with them. With cutting edge distros, there’s always a chance that something will break with an update, but if you’re reading this you’re probably a sysadmin: you should already know about backups … Besides, I’ve used Fedora for almost a year with no issues now. Fedora has an excellent, out of the box ready implementation of Gnome 3 as well, which happens to be my preferred desktop environment when I’m not using i3.

Ubuntu

Though Ubuntu is typically seen as a distro for developers, it would also make a great choice for a sysadmin. It has arguably the largest number of available packages. And with something like 70% of the share of Linux servers in the cloud, most sysadmins will find themselves managing an Ubuntu server at some point. Unlike my Fedora example above, Ubuntu desktop and server are the same underlying OS. I actually struggled quite a bit in deciding between Ubuntu and Fedora for my company laptop. For many sysadmins, Ubuntu (or one of its many flavors) will make the most sense. And while folks like to complain about the Unity desktop, it’s actually pretty good if you ask me. I still prefer Gnome, but Unity can definitely get the job done out of the box with minimal fuss.

Other options

OpenSUSE is doing some great stuff with Leap and Tumbleweed, and is blazing the trail with btrfs. They don’t quite have the package availability of other distros, but their Open Build Service puts other distros to shame.

Arch Linux is hands down my favorite distro. I love The Arch Way and the power and respect that the distribution gives users. It can be daunting for beginners and being a rolling release does mean you will have some breakages from time to time. But it will allow you to build the ultimate, lean, customized distro with everything you want and nothing you don’t. If you’ve never used it before, don’t make your first installation on the company laptop though. It has a steep learning curve …

Desktop Applications

Remmina: The Linux Answer to Remote Desktop Manager

I have to interact with a lot of Windows servers over remote desktop at my job, so remmina is probably one of my most used apps. It uses the freerdp protocol to establish remote desktop connections with Windows machines. Like Remote Desktop Manager, you can save connection profiles for one-click-connecting to remote servers. It also supports VNC, ssh, and other connection protocols. It doesn’t have the same feature set that RDM does, but RDM was bloated, in my opinion. The primary thing that I need Remmina for it does well: saving connection profiles to all of the Windows servers I have to manage. It comes with a handy system tray icon for quick connections. It even supports clipboard sync (probably its most useful and time saving feature).

Remmina is also useful for those times when you need to use a specific Windows application for which there is no Linux alternative. Just remote desktop into a Windows box and do the work there. It takes much less resources than virtualization, and it’s way more stable than using Wine. There have been times when I spent all day using Remmina to RDP into a Windows machine to do some Windows specific work. It’s so stable and responsive, you’ll forget you’re even on a remote desktop.

Syncthing

Syncthing is my dropbox/bittorrent sync replacement. It keeps files synced across multiple devices, through an encrypted peer to peer protocol. While Syncthing is still a new project (not yet to version 1.0), it has come a long with since it’s early days. It has a great GTK client now, an Android app, and even a Windows client. No need to worry about a 3rd party handling sensitive company data, or expensive storage prices … you can sync as much data as you have space for. Everything is encrypted using TLS and perfect forward secrecy. This project has a great future ahead of it and I’m excited to see what new features get added over time.

LibreOffice

LibreOffice is a must have for anyone using Linux as their main desktop. I have yet to encounter an Office document I couldn’t edit in LibreOffice. A lot could be said about LibreOffice, but I’ll leave it here.

Atom or Sublime …

The only things linux nerds love arguing about more than favorite distros is their text editor of choice … well, they also love arguing about systemd, but that’s another post. The argument is usually between vi/vim and emacs. For the record, I’m Team Vim :)

For GUI text editors though, there are a lot of choices on Linux, but the top contenders these days seem to be Atom or Sublime Text. Sublime is feature packed and powerful, but it’s not free as in freedom. You can use it for free, but the license is $70. Sublime is great software, and I’d say it’s worth every bit of that $70 if you use it daily as a sysadmin or developer. But Atom is not only free to use, it’s also licensed under the MIT License … not exactly Stallman’s favorite, but better than proprietary if open source matters to you. Atom has nearly all the features of Sublime, and it has a lot of active development and large community around it.

Mostly, I use a heavily customized vim as my editor of choice. But when I feel the need to use a GUI text editor, I tend to reach for Atom.

So that list was woefully short, and included quite a bit of discussion on distribution selection. There is a whole lot more to cover on the topic of sysadmin tools. I think I’ll do a round up of tiling window managers and command line tools, in my next post on this topic.

Tags

Minimal, Clean Conky

January 26, 2016

Conky is a lightweight system monitor for X. It’s a great way to display all sorts of helpful information right on your desktop. It’s somewhat similar to Rainmeter (for Windows) or GeekTool (for OSX), but it’s far more powerful. Unfortunately, as with many things in Linux, powerful can mean hard to configure. In this guide, I’ll go over my ~/.conkyrc for a minimal, clean conky configuration that provides useful info without polluting your desktop with clutter.

desktop screenshot with conky

My current desktop with conky. I’m on Fedora 23 with Gnome for a desktop environment.

Conky

First, let’s install Conky. It’s available in the official repos of most distributions.

pacman -S conky          #For Arch
apt-get install conky    #For Debian/Ubuntu
dnf install conky        #For Fedora 23, use yum for older versions

Note that configuring Conky with your desktop environment/distribution may require additional packages to be installed. If you’re using Gnome on Fedora 23, then the .conkyrc I provide below will work for sure. If you’re using another desktop environment with Arch, check out the Arch wiki on conky. It provides tons of details on configuring conky, and even lots of little mini guides for how to cusomize your .conkyrc

If your distro doesn’t have a conky package, or if you want to compile it yourself, instructions can be found here.

Once installed, you could start using the default configuration right away. Just start conky with conky &. The default configuration is fine, but didn’t suit my tastes. Conky will look in ~/.conkyrc for any user configurations, so that’s where we’ll put ours.

.conkyrc

Our minimal, clean .conkyrc:

# - Conky settings
update_interval 1
total_run_times 0
net_avg_samples 1
cpu_avg_samples 1
imlib_cache_size 0
double_buffer yes
no_buffers yes

# - Text settings
use_xft yes
xftfont Sans:size=12
override_utf8_locale yes
text_buffer_size 2048

# - Window specifications 
own_window_class Conky
own_window yes
own_window_type normal
own_window_argb_visual yes
own_window_argb_value 255
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
alignment top_right
gap_x 40
gap_y 40
minimum_size 300 550
maximum_width 550
default_bar_size 550 8

# - Graphics settings
draw_shades no
default_color cccccc
color0 white
color1 E07A1F
color2 white


TEXT
Kernel: ${alignr} ${execi 5000 uname -r | sed "s@.fc.*.x86_64@@g" }
Uptime: ${alignr}${uptime}

CPU1: ${cpu cpu1}%${alignr}CPU2: ${cpu cpu2}%
CPU3: ${cpu cpu3}%${alignr}CPU4: ${cpu cpu4}%
Temp: ${alignr}${acpitemp}°C

Memory: ${mem} ${alignr}${membar 8,60}
Disk: ${diskio}${alignr}${diskiograph 8,60 F57900 FCAF3E}
Battery: ${battery_percent BAT0}% ${alignr}${battery_bar 8,60 BAT0}

# Processes
Processes: ${alignr}$processes
Highest: ${alignr 40}CPU${alignr}RAM
${voffset -11.5}${hr 1}
${voffset -4}${top name 1} ${goto 124}${top cpu 1}${alignr }${top mem 1}
${voffset -1}${top name 2} ${goto 124}${top cpu 2}${alignr }${top mem 2}
${voffset -1}${top name 3} ${goto 124}${top cpu 3}${alignr }${top mem 3}
${voffset -1}${top name 4} ${goto 124}${top cpu 4}${alignr }${top mem 4}

${voffset -4}SSID: ${alignr}${wireless_essid wlp3s0}
${voffset -4}Local IP: ${alignr}${addr wlp3s0}
${voffset -4}External IP: ${alignr}${execi 600 curl https://icanhazip.com}

${voffset -4}hal:${alignr}${execi 600 /home/user/bin/pingtest server1.com}
${voffset -4}helper:${alignr}${execi 600 /home/user/bin/pingtest server2.com}

Just open up your favorite text editor and paste in the above. Save the file as ~/.conkyrc. To test it, start conky with conky &. You should now see my conky configuration on your desktop!

A close up view of my conky configuration.

A close up view of my conky configuration.

Conky Config Explained

The first few sections deal with Conky’s appearance and position on the screen. If you want to change colors or positioning, poke around in here. Otherwise, let’s move on to TEXT section, this is the stuff that actually gets displayed on the screen.

First, let’s take a look at this line, and break everything down:

Kernel: ${alignr} ${execi 5000 uname -r | sed "s@.fc.*.x86_64@@g" }

On Fedora, uname -r returns this: 4.2.7-300.fc23.x86_64, which is more info than I want. I already know I’m on 64 bit Fedora 23. It’s just the kernel version that I want displayed. So we use sed to replace fc.*x86_84 with nothing, so we’re just left with the kernel version that precedes it. The * here is a regular expression meaning, any number of any characters. That way, when I upgrade to Fedora 24, I won’t have to change my conkyrc.

Of course, conky has a built in way to display the kernel version, with ${kernel}. I could just use this instead:

Kernel: ${alignr} ${kernel}

But just like uname -r, it would display the Fedora version and whether we have a 32 or 64 bit kernel: 4.2.7-300.fc23.x86_64. If you’re happy with what ${kernel} displays for your distribution, then just leave it. If you want to display just the kernel version, then modify the sed command as needed. sed is a very powerful tool, but it can be a little daunting at first. If you’re new to it, then check out the wikipedia entry for more info.

Let’s turn our attention to the networking section, as you may need to make some changes here:

${voffset -4}SSID: ${alignr}${wireless_essid wlp3s0}
${voffset -4}Local IP: ${alignr}${addr wlp3s0}
${voffset -4}External IP: ${alignr}${execi 600 curl https://icanhazip.com}

${wireless_essid wlp3s0} will display the SSID (wireless network name) of whatever network the wlp3s0 interface is connected to. If your wireless interface is named differently, you will need to change this value. To find your wireless interface name, simply issue ip addr:

It will return information on all of your network interfaces, but we’re just looking for your wireless interace:

2: wlp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
...

To get the local IP address, we use ${addr wlp3s0}. Again replace wlp3s0 with whatever your interface name is. Note that if you have a wired connection, it will not be displayed here. You’ll have to use ip addr to find the name of your wired interface and put it here.

There are several ways to get your external IP address, but I find that the simplest is to do curl https://icanhazip.com. Thus, our conky code is ${voffset -4}External IP: ${alignr}${execi 600 curl https://icanhazip.com}.

Finally, we come to the handy little lines that show whether my servers are up.

${voffset -4}hal:${alignr}${execi 600 /home/user/bin/pingtest server1.com}
${voffset -4}helper:${alignr}${execi 600 /home/user/bin/pingtest server2.com}

/home/user/bin/pingtest is a super simple bash script that pings whatever url you give it and returns “Up” if it gets a response and “Down” if it doesn’t. Save this script to your /home/user/bin:

#!/bin/bash

if ping -c 1 -W 2 "$1" > /dev/null; then
echo "Up"
else
echo "Down"
fi

Alternatively, you could put the script anywhere in your $PATH. You can always check your $PATH environment variable with:

$ echo $PATH
/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/home/user/bin

If /home/user/bin isn’t part of your $PATH environment variable, you can add it by adding this line to your ~/.profile:

export PATH=$PATH:/home/user/bin

If you don’t have any servers to monitor, just remove those lines or comment them out.

And that’s all there is to my conky set up. Conky is a very powerful tool and can be used to display all sorts of information. I like mine simple and clean, but feel free to go crazy. There are tons of really slick conky configs out there.

Tags