Monthly Archives: December 2016

Googler: A Command Line Tool to Do ‘Google Search’ from Linux Terminal


Today, Google search is a well known and the most-used search engine on the World Wide Web (WWW), if you want to gather information from millions of servers on the Internet, then it is the number one and most reliable tool for that purpose plus much more.

Many people around the world mainly use Google search via a graphical web browser interface. However, command line geeks who are always glued to the terminal for their day-to-day system related tasks, face difficulties in accessing Google search from command-line, this is where Googler comes in handy.

Googler is a powerful, feature-rich and Python-based command line tool for accessing Google (Web & News) and Google Site Search within the Linux terminal.

Read the complete article at Tecmint

Click Here!

LXLE: A Linux Distribution Light on Resources But Heavy on Function


Most lightweight Linux distributions are fairly standard: They use a window manager with a small footprint and install a minimal amount of apps to continue with the small size metaphor. In the end, many of those distributions function well…at a cost of functionality. Typically, to get a lightweight distro to do what you want, you wind up having to install numerous other apps, which basically defeats the purpose.

Then there are distributions like LXLE. This particular take on the small footprint Linux feels more like it belongs in the good old regular footprint Linux. It’s stuck squarely in the middle and can stake the claim that it can truly revive your old hardware without doing so at the cost of productivity. And, with the latest release (Eclectica, based on Ubuntu 16.04.01), that distribution is better and more capable than you’d imagine.

LXLE features:

  • Based on Ubuntu/Lubuntu LTS

  • Optimized LXDE user interface

  • Full-featured apps pre-installed (e.g., LibreOffice, GIMP, Audacity, etc.)

  • Latest stable versions of major software

  • Synaptic package manager for adding software

  • Extra PPAs extend available software

  • Exposé, Aero Snap, Quick Launch apps

  • Random wallpaper changer (with 100 wallpapers pre-installed)

  • Theme consistency throughout

  • 32- and 64-bit OS versions available

Although you might scoff at the idea of including so many wallpapers, when you start clicking through the random wallpaper button (located on the desktop panel), you’ll quickly appreciate how beautiful your desktop can be.

Instant familiarity

As with most of the lightweight Linux distributions, you’ll find zero learning curve with the desktop environment. LXLE makes great use of LXDE. With the main panel at the top of the desktop (Figure 1), you’ll find the applications menu, shortcuts for the file manager, wallpaper changer app, a launcher for the terminal app, a quick launch app, time/calendar app, and system tray.

A second panel, set to auto hide, can be found at the bottom of the screen (Figure 2). This panel includes the Application Launch Bar (where you can add application launchers), Window List app (for minimized apps), desktop pager, window iconify, and Exposé button.

Update system

Although LXLE does ship with the Synaptic package manager, I wouldn’t recommend using it to upgrade the system. I attempted two runs with Synaptic and both attempts brought the desktop to a pixelated halt. Instead, LXLE includes a very handy app called uCareSystem. This text-based tool does the following:

  • Updates all available packages

  • Updates your Ubuntu system

  • Downloads and install updates

  • Checks for the list of old Linux Kernels and uninstalls them

  • Clears the cache folder

  • Uninstalls packages that are obsolete or no longer needed

  • Uninstalls orphaned packages

  • Deletes package settings that have been previously uninstalled

You can launch uCareSystem by clicking Applications > Updates. A terminal window will open (Figure 3), and the tool will automatically run through all of its steps to update and clean your system. This tool is so easy to use, it makes me wonder why more distributions don’t include it.

You can also run uCareSystem from the terminal window by issuing the command sudo ucaresystem-core. The uCareSystem tool was so impressive, I added it to my running Elementary OS Loki production machine. This can be done with the following commands:

Not without problems

LXLE is an impressive distribution, but it’s not without its problems. The first issue reared its ugly head during installation. I tend to prefer the live-to-install route, so I booted up the live instance of LXLE…only to be greeted by a password prompt. There was no indication on the website of a required username/password for the live instance and the only mention I could find was within the forums (that being a possible corrupted ISO image). I downloaded a second…and third…and fourth. Each of the live instances required a username and password—something no one seemed to know.

To that end, I opted to go the direct install route. This also failed. The installation would walk me through the wizard and start copying packages. Before the installation of the boot loader could begin, the installation crashed. I attempted this five times before finally giving up.

However, during the user setup process of the direct-install method, I noticed the installer always wanted to default to user qwerty. I took that as a hint and rebooted into a live instance. After entering qwerty as the username and an empty password, I was greeted with the LXLE desktop. Bingo. Next step, run the installer from the live instance. This time, the installation succeeded without a hitch. Within a few minutes, I had a working LXLE and was happily kicking the tires.

The only other caveat I came across was something that tends to plague most small-footprint distributions…an out-of-date web browser. LXLE uses a Mozilla build of Seamonkey and the second you open it (even after running uCareSystem), you’ll be warned that the included version is out of date (Figure 4).

Clicking on the Check for Updates button came back with no available updates. A sticky conundrum, no doubt. The best way around this is to install either Firefox, Vivaldi, Chrome, or Chromium and avoid the pitfalls that come along with using an out-of-date browser (security vulnerabilities, lack of support, etc.).

A treat to use

Beyond the easily resolved issues, LXLE was a treat to use. As a desktop, it is instantly familiar and runs with the stability of a well-seasoned environment. As a Linux distribution, it will serve you incredibly well, whether you’re running new or older hardware.
Give LXLE a go and see if you don’t opt to make it your distribution of choice.

Advance your career with Linux system administration skills. Check out the Essentials of System Administration course from The Linux Foundation.

4 Ways to Send Email Attachment from Linux Command Line


Once you get familiar to using the Linux terminal, you wish to do everything on your system by simply typing commands including sending emails and one of the important aspects of sending emails is attachments.

Especially for Sysadmins, can attach a backup file, log file/system operation report or any related information, and send it to a remote machine or workmate.

In this post, we will learn ways of sending an email with attachment from the Linux terminal. Importantly, there are several command line email clients for Linux that you can use to process emails with simple features.

Read the complete article at Tecmint

 

Click Here!

An Introduction to Text Editors — Get to Know nano and vim


At some point in your Linux administration career, you are going to edit a configuration file, write a Bash script, code, take a note, or any given task associated with text editors. When you do, you will turn to one of the popular text editors available to the Linux platform.

These are two tools that might strike fear in the hearts of newbies and put seasoned users at ease. They are the text-based editors that Linux administrators turn to when the need arises…and it will arise. To that end, it is in the best interest to every fledgling Linux user to get to know one (or both) of these editors. In this article, I’ll get you up to speed on using each, so that you can can feel confident in your ability to write, edit, and manage your Linux configuration files, scripts, and more.

Nano

Nano has been my editor of choice for a very long time. Because I don’t code nearly as much I used to, I typically have no need of the programming power found in vi. Most often, I simply need to create a Bash script or tweak a configuration file. For that, I turn to the simplicity of Nano.

Nano offers text editing without the steeper learning curve found in vi. In fact, nano is quite simple to use. I’ll walk you through the process of creating a file in nano, editing the file, and saving the file. Let’s say we’re going to create a backup script for the folder /home/me and we’re going to call that script backup_home. To open/create this file in nano, you will first open up your terminal and issue the command nano backup_home. Type the content of that file into the editor (Figure 1) and you can quickly save the file with the key combination [Ctrl]+[o].

The [Ctrl]+[o] combination is for “write out”. This will save what you’ve written so far and allow you to keep working. If, however, you’ve completed your work and want to save and exit, enter the key combination [Ctrl]+[x]. If you’ve made any edits since you last did a write out, nano will ask if you want to save your work before exiting (Figure 2).

Once you’ve saved work in nano, it will do some color coding, depending on the type of file you’ve written (in this example, we’ve written a Bash script, so it is applying the appropriate syntax highlighting).

You will also note, at the bottom of the window, a row of commands you can use with nano. Some of the more handy key combinations I use are:

  • [Ctrl]+[c] – print out the current line number

  • [Ctrl]+[k] – cut a line of text

  • [Ctrl]+[u] – uncut a line of text

  • [Ctrl]+[r] – read in from another file

A couple of notes on the above. The cut/uncut feature is a great way to move and or copy lines within nano. When you cut a line, it copies it to the nano buffer, so when you uncut, it will copy that line at the current cursor location. As for the read in tool, say you have another file on your local drive and you want the contents of that file to be copied into the current file you have open in nano.

For example: The file ~/Documents/script consists of code you want to add to your current script. Place your cursor where you want that new script to be placed, hit [Ctrl]+[r], type in ~/Documents/script, and hit the Enter key. The contents of script will be read into your current file.

Once you’ve completed your work, hit the combination [Ctrl]+[x] and, when prompted, type y (to save your work), and you’re done.

To get more help with nano, enter the combination [Ctrl]+[g] (while working in nano) to read the help file.

vim

If you’re looking for even more power (significantly so), you’ll turn to the likes of vim. What is vim? Vim stands for Vi IMproved. Vim is the evolution of the older vi editor and is a long-time favorite of programmers. The thing about vi is that it offers a pretty significant learning curve (which is why many newer Linux users immediately turn to nano). Let me give you a quick run-down of how to open a new document for editing, write in that document, and then save the document.
The first thing you must understand about vi is that it is a mode-oriented editor. There are two modes in vi:

The vi editor opens in command mode. Let’s start a blank file with vi and add some text. From the terminal window, type vi ~/Documents/test (assuming you don’t already have a file called test in ~/Documents…if so, name this something else). In the vi window, type i (to enter Insert mode — Figure 3) and then start typing your text.

While in insert mode, you can type as you need. It’s not until you want to save that you’ll probably hit your first stumbling block. To save a file in vi, you must exit Insert mode. To do this, hit Escape. That’s it. At this point vi is out of Insert mode. Before you can send the save command to vi, you have to hit the key combination [Ctrl]+[:].

You should now see a new prompt (indicated by the : character) at the bottom of the window (Figure 4) ready to accept your command.

To save the file, type w at the vi command prompt and hit the Enter key on your keyboard. Your text has been saved and you can continue editing. If you want to save and quit the file, hit [Ctrl]+[:] and then type wq at the command prompt. Your file will be saved and vi will close.

What if you want to exit the vi, but you haven’t made any changes to your open file? You can’t just type q at the vi command prompt, you have to type q!.

Finally, if you’re in command mode and you want to return to insert mode, simply type i and you’re ready to start typing again.

Some of the more useful vi commands (to be used when in command mode, and after hitting [Ctrl]+[:]) are:

  • h – move cursor one character to left

  • j – move cursor one line down

  • k – move cursor one line up

  • l – move cursor one character to right

  • w – move cursor one word to right

  • b – move cursor one word to left

  • 0 – move cursor to beginning of the current line

  • $ – move cursor to end of the current line

  • i – insert to left of current cursor position (this places you in insert mode)

  • a – append to right of current cursor position (this places you in insert mode)

  • dw – delete current word (this places you in insert mode)

  • cw – change current word (this places you in insert mode)

  • ~ – change case of current character

  • dd – delete the current line

  • D – delete everything on the line to right of the cursor

  • x – delete the current character

  • u – undo the last command

  • . – repeat the last command

  • :w – save the file, but don’t quit vi

  • :wq – save the file and quit vi

You see how this can get a bit confusing? There’s complexity in that power.

Don’t forget the man pages

I cannot imagine administering a Linux machine without having to make use of one of these tools. Naturally, if you’re machine includes a graphical desktop, you can always turn to GUI-based editors (e.g., GNU Emacs, Kate, Gedit, etc.), but when you’re looking at a GUI-less (or headless) server, you won’t have a choice but to use the likes of nano or vi. There is so much more to learn about both of these editors. To get as much as possible out of them, make sure to read the man pages for each (man nano and man vi).

Advance your career with Linux system administration skills. Check out the Essentials of System Administration course from The Linux Foundation.

5 Essential Linux Holiday Amusements


Yes, my fellow penguins, it is time for the annual ritual of having fun with silly Linux holiday commands! The fun of being a grownup is you get to make your own observances, and Linux silliness is one of mine. Without further ado let us plunge into our maelstrom of Linux holiday delights.

No More Alek’s Controllable Christmas Lights for Celiac Disease

One of my essential holiday activities was promoting and playing with Alek’s Controllable Christmas Lights for Celiac Disease, by Alek Komarnitsky (Figure 1). This wonderful project ran for over a decade and raised $83,000 for the Center for Celiac Research. Even more fun, it started as a prank that fooled the news networks.

Alek’s Controllable Christmas Lights was a glorious mish-mash of lights and inflatable characters like Homer Simpson, the Incredible Hulk, Santa, SpongeBob SquarePants, the Grinch, and Snoopy that site visitors controlled from their Web browsers. You could turn the lights on and off, inflate and deflate the characters, post live messages, and spy on Alek in his workshop. Alek also ran Controllable Halloween Decorations.

The first incarnation went online in 2002. It was a simulation made with a series of still photos that changed frequently, giving the impression of remote control. There was no Webcam and no remote control; just a fun prank by a funny man. Then the news media got wind of it, and were all over it without bothering to do any fact-checking, and happily reported it as real. (Though it wasn’t the kind of story that called for relentless investigative reporters.) The high point of the prank came when Alek got a ride in an ABC news helicopter over his house, with his wife inside manipulating the lights. Eventually he confessed all, and then made it all real using X10 devices.

Alek retired the project in 2014 and sold all of his gear. It was awesome fun while it lasted. You may enjoy the full story, and the simulation has been resurrected for our amusement.

Cowsay Christmas!

Cowsay supports cowfiles for creating additional cowsay characters. Look at any of the files in /usr/share/cowsay/cows/ to see how easy it is to create your own. Cowsay is written in Perl, so you must escape Perl characters that require escapes, such as @ and . I made a simple cowfile, xmas-tree.cow, to display a little talking ASCII Christmas tree. I rather like Festivus, but the Festivus pole is too plain. Your cowfile must have the .cow extension, and if you put it in the default location of /usr/share/cowsay/cows/ you won’t have to specify the full path to use it. You can be as simple or as elaborate as you like, because that is also the fun of being a grownup. There are many online ASCII generators that will create a nice ASCII image from a photograph.


$ cowsay -f xmas-tree Holiday greetings to 
all the good peoples of the world!
 ___________________________________
/ Holiday greetings to all the good 
 peoples of the world!             /
 -----------------------------------
                 
             
             *                                          
            |/
            /o
           /*.'
           /'*'
          /o'*.o
          /.'o' 
         /'.*'.*.
         ^^^^^^^^^
            | |

ASCII Star Wars

After all these years this still works; run telnet towel.blinkenlights.nl to see the complete ASCII Star Wars. (Remember, as grownups our holiday traditions can be anything we want, and Figure 2 shows one of mine.)

Color ASCII Fire

Show of hands: who remembers the Yule Log TV program? Who still watches it? For those who are not familiar with it: Once upon a time, back before the Internet, we watched broadcast TV. This was an amazing invention where TV programs literally flew through the air and then landed in our TV sets. There were three network channels, ABC, NBC, and CBS, and if your reception was decent you also got PBS and local channels. Yes, somehow we made do with less than a dozen TV channels.

Programming ran on a schedule, and unlike today’s 24x7x365 world the channels often went dark after midnight. From Christmas Eve until the day after Christmas some networks broadcast the Yule log, which was a video of a cheery fire in a fireplace. No, really. I am not making this up, and you can find several Yule log videos on YouTube. Command-line fans can run their own cheery Yule fire in their favorite terminals; install caca-utils and run the cacafire command. Behold the result in Figure 3.

Holiday Star Wars Screensaver

Install xscreensaver and xscreensaver-gl-extra. Open xscreensaver and find the Star Wars screensaver. This is a cool screensaver that plays a text crawl just like the opening credits of the original Star Wars movie, which you can also find on YouTube. The groovy thing about the Star Wars screensaver is you can easily customize it to display your own text. All you do is write whatever you want in a text file. Then go to the Advanced tab and enter the full path to your file on the Text File line in the Text Manipulation section. Then play the preview and you will see your text (Figure 4).

Happy Holidays!

Happy holidays and happy New Year everyone, thank you for supporting Linux.com, Linux, and free/open source software. See you next year!

Advance your career in system administration! Check out the Essentials of System Administration course from The Linux Foundation.