Home Blog Page 368

Batch Editing Files with ed

The other day at work I needed to edit 200 files at once. I wanted to do something pretty simple: basically, I had files that looked like this:

foo:
  - bar
  - baz
  - bananas

and I wanted to insert an extra line after the baz line that said elephant

foo:
  - bar
  - baz
  - elephant
  - bananas

I had one extra weird requirement which was that some of the lines were indented with 2 spaces, and some with 4 spaces. The - elephant line needed to have the same indentation as the previous line.

Read more at Julia Evans

Develop your Linux Apps on This RISC-V Board

The “news” is that Microsemi and SiFive have collaborated on an expansion board that’s based on Microsemi’s RISC-V-based Polarfire FPGAs. The expansion board makes it easier for developers to write Linux-based applications targeting RISC-V using the Mi-V RISC-V ecosystem.

RISC-V is a free and open instruction-set architecture (ISA) that processor vendors are beginning to rally around. For the architecture to really take off, it’s products like these that are required, products that encourage and simply software development.

Read more at Embedded Computing Design.

And, check out more details in Eric Brown’s previous article.

 

3 Useful Things You Can Do with the IP Tool in Linux

It has been more than a decade since the ifconfig command has been deprecated on Linux in favor of the iproute2 project, which contains the magical tool ip. Many online tutorial resources still refer to old command-line tools like ifconfigroute, and netstat. The goal of this tutorial is to share some of the simple networking-related things you can do easily using the ip tool instead.

Find your IP address

[dneary@host]$ ip addr show
[snip]
44: wlp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
        link/ether 5c:e0:c5:c7:f0:f1 brd ff:ff:ff:ff:ff:ff
        inet 10.16.196.113/23 brd 10.16.197.255 scope global dynamic wlp4s0
        valid_lft 74830sec preferred_lft 74830sec
        inet6 fe80::5ee0:c5ff:fec7:f0f1/64 scope link
        valid_lft forever preferred_lft forever

ip addr show will show you a lot of information about all of your network link devices. In this case, my wireless Ethernet card (wlp4s0) is the IPv4 address (the inet field) 10.16.196.113/23. The /23 means that there are 23 bits of the 32 bits in the IP address, which will be shared by all of the IP addresses in this subnet. IP addresses in the subnet will range from 10.16.196.0 to 10.16.197.254. The broadcast address for the subnet (the brd field after the IP address) 10.16.197.255 is reserved for broadcast traffic to all hosts on the subnet.

Read more at OpenSource.com

Bigger than Linux: The Rise of Cloud Native

A trip to KubeCon + CloudNativeCon reveals a community hard at work building an open, agile and scalable cloud platform to fuel the boom in ubiquitous services….

To understand the importance of Kubernetes we need to return to containers briefly. Containers, by design, use less resources than virtual machines (VMs) as they share an OS and run ‘closer to the metal’. For developers, the technology has enabled them to package, ship and run their applications in isolated containers that run virtually anywhere. When continuous integration/continuous delivery software (e.g. Jenkins) and practices are added into the mix, this enables companies to benefit from nimble and responsive automation and it significantly speeds up development. For example, any changes that developers make to the source code will automatically trigger the creation, testing and deployment of a new container to staging and then into production.

The idea of a container allowing one process only to run inside it has also led on to microservices. This is where applications are broken down into their processes and placed inside a container, which makes a lot of sense in the enterprise world where greater efficiencies are constantly being sought.

However, this explosion of containerised apps has created the need for a way to manage or ‘orchestrate’ thousands of containers. 

Read more at TechRadar

Kubernetes as a Service Built on OpenStack

In this video from the 2018 Swiss HPC Conference, Saverio Proto from SWITCH presents: Kubernetes as a Service Built on OpenStack.

“At SWITCH we are looking to provide a container platform as a Service solution. We are working on Kubernetes leveraging the Openstack cloud provider integration. In this talk we show how to re-use the existing keystone credentials to access the K8s cluster, how to obtain PVCs using the Cinder storage class and many other nice integration details.”

Read more at insideHPC

jm-shell – A Highly Informative and Customized Bash Shell

jm-shell is a free open source, small, highly informative and customized Bash shell, that gives you a great wealth of information about your shell activity as well as certain useful system information such as system load average, battery status of laptops/computers and much more.

Importantly, unlike Bash which only stores unique commands in a history file, for searching previously run commands – jm-shell records each and every shell activity in a log file.

Read AlsoThe Power of Linux “History Command” in Bash Shell

In addition, if your current directory is a code repository for any version control systems such as GitSubversion, or Mercurial, it will provide information about your repositories (such as active branch).

Jm-shell Features

  • Has a status line (divider) to separate commands.
  • Displays the number of items in current directory.
  • Shows current location in the filesystem.
  • It maintains a shell log file – full history of your shell activity.
  • Displays current system load average if higher than, in red if critical (higher than 2).
  • Shows the time last command finished.
  • It prints an error code of last command, if any.
  • Displays total time of last command if higher than 4 seconds.

Read more at Tecmint

This Week in Open Source News: Microsoft Proves Linux Love, KubeCon Shows Impressive Growth & Influence & More

This week in our news roundup, Microsoft demonstrates its “open source love” with a Linux-friendly update to the Windows Notepad feature, KubeCon size tripled this year & attendees learned about the direction of Kubernetes & container orchestration & more! Read on!

1) “Microsoft has updated Notepad to be able to handle end of line characters used in Unix, Linux, and macOS environments.”

Windows Notepad Finally Understands Everyone Else’s End of Line Characters– ZDNet

2) “The KubeCon conference offered a peek at where Kubernetes and container orchestration are headed.”

3 Emerging Kubernetes Trends– The Enterprises Project

3) “A virtual machine will run Linux in a forthcoming beta Chrome OS for Pixelbook users.” 

Linux For Developers is Coming to Chrome OS– InfoWorld

4) “Consider that the attendance at KubeCon in Copenhagen last week numbered 4300 registered participants, triple the attendance in Berlin just last year.” 

Kubernetes Stands at an Important Inflection Point– TechCrunch

5) Red Hat Summit 2018 gathered open source+tech world thought leaders such as Red Hat CEO Jim Whitehurst, JewelBots CTO Sara Chipps, and Jennifer Cloer, Executive Producer of a new episodic documentary about the experiences of women in tech.

Pushing the Boundaries of Open Source at Red Hat Summit 2018– SiliconANGLE

MidnightBSD Could Be Your Gateway to FreeBSD

FreeBSD is an open source operating system that descended from the famous Berkeley Software Distribution. The first version of FreeBSD was released in 1993 and is still going strong. Around 2007, Lucas Holt wanted to create a fork of FreeBSD that made use of the GnuStep implementation of the OpenStep (now Cocoa) Objective-C frameworks, widget toolkit, and application development tools. To that end, he began development of the MidnightBSD desktop distribution.

MidnightBSD (named after Lucas’s cat, Midnight) is still in active (albeit slow) development. The latest stable release (0.8.6) has been available since August, 2017. Although the BSD distributions aren’t what you might call user-friendly, getting up to speed on their installation is a great way to familiarize yourself with how to deal with an ncurses installation and with finalizing an install via the command line.

In the end, you’ll wind up with desktop distribution of a very reliable fork of FreeBSD. It’ll take a bit of work, but if you’re a Linux user looking to stretch your skills… this is a good place to start.

I want to walk you through the process of installing MidnightBSD, how to add a graphical desktop environment, and then how to install applications.

Installation

As I mentioned, this is an ncurses installation process, so there is no point-and-click to be found. Instead, you’ll be using your keyboard Tab and arrow keys. Once you’ve downloaded the latest release, burn it to a CD/DVD or USB drive and boot your machine (or create a virtual machine in VirtualBox). The installer will open and give you three options (Figure 1). Select Install (using your keyboard arrow keys) and hit Enter.

Figure 1: Launching the MidnightBSD installer.

At this point, there are quite a lot of screens to go through. Many of those screens are self-explanatory:

  1. Set non-default key mapping (yes/no)

  2. Set hostname

  3. Add optional system components (documentation, games, 32-bit compatibility, system source code)

  4. Partitioning hard drive

  5. Administrator password

  6. Configure networking interface

  7. Select region (for timezone)

  8. Enable services (such as secure shell)

  9. Add users (Figure 2)

Figure 2: Adding a user to the system.

After you’ve added the user(s) to the system, you will then be dropped to a window (Figure 3), where you can take care of anything you might have missed or you want to re-configure. If you don’t need to make any changes, select Exit, and your configurations will be applied.

Figure 3: Applying your configurations.

In the next window, when prompted, select No, and the system will reboot. Once MidnightBSD reboots, you’re ready for the next phase of the installation.

Post install

When your newly installed MidnightBSD boots, you’ll find yourself at a command prompt. At this point, there is no graphical interface to be found. To install applications, MidnightBSD relies on the mport tool. Let’s say you want to install the Xfce desktop environment. To do this, log into MidnightBSD and issue the following commands:

sudo mport index

sudo mport install xorg

You now have the Xorg window server installed, which will allow you to install the desktop environment. Installing Xfce is handled with the command:

sudo mport install xfce

Xfce is now installed. However, we must enable it to run with the command startx. To do this, let’s first install the nano editor. Issue the command:

sudo mport install nano

With nano installed, issue the command:

nano ~/.xinitrc

That file need only contain a single line:

exec startxfce4

Save and close that file. If you now issue the command startx, the Xfce desktop environment will start. You should start to feel a bit more at home (Figure 4).

Figure 4: The Xfce desktop interface is ready to serve.

Since you don’t want to always have to issue the command startx, you’ll want to enable the login daemon. However, it’s not installed. To install this subsystem, issue the command:

sudo mport install mlogind

When the installation completes, enable mlogind at boot by adding an entry to the /etc/rc.conf file. At the bottom of the rc.conf file, add the following:

mlogind_enable=”YES”

Save and close that file. Now, when you boot (or reboot) the machine, you should be greeted by the graphical login screen. At the time of writing, after logging in, I wound up with a blank screen and the dreaded X cursor. Unfortunately, it seems there’s no fix for this at the moment. So, to gain access to your desktop environment, you must make use of the startx command.

Installing

Out of the box, you won’t find much in the way of applications. If you attempt to install applications (using mport), you’ll quickly find yourself frustrated, as very few applications can be found. To get around this, we need to check out the list of available mport software, using the svnlite command. Go back to the terminal window and issue the command:

svnlite co http://svn.midnightbsd.org/svn/mports/trunk mports

Once you do that, you should see a new directory named ~/mports. Change into that directory (with the command cd ~/.mports. Issue the ls command and you should see a number of categories (Figure 5).

Figure 5: The categories of applications now available for mport.

Say you want to install Firefox? If you look in the www directory, you’ll see a listing for linux-firefox. Issue the command:

sudo mport install linux-firefox

You should now see an entry for Firefox in the Xfce desktop menu. Go through all of the categories and install all of the software you need, using the mport command.

A sad caveat

One sad little caveat is that the only version of an office suite to be found for mport (via svnlite) is OpenOffice 3. That’s quite out of date. And although Abiword is found in the ~/mports/editors directory, it seems it’s not available for installation. Even after installing OpenOffice 3, it errors out with an Exec format error. In other words, you won’t be doing much in the way of office productivity with MidnightBSD. But, hey, if you have an old Palm Pilot lying around, you can always install pilot-link. In other words, the available software doesn’t make for an incredibly useful desktop distribution… at least not for the average user. However, if you want to develop on MidnightBSD, you’ll find plenty of available tools, ready to install (check out the ~/mports/devel directory). You could even install Drupal with the command:

sudo mport install drupal7

Of course, after that you’ll need to create a database (MySQL is already installed), install Apache (sudo mport install apache24) and configure the necessary Apache directives.

Clearly, what is installed and what can be installed is a bit of a hodgepodge of applications, systems, and servers. But with enough work, you could wind up with a distribution that could serve a specific purpose.

Enjoy the *BSD Goodness

And that is how you can get MidnightBSD up and running into a somewhat useful desktop distribution. It’s not as quick and easy as many other Linux distributions, but if you want a distribution that’ll make you think, this could be exactly what you’re looking for. Although much of the competition has quite a bit more available software titles ready for installation, MidnightBSD is certainly an interesting challenge that every Linux enthusiast or admin should try.

Learn more about Linux through the free “Introduction to Linux” course from The Linux Foundation and edX.

What’s New in Ubuntu Linux 18.04 LTS

Ubuntu 18.04 LTS “Bionic Beaver” arrives with a default Gnome desktop and a new minimalist install option for desktop users.

Canonical’s Ubuntu distribution for Linux has earned a reputation for being user-friendly, with editions aimed at desktop, server, cloud, and IoT users. This changelog tracks updates to Ubuntu across its release cycle, including its LTS (long term support) releases. 

Canonical produces new Ubuntu releases every six months and supports them with free security updates and bug fixes for at least nine months. New LTS releases arrive every two years and are supported for five years.

Read more at InfoWorld

Toward the Jet Age of Machine Learning

Machine learning today resembles the dawn of aviation. In 1903, dramatic flights by the Wright brothers ushered in the Pioneer Age of aviation, and within a decade, there was widespread belief that powered flight would revolutionize transportation and society more generally. Machine learning (ML) today is also rapidly advancing. We have recently witnessed remarkable breakthroughs on important problems including image recognition, speech translation, and natural language processing, and major technology companies are investing billions of dollars to transform themselves into ML-centric organizations. There is a growing conviction that ML holds the key to some of society’s most pressing problems….

Simply put, we needed to invent aeronautical engineering before we could transform the aviation industry. Similarly, we need to invent a new kind of engineering to build ML applications. Data-driven software development is radically different from conventional software development, as it targets complex applications domains (e.g., vision, speech, language) and focuses on learned behaviors instead of rule-based operations (e.g., training deep neural networks on massive data sets versus hand-coded if-then-else statements). Currently, very few organizations have the expertise to do this kind of engineering, and we are just scratching the surface of the potential for ML-powered technology. We describe three key challenges of this new development paradigm below.

Read more at O’Reilly