Linux User & Developer 170 - Virtualise Your System
Linux User & Developer 170 - Virtualise Your System
www.linuxuser.co.uk
LINUX USER & DEVELOPER ISSUE 170
CONCURRENT AUTOMATE
WITH ANDROID
PROGRAMMING IN GO
Master goroutines, channels and pipelines
Turn an old phone into the hub
of your own Internet of Things
DATA SECURELY
Professional ways to compress and archive files
9 772041 327002
This issue
Designer Rebekka Hearl
Photographer James Sheppard
Senior Art Editor Stephen Williams
Editor in Chief Dan Hutchinson
Publishing Director Aaron Asadi
Head of Design Ross Andrews
Contributors » Virtualise your system
» 50 terminal tricks
Mike Bedford, Joey Bernard, Toni Castilo Girona, Christian Cawley,
Sanne De Boer, Kunal Deo, Alex Ellis, Tam Hanna, Oliver Hill, Phil
King, Jon Masters, Paul O’Brien, Jack Parsons, Swayam Prakasha,
Richard Smedley, Jasmin Snook, Nitish Tiwari, Mihalis Tsoukalos and
Kevin Wittmer » Use a phone as a smart home server
Advertising
Digital or printed media packs are available on request.
Head of Sales Hang Deretz
» Back up your data securely
☎ 01202 586442
[email protected]
Sales Executive Luke Biddiscombe
☎ 01202 586431 Welcome to the latest issue of Linux User & Developer,
[email protected]
the UK and America’s favourite Linux and open source
FileSilo.co.uk
Assets and resource files for this magazine can now be found magazine. How many computers do you have in your
on this website.
Support [email protected] home? The answer, given the rise of smartphones, tablets
International
Linux User & Developer is available for licensing.
and laptop/tablet hybrids, is probably “A lot more than
Head of International Licensing Cathy Blackman ten years ago” – and that’s not including games consoles.
☎ +44 (0) 1202 586401
[email protected] Where once a single PC would serve the needs of the entire
Subscriptions
For all subscriptions enquiries
family, now it’s more likely that everyone has their own device.
[email protected] Those laptops and desktops can, however, include more than
☎ UK 0844 249 0282
☎ Overseas +44 (0) 1795 418661 one operating system, whether that’s a lightweight install to allow
www.imaginesubs.co.uk
Head of Subscriptions Sharon Todd you to skip smoothly from OS to OS, or a specialist Linux distro to
Circulation
Circulation Director Darren Pearce
enable you to perform specific tasks. As computers have become
☎ 01202 586200 Look for more and more powerful, so virtualisation has become both easier
Production issue 171 to achieve and easier to work with. In our feature on p18 this issue
Production Director Jane Hawkins on 20 Oct
☎ 01202 586200 er?
Finance Want it soon you’ll discover the essential FOSS you need to create, install and
Finance Director Marco Peroni
Subscrib e use different Linux distros as virtual machines. You’ll find the
Founder
Group Managing Director Damian Butt today! software on the disc along with three lightweight distros so that you
Printing & Distribution can explore virtualisation for yourself.
Printed by William Gibbons, 26 Planetary Road,
Willenhall, West Midlands, WV13 3XT Also this issue we take a look at the power of the command-line
Distributed in the UK, Eire & the Rest of the World by: interface and how you can use the terminal to supercharge your
Marketforce, 5 Churchill Place, Canary Wharf
London, E14 5HU system (p54), plus there’s a great range of tutorials to help you
☎ 0203 148 3300 master Bash, Go, backups, .NET and more. Enjoy the issue!
www.marketforce.co.uk
www.linuxuser.co.uk
agents or subcontractors shall be liable for the loss or damage.
www.linuxuser.co.uk 3
Reviews
79 File compression utilities
They make your files more
manageable but which is best?
OpenSource Tutorials
08 News 28 Bash masterclass: GUIs
The biggest stories from If users find Terminal windows intimidating, PeaZip Hamster
the open source world display a Graphic User Interface
Join us online for more Linux news, opinion and reviews www.linuxuser.co.uk
4
CLOUD
HOSTING
The best of both worlds!
Scalable on-demand and flexible server
resources combined with a high performance
hosting package: The new 1&1 Managed
Cloud Hosting is here! Ideal for online
projects which require the highest levels of
availability, security and flexibility.
Dedicated resources
20+ stack variations
Managed by 1&1 experts
Flexible scalability
Deployed <1 minute
TRY FREE
FOR 30 DAYS!*
Trusted Performance.
Intel® Xeon® processors.
1 TRIAL
TRY FOR
30 DAYS 1 CLICK
UPGRADE OR
DOWNGRADE 1 CALL
SPEAK TO
AN EXPERT
On your free
DVD this issue
Find out what’s on your free disc Load DVD
To access software and tutorial
files, simply insert the disc into
Welcome to the Linux User & Developer machines to the best selection of lightweight your computer and double-click
DVD. Run dozens of distros on one machine distros, this kit has got everything you need the icon.
with our complete virtualisation toolkit. to transform your PC into a virtualised
From backing up data to running virtual powerhouse today! Live boot
To live-boot into the distros
Please note:
• You will need to ensure that
your computer is set up to boot
from disc (press F9 on your
computer’s BIOS screen to
change Boot Options).
• Some computers require
you to press a key to enable
booting from disc – check your
manual or the manufacturer’s
website to find out if this is the
Lubuntu Trisquel case on your PC.
• Live-booting distros are read
The objective of the Lubuntu project is to create a variant Trisquel is designed to run well on netbooks and
of Ubuntu that is lighter, less resource-hungry and more
from the disc: they will not be
low-power computers. It uses low-resource desktop
energy-efficient by using lightweight applications and environment LXDE (Lightweight X11 Desktop
installed permanently on your
LXDE, the Lightweight X11 Desktop Environment, as its Environment) and lightweight GTK+ and X Window computer unless you choose
default GUI. System alternatives to GNOME and KDE/Qt applications. to do so.
Problems with
the disc?
Send us an email at linuxuser@
QEMU KVM imagine-publishing.co.uk
QEMU is a generic and open source machine emulator KVM (for Kernel-based Virtual Machine) is a full
Please note however that if you
and virtualiser. When used as a machine emulator, virtualisation solution for Linux on x86 hardware
QEMU can run OSes and programs made for one containing virtualisation extensions (Intel VT or AMD-V). are having problems using the
machine (e.g. an ARM board) on a different machine (e.g. It consists of a loadable kernel module that provides programs or resources provided,
your own PC). By using dynamic translation, it achieves the core virtualisation infrastructure and a processor then please contact the relevant
very good performance. specific module. software companies.
Loss of data
In no event will Imagine Publishing
Limited accept liability or be held
responsible for any damage,
disruption and/or loss to data or
computer systems as a result of
using ‘this disc’. Imagine Publishing
Limited makes every effort to
ensure that ‘this disc’ is delivered to
you free from viruses and spyware.
We do still strongly recommend that
you run a virus checker over ‘this
disc’ before use and that you have
an up-to-date backup of your hard
drive before using ‘this disc’.
Hyperlinks:
Imagine Publishing Limited does not
accept any liability for content that
may appear as a result of visiting
hyperlinks published in ‘this disc’. At
the time of production, all hyperlinks
on ‘this disc’ linked to the desired
destination. Imagine Publishing
Limited cannot guarantee that at the
time of use these hyperlinks direct
to that same intended content as
Imagine Publishing Limited has no
control over the content delivered on
these hyperlinks.
Software Licensing
Software is licensed under different
terms; please check that you know
which one a program uses before you
install it.
www.linuxuser.co.uk 7
Desktop
Customise this
3D-printed computer
This $65 computer
is easily upgradable
thanks to its 3D
printed parts
Manufacturing desktop computing parts the environment. Another key beneit of using needed, but there’s also plenty of customisation
isn’t overly good for the environment, so it’s 3D printed parts at the core of the EOMA68 is options as well.
no wonder Rhombus tech’s ‘earth-friendly’ that it makes it relatively simple for users to In a recent statement by Rhombus Tech, the
desktop computer has already garnered a lot of upgrade and repair on the ly. company made its intent known for the open-
support. The EOMA68 computing devices offer At the core of the 3D printed computer is the PC source project. “We are going above and beyond
an alternative stance to the classic computing card, which features 8GB of on-board storage, 2GB by providing full CAD files, schematics, and
platform, using a standardised PC board alongside of RAM and an ARM processor. For Linux users, datasheets for all the parts (without NDAs) as well
a series of 3D printable housing parts. you’ll be pleased to hear the EOMA68 boasts as having the 3D CAD files for the casework as a
At the time of writing, UK startup Rhombus support for a wide range of distros, including completely open GPLv3+ licensed project right
Tech has raised nearly 75 per cent of its CentOS, Debian, Fedora and Arch Linux. Backers from its inception. In addition, all firmware and
$150,000 crowdfunding goal, but with a of the project on the EOMA68’s crowdfunding page kernel sources are GPL-licensed and will always
number of days of left, it’s likely it’ll far can also get their hands on a laser-cut plywood remain so, and have been vetted in advance
exceed its original target. The company has desktop base unit, or a 15.6-inch laptop housing and do not contain any copyright violations or
developed what it’s touting as an ‘earth- for the PC card. proprietary license-violating blobs.”
friendly’ computer, which relies on easily The choice of housing is a great addition to the Backers of the EOMA68 crowdfunding
attainable materials that have little impact on EOMA68 computer, and the crowdfunding options campaign are expected to be getting their hands
for backers are plentiful. As well the housing on their device by the end of spring 2017, with
EOMA68 boasts support options mentioned previously, potential owners
can also order a complete computer with pre-
shipping due to start in March. For those ordering
the $500 pre-printed kit, you’ll have the option to
for a wide range of distros, printed housing for $500, or alternatively they can choose between different colour combinations
download the variety of CAD files needed for the and construction materials including a deluxe
including CentOS, Debian, housing and print their own. The downloadable black resin option. It’s unknown how many units
Fedora and Arch Linux CAD files allow for cost-effective repairs when will be available outside of the crowdfunding page.
1 CorePlus
CorePlus is one of the smallest Linux distros,
and ships with three very different variants. The
smallest of the small is the Core edition, which
uses just 10MB of resources, but lacks a window
2 LXLE
Euclid is perfect The lack of resources taken up by LXLE make it a
sensible choice for those looking to breathe new life
into an aging desktop machine. It’s tailored to work
for robot makers out of the box, but with plenty of customisations on
hand as well to make it your own.
www.linuxuser.co.uk 9
ChrOme
Google’s
Chrome
Apps leave
Linux
Google is going to be
discontinuing all Chrome
Apps for non-Chrome
operating systems
In a recent blog post made by Google, the
company said that it will soon be removing
Above Chrome Apps for Linux will disappear by 2018
all Chrome Apps from non-Chrome operating
systems. While it’s a big blow for those who slightly more surprising blow, despite their low Among the apps being discontinued is the
frequently use them on their Linux desktops, the usage. “Today, approximately 1 per cent of users fantastic Pixlr Touch Up photo editor, as well as
general uptake has been slow, so the removal on Windows, Mac and Linux actively use Chrome an abundance of popular gaming titles. If you’re
comes as little surprise. However, the removal packaged apps, and most hosted apps are already now manically moving your saved Chrome App
of Chrome Apps from Windows and OS X is a implemented as regular web apps,” said Rahul Roy files between devices, there’s no need to panic, as
Chowdhury, VP of Product Management at Google. the wind-down of the service will be gradual over
All current Chrome Apps “On Windows, Mac, and Linux, we encourage the next months. All current Chrome Apps will still
developers to migrate their Chrome apps to the remain available for a while, with developers still
will still remain available for web. Developers who can’t fully move their apps allowed to make updates across all platforms. The
a while, with developers still to the web can help us prioritise new APIs to fill the Chrome Web Store is set to stop showing Chrome
gaps left by Chrome apps. In the short term, they Apps for Windows, Mac and Linux in the second
allowed to make updates can also consider using a Chrome extension or quarter of 2017, with the apps being removed
across all platforms platforms such as Electron or NW.js.” entirely by 2018.
COmmAND LINe
PowerShell scripting language inally goes open source
As far as scripting languages go, The codebase for PowerShell will work Microsoft has also added the PowerShell
microsoft’s PowerShell is considered across all compatible, open source OSes, Editor Service to Linux, a great tool that can
one of the best. It’s an ideal piece of kit and will be readily available with a license on be implemented into text editors built for
to have around for running and managing GitHub. It’s important to note that this initial debugging and programming. For some,
system tasks with ease, and is also perfect release is very much in the alpha phase, so PowerShell and its Editor Service will
for those who are looking for something users should be aware that certain features be completely foreign, so it’s handy that
built on the .NET framework. Microsoft have been stripped back, and they may face Microsoft is also launching a free online
has teased the release of PowerShell over compatibility issues in other areas. academy course for users. It covers all the
on Linux for a while, so it’s great to see basics you need to learn about PowerShell,
that the command-line shell has inally
gone open source. With Microsoft’s ‘multi-
It’s an ideal piece of kit and details the best ways you can implement
it into your setup.
platform’ dream in full low, we are likely to to have around for running Interested? Head over to PowerShell’s
see many of its other core software tools repository on GitHub at: https://github.com/
eventually make the full transition across
and managing system tasks PowerShell/PowerShell/tree/master/docs/
to Linux. with ease learning-powershell
10
2.
Linux Mint
Debian
2,978
1,800
compatibility
3. Ubuntu 1,701
4. openSUSE 1,166
5. Manjaro 1,114
7. elementary 904
While the Surface 3 may have received plenty However, that’s all about to change with the
of critical success, it has by and large alienated first release candidate of Linux 4.8. Built in to the 8. Zorin 853
Linux users wanting a solid piece of hardware. release is a new driver, with noted support for 9. CentOS 832
It has been plausible getting older versions of the Surface 3 touchscreen controller. We should
the Linux kernel working on the Surface series mention here that a lot can change between now 10. Arch Linux 801
of tablets, but the process is, arguably, far more and the emergence of the final release, so the
convoluted than it’s worth. driver may also be changed; it is however, a great
inclusion for those seeking a new tablet.
This month
The $499 Surface 3 should run Linux very well, ■ Stable releases (16)
and speculation is rife that our favourite OS may ■ In development (10)
work even better with the tablet’s Atom processor
than it does on Windows. Mint is definitely the
Other updates included in the first release flavour of the month
currently, and it’s one of
candidate of Linux 4.8 are largely minimal. the few months we’ve
Alongside the Surface 3, there’s added support encountered that we
for the entry level Pegasus Notetaker tablet, as haven’t seen any major
Ubuntu-based
well as options for Raydium’s I2C’s touchscreen distro releases.
controllers as well. Users can get a full run
though of the updates over at: http://lkml.iu.edu/ Highlights
hypermail/linux/kernel/1608.0/04804.html
Mint
TCP Mint has been steadily growing its
userbase over the past few months, and
Linux TCP bug puts 1.4 billion it’s still gaining support thanks to its most recent
update. Make sure to give it a download if you
haven’t done so already.
Analysts warn that 8 out of 10 Android devices to gain users this month, but we’re not
surprised. It’s still one of the prettiest distributions
could be exposed out there, with some nice graphic enhancements
also on board.
A bug within Linux’s transmission control be manipulated and used. Data of this nature
protocol, used primarily when browsing the should always be put behind some sort of Arch
internet on unsecured connections, has encryption, and now is a good time to do so if you Arch may have fallen out of favour with
potentially left 1.4 billion Android users at risk. haven’t already. people, but there’s some fantastic spin-off
Security giant Lookout has discovered While at the time of writing there’s no known distros out there that look to really show off what
that nearly 8 out of 10 Android devices are fix for the issue, it’s believed that a fix will come Arch is capable of. We implore you to check them out.
potentially at risk, adding that the fault in the from Google just before or after the release of
TCP has potentially enabled hackers to hijack Android Nougat. In the meantime, Android users
internet traffic and modify connections. In the should do all that they can to browse the web Latest distros
long run, it can mean your smartphone is taken only on a secured connection, or use a trusted available:
over by snoopers, and your sensitive data can VPN service to mask their IP.
filesilo.co.uk
www.linuxuser.co.uk 11
timothy Freeburn
Timothy Freeburn is the director
and owner of the uK-based
robotics company Freeburn
robotics. he has extensive
experience in the design and
manufacture of high-quality
PCbs and electronics equipment.
where did the idea for Formula Pi How are the races structured? Does it have a
come from? league-based system, for example?
When i was young, my father used to Quite a few different ideas have been proposed.
take me to watch motor racing. While most people The reason this hasn’t been explained yet is
were obsessed with driving the cars or which because the actual form depends on the amount
celebrity the driver was, i always preferred the of competitors we get on board with the project.
engineering behind the cars and how they were it is most likely that we will run a league based on
built. i always wondered what it would be like to heats of ive. There will be an accommodation for
take the driver away from the car, and have the cars any mechanical problems, and to ill any gaps, we
compete among themselves. how cool is it to have a will have robots running the standard, unmodiied
driver take their hands off the wheel? To have self- code that we supply to each racer. We feel this will
driving cars taking sick people to hospitals, for old be the most interesting and fair for the competitors
people to visit their family even if they can’t see well, that get involved.
or to get me home from the “very occasional” pub At the moment, it is most likely that the heats will
evening! it was these ideas that eventually formed take place every two weeks, so that people have a
what we wanted to achieve with Formula Pi. chance to tweak code before the next heat and make
12
www.linuxuser.co.uk 13
The winning
combination
Each competitor will receive the standard
race code, manufactured by the Formula Pi
team, which has to be used within their robot.
However, it’s up to the competitor to explore
the ways they can adapt the code to help
improve how their robot performs in a race.
Essentially these changes can be as simple or
as advanced as you see fit. For example, some
may want to alter the code to help their robot
react better when navigating corners, while
others may want to improve how the robot
makes decisions when going around the track.
should be okay for racing. They have large wheels
What we’re most impressed with is the
so if the robots do not try to avoid each other, they
will get tangled together which will be a massive They only use control that each racer has over their robot’s
motors. One particular section of the script
disadvantage. The only input to the Raspberry
Pi is from the Pi Camera. This is very different to the Raspberry relates solely to the motor speeds, and it’ll be up
to the competitor to figure out the top speeds
many other forms of autonomous cars which have
Lidar, radar, GPS, accelerometers and so on. They
Pi Zero to that can be achieved without the robot missing
corners or crashing into other robots.
also only use the £4 Raspberry Pi Zero to do all the
calculations, so efficient code is a requirement for a
do all the
good racing experience. calculations, separate segments to make it simple to understand,
and we will have all sorts of educational material to
What sort of knowledge of the Raspberry Pi and so efficient help people get up to speed with the coding. So by no
robotics does a potential entrant need before joining?
Anyone can join really! We have code ready to go,
code is a means do you need to be knowledgeable in robotics
to get started with Formula Pi.
so the minimum someone would need to do is just requirement for
resend the code back to us and decorate their Is there scope for entrants to tinker with
YetiLid (the top plate on the robot so we can identify a good racing the software to help improve their robot’s
the entry). However, with some really basic coding
skills, great improvements can be made to the
experience performance?
Simple things such as deciding which lane to be in and
code to be more competitive. The code is split into when, will greatly improve the performance. Probably
14
www.linuxuser.co.uk 15
opinion
16
www.linuxuser.co.uk 17
18
19
20
01 Install QEMU
If it’s not installed already, update your Linux repos,
Check 04 Create a virtual machine with QEMU
A good example is the following command, which
creates a virtual machine with 1GB of RAM, sets the
before installing the QEMU package, using the command line.
your ISO irst! CD-ROM as the primary boot device, enables KVM for
For Ubuntu, this will be: Before installation, hardware virtualisation, uses three CPU cores, and has
conirm that the ISO network access. This will be installed to the test-image.img
that you’re about to
sudo apt-get install qemu qemu-kvm libvirt-bin virtual HDD.
install on a virtual
machine is working.
RedHat/Fedora users, go with: One way to do this is qemu-system-x86_64 -m 1024 -boot d -enable-kvm
to mount it, either as -smp 3 -net nic -net user -hda test-image.img
sudo dnf install qemu qemu-kvm a virtual device, or -cdrom ubuntu-16.04.iso
burn it and mount it
from a physical drive.
SUSE/openSUSE uses: Note that the ISO ile you choose for your VM will require the
As long as you can
open the directories
full ile path included in the command. If necessary, RAM
sudo zypper in qemu on the disc, things can be increased.
should be good.
If you’re on Arch Linux, use:
www.linuxuser.co.uk 21
Above The Virtual Machine Manager GUI makes virtualisation as easy as it is in VirtualBox, but with more options under the hood to allow for
greater configuration. The main window shows a list of hypervisors and a quick rundown of performance
22
03 Build your
virtual machine
Next, you’ll be prompted to
Which
is the right
05 Deal with a corrupt disc or image
Problems installing an operating system to a virtual
machine are not uncommon, and are usually one of two
specify your virtual machine’s virtual things. The first common problem is setting up the virtual
memory and CPU settings. machine? machine with an unsuitable hardware specification.
Remember, these will be limited The other is dealing with bad discs and images. It can
Getting the utility
by your host PC’s hardware, prove particularly troublesome if the VM is caught in a boot
right partially
so you cannot exceed what depends on loop or some sort of repeated error.
is built into your physical what you want Should this happen, you’ll need to force the virtual
computer’s specification. to virtualise, but machine to shutdown, using the Force Off command in the
In the next screen, it’s time to create a disk image. You virtual machine power menu.
can use the default disk image size, or specify your own. applications should
also be chosen
Proceeding to the next screen, you’ll be prompted
based on what you
to name your virtual PC. Confirm the correct network need, and how easy
selection before hitting Finish to complete creation of the you want it to be.
virtual machine. Let’s face it:
QEMU’s command-
line interface
is complicated.
Conversely, Virtual
Machine Manager
for KVM and
VirtualBox are both
far more attractive
and easier to use.
The advanced
features remain;
they’re simply kept
out of sight, ready
for you to use them.
The answer as
to which is the
right VM for you is
simple: it’s the one
that helps you to get
www.linuxuser.co.uk 23
24
£5.99
£4.49
per issue
Expiry date
Sort Code Account no
Ple as e pay Imagine Publis hing Limite d Dire c t De bits fro m the ac c o unt de taile d in this ins truc tio n s ubje c t to the Pay by Cheque Made payable to
s afe guards as s ure d by the Dire c t De bit guarante e . I unde rs tand that this ins truc tio n may re main with
Imagine Publis hing Limite d and, if s o , de tails will be pas s e d o n e le c tro nic ally to my Bank/ Building So c ie ty.
I enclose a cheque for £ Imagine Publishing Ltd
Banks & Building So c ie tie s may no t ac c e pt Dire c t De bit ins truc tio ns fo r s o me type s o f ac c o unt
Your information
Name Address
Email address
Postcode
Please post this form to
Ple as e tic k if yo u do no t wis h to re c e ive any Ple as e tic k if yo u do no t wis h to re c e ive any pro mo tio nal mate rial
pro mo tio nal mate rial fro m Imagine Publis hing Ltd fro m o the r c o mpanie s ■ By po s t ■ By te le pho ne
Linux User & Developer Subscriptions, 800 Guillat Avenue, Kent Science
■ By po s t ■ By te le pho ne ■ By e mail ■ Ple as e tic k if yo u DO wis h to re c e ive s uc h info rmatio n by e mail Park, Sittingbourne, Kent ME9 8GU
* This o ffe r e ntitle s ne w UK Dire c t De bit s ubs c ribe rs to pay o nly £ 2 6 .9 5 e ve ry 6 is s ue s . Offe r c o de PS1 6 mus t be quo te d to re c e ive this s pe c ial s ubs c riptio n pric e . Ne w s ubs c riptio ns will s tart
fro m the ne xt available is s ue . De tails o f the Dire c t De bit guarante e are available o n re que s t. Subs c ribe rs c an c anc e l this s ubs c riptio n at any time . This o ffe r e xpire s 3 1 s t De c e mbe r 2 0 1 6 .
Bash
Tam Hanna
sometimes inds
himself in the
masterclass
Display graphical
thankless role of
supporting technically
challenged end users
who freak out when
presented with a
terminal window. In
that case, adding a
user interfaces
bit of graphical sugar
is a sure-ire way to
remove intimidation.
from your
Resources
Bash
gnu.org/software/
bash
Bash script
The black terminal window can
be intimidating to average users.
Both Dialog and Xdialog try to
alleviate this problem
Decades of hacker movies have ensured that Joe User utilities that provide these features for you. Dialog is,
has a dedicated bit of respect of all things Terminal. by far, the most common of the group – it will be the
The Bash shell can be combined with a bunch of useful focus of this article. It is not, however, the only product
system commands to create nifty scripts dedicated to covered here – read the article fully to empower your
ile system traversal. Bash scripts to take control of traditional graphical user
Given that Bash is Turing-complete, developers could interfaces (GUIs).
– in theory – use ncurses or a similar library to create To cut a long story short: a script is valuable
Tutorial iles custom output. A more practical approach involves only if users accept it. Providing a graphical and/or
available: the invocation of dedicated programs that handle the semigraphical user interface boosts usability, thereby
filesilo.co.uk selection process and return a result to the caller. helping you to extract additional value from your existing
As time went by, developers created a large variety of script logic.
28
Invocations of dialog require the presence of at least dialog --title "Message" --yesno "Should we
four parameters: title is used to set the title of the user launch a missile?" 6 40
interface shown, while the two numbers describe the response=$?
height and width of the dialog. Their unit is the ‘console case $response in
character’: it is usually a rectangle. Its usage is best 0) echo "Rocket launch!";;
described via the three images here, which show the 1) echo "Canceled!";;
inluence of various values of height and width. 255) echo "[ESC].";;
esac
Present a menu!
Returning numerical results cannot only be used to say
Yes and No. If a menu has a numerical value assigned to
each selection, the user can be made to express their
Above Using 20 20 makes the dialog very wide due to the desires without having to resort to typing in strings. This is
asynchronous shape of console pixels beneicial from a usability point of view: if users are given
www.linuxuser.co.uk 29
an opportunity to make typos, the dreaded lapsus clavis is a redirection – the following example script collects some
likely to rear its ugly head. input, which is then printed out in a non-graphical fashion:
From a coding point of view, implementing a menu is not
particularly dificult: #/bin/bash
#/bin/bash cache=$?
dialog --inputbox "What is your input" 10 40
dialog --menu "Choose one:" 12 30 4 1 "Option 2>$cache
1" 2 "Option 2" 3 "Option 3" 4 "Option 4"
name=$(<$cache)
response=$?
case $response in echo "User input was:"
0) echo "Rocket launch!";; echo $name
. . .
Clean up after yourself
The main difference to the Dialog examples here is that we Right now, running any of our samples leads to garbled output
pass the --menu option. It changes Dialog’s behaviour in two similar to that shown below – the remainders of the dialog
ways: irst of all, the sizing of the dialog is now handled via three remain on-screen after Dialog has done its work.
integers. The irst two modify the size of the window, while the
third governs the number of choices shown on-screen. Change
number two affects the population of the menu – its choices
are taken from parameters which are read in pairs.
Parameter number one designates the ‘shortcut
character’, while parameter number two is the actual
display text. Running our code example in its current
coniguration leads to the result shown below.
#/bin/bash
whiptail --menu "Choose one:" 12 30 4 1
"Option 1" 2 "Option 2" 3 "Option 3" 4 "Option 4"
. . .
30
www.linuxuser.co.uk 31
Introducing Visual Studio Code True to its open source roots, Visual Studio Code provides
Visual Studio Code is a free, open source editor spawned by embedded Git control for standard client actions. It also has
Microsoft with key contributions coming from industry notables, built-in debugging support for the Node.js runtime. The general
namely Erich Gamma who co-authored the classic text Design philosophy of the Visual Studio Code editor is to make features
Patterns: Elements of Reusable Object-Oriented Software discoverable from a keyboard-centric, autocompletion-enabled
Resources (1994) as part of the Gang of Four (GoF). Similar to .NET Core, command palette, rather than deep menu hierarchies rendered
Fedora installation Visual Studio Core is open source software distributed with the in a complex UI. These features are either built in or can be
instructions for MIT licence and maintained on GitHub. The main building blocks dynamically loaded into the code editor via extension or injected
.NET Core of this slim, fast, cross-platform editor are as follows: via JSON-based files. In the steps we will overview .NET Core
microsoft.com/net/
development using Visual Studio Code and the .NE T Core SDK.
core#fedora
• Cross-platform shell: Visual Studio Code leverages portions
Visual Studio Code
code.visualstudio.com
C# Extension for
of the Electron open source project for cross-platform shell
support spanning multiple UI areas.
• Rich Editor: Monaco is used as the code editor, offering
01 Install .NET Core SDK
along with Visual
Studio Code
Visual Studio Code
code.visualstudio.com/ rich, language-based syntax highlighting. Visual Studio To begin, you will need to install
docs/languages/csharp Code uses the Monaco editor to realise syntax highlighting the .NET Core SDK and Visual
Studio Code editor. Binaries for
both the .NET Core SDK and Visual
Studio Code editor are available
for download from Microsoft (using the links given in Resources,
on the left). Linux distros officially quoted as being supported
by the Visual Studio Code editor are not quite as broad as the
.NET Core SDK, as this list currently includes Ubuntu, Debian,
Red Hat, Fedora and CentOS. Expect that Linux distros officially
listed will widen and shift over the next months.
The command series below, placed into a simple Bash script,
Right will download and install the SDK and editor bits into Fedora
Visual Studio Code in one shot. In the case of Fedora, we have targeted release 23
is an open source which comes with the newer dnf package management tooling
editor that supports that provides improved dependency resolution and online
development in repository interaction.
C# and numerous
other programming #!/bin/bash
languages sudo dnf install -y libunwind libicu
32
www.linuxuser.co.uk 33
types. (Note that the complete source code for this project can "dependencies": {
Alternative be found on the cover disc.) "xunit": "2.2.0-beta2-build3300",
editors for "dotnet-test-xunit": "2.2.0-preview2-build1029"
C# coding in public class ShellSorter },
Linux {
Visual Studio Code public delegate bool IsGreater<T>(T a, T b); You can also achieve the dotnet restore step manually. This can
is not the only be accomplished from View>Command Palette. Type dotnet and
editor available for public static void Sort<T>(T[] array, IsGreater<T> then use autocompletion to navigate to the dotnet restore entry,
C# coding in the isArg1Greater) then hit Enter to trigger the restore step.
Linux environment. { With the xUnit dependency added to the project.json
Leveraging the
int h = array.Length/3; configuration file, create a simple xUnit test as follows:
OmniSharp software
base, Intellisense while(h > 0) using Xunit:
support for the {
C# programming for(int i = h; i < array.Length; i++) public class ShellSortTest
language is { {
available from other int j; static bool ShortComparer(short a, short b) => a
editors including
Vim, Emacs and
T dataObject = array[i]; > b;
Sublime. OmniSharp for(j = i; j >= h &&
is a software isArg1Greater(array[j-h], dataObject); j-=h) [Fact]
technology that { public void TestFirstAndLastSort()
provides Intellisense array[j] = array[j-h]; {
capabilities for } short[] data = {10,7,3,1,9,7,4,3};
rich code editing
in C#. Intellisense
array[j] = dataObject; ShellSorter.Sort<short>(data, ShortComparer);
integration } Assert.Equal((short) 1, data[0]);
leverages the plug-in h/=2; Assert.Equal((short) 10, data[7]);
architecture of } }
these popular, well- } }
established editors. }
OmniSharp-aware
For brevity, we have only included assertions that test the first
plug-ins will connect
to a background To consume the sorting algorithm class, place the following code and last members of the array. With the unit test code defined,
OmniSharp server. in the Program.cs file. you can use the keyboard shortcut Ctrl+Shift+B to build the
In the case of updated source code project.
Omnisharp-vim, static bool ShortComparer(short a, short b) => a > Add this to the tasks.json file:
both the newer b;
omnisharp-roslyn
server as well as
{
the longer-standing And include this code fragment in the Main method of the "taskName": "test",
OmniSharp server Program class: "args": [
can be configured "${workspaceRoot}/project.json"
as the background short[] data = {10,7,3,1,9,7,4,3}; ],
server providing ShellSorter.Sort<short>(data, ShortComparer); "isBuildCommand": false,
IntelliSense
capabilities. Going
"isTestCommand": true,
beyond Emacs or With the source code inserted, you can use the Visual Studio Code "problemMatcher": "$msCompile"
Sublime, you can shortcut Ctrl+Shift+B to build the source code project. }
transition into Linux-
06
friendly IDEs such Run unit tests from Visual Studio Code To trigger the test runner from a keyboard shortcut, add the
as MonoDevelop Let's craft a simple xUnit.net following to the keybind.json file:
and SharpDevelop.
test class to test the sorting logic.
However, these
code development First, however, we need to add the [
tools have not yet xUnit dependency to the JSON-based { "key": "ctrl+shift+q", "command": "workbench.
been retrofitted project specification. This involves action.tasks.test" }
to work with .NET updating the project.json file with ]
Core, but likely it is the xUnit dependencies. The Visual Studio Code editor is smart
only a matter of time
enough to detect dependency changes in the project.json and After saving keybind.json, you can immediately use the
before open source
efforts realise this check to see if the .NET dependencies exist locally. If this does keyboard shortcut Ctrl+Shift+Q to run all unit tests in the
augmented support. not, Visual Studio Code will attempt a restore operation by project scope. Unit tests that passed, failed and were skipped
prompting you to initiate such an action. appear in the textual text execution summary.
To configure the .NET project for unit testing, update
project.json to include the following:
"testRunner": "xunit",
07 Debug your code
To debug from Visual Studio Code, set a break point
in the sort method and launch the debugger. The debugging
34
08
To
More debugging
techniques
complement the basic
},
{
"problemMatcher": "$msCompile"
09 Custom editor
tasks
Visual Studio Code also supports
],
"isBuildCommand": false,
"isTestCommand": false
definition of custom editor tasks. }
In the example here, additional ]
tasks for the dotnet pack and }
dotnet publish commands are defined as they are not
currently supported by Visual Studio Code out-of-the-box The pack and publish custom tasks defined here reference
(however, we expect this will change in the near future). the workspace project.json as an input argument and require
As a quick introduction or reminder, the dotnet pack no processing output. With these tasks defined, you are ready
command builds the project and creates NuGet packages. to map them to keyboard shortcuts by defining the following
The result of this operation is two NuGet packages: one entries in the keybind.json file:
package contains the code and the other contains the
debug symbols. Pack is different in that it is oriented to [
runtime deployment, as the dotnet publish command { "key": "ctrl+shift+q", "command": "workbench.
will place the application and all of its dependencies into a action.tasks.test" },
single, publish-ready folder. { "key": "ctrl+shift+9", "command": "workbench.
To add custom tasks in Visual Studio Code, you need to action.tasks.runTask" }
modify the task.json file. To begin, use the folder button ]
www.linuxuser.co.uk 35
36
www.linuxuser.co.uk 37
38
www.linuxuser.co.uk 39
Masscan
http://bit.ly/1pSDGls
Censys Database
https://www.censys.io/
Censys API
http://bit.ly/2bQpRVI
Heartbleed bug
http://heartbleed.com/
Heartbleed PoC
exploit
http://bit.ly/2bIKwMJ
Right Searching
for potentially
Heartbleed-
vulnerable servers
using the Censys
engine still reveals a
shocking number of
221, 501 hosts (at the
time of writing)
40
www.linuxuser.co.uk 41
Because we will be calling this API from Python, you have to print result[:30]
install the Censys Python library as well: except:
print “Timeout or error”
# pip install censys
Don't forget to import the socket library and to set a desired
To illustrate how to use Censys API, you will be performing the value for the timeout variable:
same query as before (i.e, searching for potential trojanised
versions of Vsftp 2.3.4 in Spain), but this time writing a script import socket
in Python. Grab your favourite ASCII editor and write the ….
following down: timeout = 5
#!/usr/bin/python Save it and execute it once again. Now, for each host reported
import sys by Censys, you will be establishing a TCP connection in order
import censys.ipv4 to grab a few bytes from the host. You are basically obtaining
its banner to make sure it matches up:
UID=”your API Key”
SECRET=”Your API Secret” X.Y.W.Z Updated at: 2016-07-23T08:58:42+00:00
fields = ["ip", "protocols"] UP
query= (”21.ftp.banner: 220 \(vsFTPd 2.3.4\) “ 220 (vsFTPd 2.3.4)
“and location.country_code: ES”)
X.Y.W.Z Updated at: 2016-07-23T07:00:12+00:00
ipv4s = censys.ipv4.CensysIPv4(UID, SECRET) UP
for ip in ipv4s.search(query): 220 (vsFTPd 2.3.4)
print ip["ip"] , "Updated at: " ,
updated["updated_at"] The bad guys may be doing the same thing; i.e. connecting to
the hosts and comparing their banners with those reported
Save it as vsftp.py and set its executable bit: by Censys. If they match up, the next step for an attacker
would be to execute an exploit in order to take over the remote
~$ chmod +x vsftp.py system. Of course this is illegal, but if you are testing your
own servers it could be a good idea to make sure they are not
Run it: vulnerable. This is precisely your next scenario!
Black Hats can query Censys for vulnerable hosts all around
the world and then execute an exploit to take them over
you will eventually have to establish a TCP connection to the Heartbleed-vulnerable servers inside your organisation, with
target. Add these lines to your previous script right after the different branches scattered all around the world. Chances
print line (make sure they are indented to the same level): are that these servers are in Censys' database too (if they are
publicly accessible, that is). For this scenario you will be using:
try:
socket.setdefaulttimeout(timeout) • A modiied version of a well-known exploit from
con = socket.socket() ExploitDB (32764)
con.connect((ip["ip"],21)) • A shell script that runs the previous exploit a inite number
result = con.recv(33333) of times
con.close() • A Python script that queries Censys in search for potentially
print "UP", Heartbleed-vulnerable servers and calls the other two
42
Conclusions
Querying Censys from the deep ... Censys holds an incredible amount of data that you can leverage
You are auditing your own systems, so you don't need to perform in your search for security vulnerabilities. Bear in mind that
queries in a stealthy way. But an attacker does. They could use Black Hats are probably taking advantage of this information
proxychains plus the Tor Network in order to hide their real IP. too. Although the information that Censys hold may not be 100
They probably would be using an already compromised system
per cent accurate, it is still a good starting point. By calling its
anyway. Although some well-known disposable email services
are black-listed from Censys (such as dropmail.me), an account API from Python you can write powerful scripts that automate
does not need to be associated with a real user... different aspects of your daily security engagements. We hope
this tutorial has shown you the way.
www.linuxuser.co.uk 43
Resources
Types of backup
http://typesofbackup.
com/
Data backup
types explained
bit.ly/16uRkcS
Backup virtual
servers with
traditional
techniques and
specialised tools
bit.ly/2bjeczS
44
One risk of keeping all your data on local machines is another machine
over a network.
~$ gunzip -v my_files.gz
This unzips my_iles.gz and renames it as my_iles.
Another command, bzip2, can also be used in the same way and
this is considered to provide the highest level of compression.
The following examples illustrate the use of this command
~$ bzip2 my_files
Compresses the ile and renames it my_iles.bz2.
~$ bunzip2 my_files.bz2
Above Installing lzop Decompresses and renames.
www.linuxuser.co.uk 45
The third command for compression – lzop – works ~$ mkdir my_backup; cd my_backup
OpenSSH differently compared to gzip and bzip2.The important thing ~$ssh me@server1 ‘tar cf - my_file*’ | tar xvf -
tools for to note here is that when we use lzop for compressing the
backup over contents of a ile, it leaves the original ile intact, but creates In the above example, the iles beginning with my_ile are
a network a new ile with a .lzo extension. This is illustrated in the all copied from our home directory (on server 1) and placed
OpenSSH provides
following examples. in the current directory. It can be noted here that the left
a variety of tools side of the pipe creates an archive whereas the right side
that are helpful ~$ lzop -v my_files expands the iles from the archive to the current directory.
for backup over a Decompresses and renames. The rsync command provides a rich feature set that can
network. In addition be used for backup over a network. The concept behind
to network backup,
~$ lzop -U my_files rsync is that it employs an algorithm that will compare the
these tools can also
be used for remote
This removes my_iles and creates a compressed ile, my_ local and remote iles one small block at a time. After that,
login and remote iles.lzo. it only transfers those blocks that are different. The rsync
execution too. In client needs to be installed irst; you can do this by using
order to transfer The main use of tar is to create and unpack archives. the command here:
iles between two But there are various other options that can be used for
machines securely,
joining archives, adding iles to an existing archive and ~$ sudo apt-get install rsync
you need to set
them up to share
also to delete iles from an archive. Let's look at this with a
encryption keys. few examples. This command comes with a lot of options. Please refer to
This feature allows the screen shot to see more rsync options.
us to come up with ~$ tar -Af my_files1.tar my_files2.tar
scripts that can be
used to back up data
In the above example, we are trying to concatenate one
from a client to a
server without the
tar ile to another – where we have used the –A option to
need for any manual achieve this. In other words, the content of one archive is
intervention. added to the second one.
~$ tar rvf my_files1.tar *.c Above Options within the rsync command
Sometimes you may even need to delete a ile from an It can also be used to take backups on local machines and in
archive. A simple example for deleting iles from a tar most cases, the following command will do the work for us:
archive is shown here.
~$ rsync -av -delete /my_dir1/ /my_dir2/
~$ tar -delete extra_file -f my_files1.tar
The above one line code will sync up the contents of my_dir1
Let’s look at how to effectively use backup techniques over to my_dir2. It can be noted here that if rsync inds that my_
a network. Fast and reliable networks and the high level of dir2 has a ile that my_dir1 does not, then it will delete that
security that comes with mobile data makes backup over ile. In addition to the –delete option, we have also used –a
a network a very practical and popular approach. Although (recursive) and –v (verbose) options with rsync. You will be able
there are many commands that can copy iles over a to conigure rsync in several ways when you need to use it for
network or be used to move the backup data to a remote external backups. The most popular way is tunnelling rsync
machine, some utilities have become very popular for this through SSH. This method has gained popularity because
speciic job. Using OpenSSH tools such as ssh and scp, most servers and even various clients already have SSH and
you will be able to achieve the secured transfer of backup can thus be used for rsync backups. Let’s look at the various
archives. Another popular command – rsync – will help steps of using rsync for taking backups over a network.
us to save time by backing up only iles that have changed As a irst step, you need to ensure that both rsync and
since the previous backup. Another way to backup iles over SSH are installed. You can use the following commands for
a network is to use tools such as Unison. You can also take this purpose:
a look at another command – rsnapshot. This command
can work with rsync and enables you to make hourly, daily, ~$ yum -y install ssh rsync
weekly or monthly snapshots of a ile system. ~$ sudo apt-get install ssh rsync
By using OpenSSH commands, you will be able to gather
backups from multiple client machines. Let us take a look at As the next step, we need to run the command using rsync
an example: as given here:
46
~$ rsync -av -delete -e ssh /my_dir1/ me@IP_ the day, day of the month, month of the year, day of the
Address: /my_dir2/ week, command.
Thus if we look at our cron entry for rsync, we can see that
If we have conigured SSH to run on a port other than 22, that we are interested in running the backup at 22 hours (10pm)
needs to be mentioned as an option to SSH using the –p lag. on a daily basis.
When we execute the above command, it may prompt for a Though rsync is very popular, it assumes that the
password – please note that this is to authenticate with SSH. machine being backed up is the only one where you are
You can set up RSA keys to skip this authentication process. modifying the data. But let us consider a situation where
System administrators ind it useful to automate backups two machines are modifying the same ile and we need to
using the rsync command. On Ubuntu systems, you can use sync up this speciic ile. In such situations, the command
the cron utility to automate this. In order to edit the cron table unison comes in very handy. You can install this using the
ile, type the following command: following command:
And then using the vi editor, make an entry for rsync as shown: You can go through the man page to learn more about it.
www.linuxuser.co.uk 47
Learn
Mihalis
Tsoukalos
concurrent
programming
Mihalis Tsoukalos is
a UNIX administrator,
a programmer (UNIX
& iOS), a DBA and a
mathematician. He
has been using Linux
since 1993. You can
reach him at
@mactsouk (Twitter)
in Go
and his website:
mtsoukalos.eu
Resources
A text editor such
as Emacs or vi
The Go compiler
Discover how to develop concurrent
applications in Go
Concurrent programming is a difficult area of computing serious reason for doing so is highly discouraged and should
that requires special care and precision. This tutorial be avoided.
will talk about concurrent programming in Go, which
introduces a unique approach to concurrency. Go uses About goroutines
goroutines and channels in order to program concurrent A goroutine is the minimum Go activity that can be executed
applications but can also support traditional concurrency concurrently – please pay special attention to the word
techniques. Everything in Go is executed using goroutines; minimum. Therefore, goroutines are lighter than threads,
when a program starts its execution, its single goroutine which are lighter than processes. However, processes
automatically calls the main function in order to begin the can be autonomous and exist on their own whereas both
actual execution of the program. goroutines and threads cannot. Goroutines live in threads
This tutorial will mostly talk about goroutines and channels. that leave in processes. So, in order to have a goroutine, you
However, Go also supports the traditional and well-known will need a process with at least one thread.
concurrency model that uses shared memory. You can deine a new goroutine using the keyword “go”
The next tutorial is the Go series will continue talking about followed by a function name or an anonymous function.
concurrent programming in Go so keep reading! The go keyword makes the function call immediately return
while the function runs concurrently and the main program
Standard Go packages related continues running.
to concurrency On the other hand, however, you cannot control or make
The sync Go package contains functions that can help you any assumptions about the order your goroutines are going to
synchronise goroutines – the most important functions of be executed in, because this is the job of the scheduler of the
sync are sync.Add, sync.Done and sync.Wait. operating system.
The time Go package is not directly related to concurrency The goRoutine.go program contains Go code that creates
Tutorial iles but contains functions that can be useful sometimes, two goroutines, one using a function and one using an
available: including the Sleep function, which pauses the current anonymous function. You can see the Go code of goRoutine.
filesilo.co.uk goroutine for a given amount of time. However, using the go in Figure 1. Executing goRoutine.go generates the
time.Sleep function to pause a goroutine without having a following output:
48
About Go channels
A channel is a connection between goroutines that allows
goroutines to exchange data – each channel allows the
exchange of a particular data type, which is also called the
element type of the channel. For a channel to operate, you
will need someone to receive what is sent via the channel. If
Above This is the Go code of goRoutine.go that creates nobody receives the data, the function that sends it will stall
two simple goroutines, one using an existing function while waiting for someone to read its data.
and the other using an anonymous function You can declare a new channel using the chan keyword in the
following way:
$ go run goRoutine.go
Learning about Goroutines. aChannelForStrings := make(chan string)
This is an anonymous function! You can send a statement to an existing channel
This is aFunction! as follows:
Exiting... aChannel <- aString
You can read a single value from a channel as
So how do you know for sure that the printed messages follows:
came from different goroutines? The best way to readValueFromChannel := <- aChannelForStrings
understand that is by looking at the order the four Should you expect a number of values, you can
messages are printed on your screen: due to the delay in use a for loop instead:
aFunction(), the message of the anonymous function is for readString := range aChannelForStrings {
printed first. This verifies that the anonymous function and fmt.Println(readString)
aFunction() run at the same time. }
www.linuxuser.co.uk 49
A simple example
In the next example, the main() function will wait for all
goroutines to finish before continuing, which, most of the
time, is the desired behaviour – this will happen with the
You are also allowed to ignore the value of a channel, which is help of the sync package mentioned at the beginning of this
implemented as follows: tutorial. In other words, you will stop making calls to time.
Sleep. For reasons of simplicity, two anonymous functions
<- aChannel are being used.
You can find the Go code of this example in simple.go,
Closing a channel is done using the close() function. You which you can also see in Figure 3. Executing simple.go
can see the Go code of goChannel.go in Figure 2, which uses generates the following output:
integers instead of string values. Executing goChannel.go
generates the next output: $ go run simple.go
Using Goroutines Part 1!
$ go run goChannel.go This is AF 2!
This is AF 1!
Using Channels! Exiting...
0 1 2 3
Channel is closed! You can see that in the Linux machine used, the messages
Exiting... from the two anonymous functions are printed in the
reverse order the two goroutines were created. You can also
The following technique will allow you to find out the status of see the use of the defer keyword; in this case using defer
a channel: does not add so much to the reliability of the program but
it would have been invaluable if your function had multiple
_, ok := <-aChannel return points.
if ok { Please notice that the parameter to the sync.Add call must
fmt.Println("Channel is open.") reflect the number of goroutines you want to wait for, which
} else { should be equal to the total number of goroutines that make
fmt.Println("Channel is closed!") a call to sync.Done.
} Calling sync.Done more times than the parameter of
sync.Add is not good but it will not crash your program – it
In other words, you test the value of the ok variable to find out will just make it finish without waiting for all goroutines to
whether a channel is still active or not. finish their jobs:
50
www.linuxuser.co.uk 51
The output tells us that there exist 28, 755 words with four
letters, 23, 677 words with three letters and only one word
with 27 letters in the input file.
Now that we have the Go code, it is easier to explain how
pipelines work. The main() function is still the glue that
creates all required connections using Go channels. First of
all, you define the necessary channels because channels are
the building blocks of pipelines.
The program creates two goroutines using the readFile()
and findLength() functions. The readFile() function takes the
name of the text file that will be read as its first argument.
The name of a channel that will be used as the input to
the findLength() function is the second argument of the
readFile() function. The second argument of findLength()
is also a channel, which will be that input to the createHist()
function, which is the last member of the pipeline. All three
functions keep their channels active as long as they have data
to receive or get from them. The Go code that shows how the
two channels and the three functions are used inside main()
is the following:
The data from both the lines and the stringLength channels
is not stored anywhere; instead, data travels from the
readFile() function to the findLength() function and then to
the createHist() function.
As you can realise, the Go code is not particularly difficult
to read or write provided that you know precisely what you
are doing – it is very easy to get perplexed with the various
channels of a pipeline.
Additionally, Figure 6 shows a graph of how the pipelines of
pipelines.go interact with each other. You should understand
by now that pipelines are a very powerful mechanism in Go!
52
$ go run cores.go
$ strace ./anotherExample 150 2>&1 | grep clone
GOMAXPROCS is 1 | wc
2 8 212
On a system with more cores, you are allowed to lower the value of
GOMAXPROCS.
The main reason for this might be the value of the
In the Go tutorial in next issue, the effectiveness of the
GOMAXPROCS environment variable or the use of an older
GOMAXPROCS environment variable will be tested and
version of Go.
benchmarked so stay tuned!
www.linuxuser.co.uk 53
Terminal
>_ TAKE
>_ COMMAND
50 terminal tricks to
supercharge your system
E
ven though distributions like Ubuntu >_001 Find out the path to >_004 Kill annoying processes
have gone a fair way towards making a command Some programs, like Skype for example, can
settings accessible from the GUI, In some cases, more than one version of a hang at times. In this case, simply terminate
the underlying operating system command can exist on a system. Finding all running Skype processes by entering:
remains a command line-driven platform. out which binary will be invoked when
While the average user deinitely does not the command is entered ‘directly’ can be killall -s9 skype
need to access the command line, power accomplished via the which command – its
users moving in from Windows should get behaviour is shown in the code snippet. This can also be applied to a variety of other
over their ‘fear of the command line’. scenarios – killall’s man page is worthy of a read.
When applied correctly, command-line ~$ which java
commands provide access to a wide array of /usr/bin/java >_005 List all the attached
amazing administration, management and USB devices
system information facilities. Furthermore, >_002 Select from alternatives USB can create quite complex device
knowing your way around the various If more than one version of a command is structures. Entering lsusb provides a list
command-line tools is also helpful when it present on your system, the utility update- of all hardware currently attached to your
comes to scripting: many, if not most, of the alternatives allows you to pick your poison. system. Be aware that the command also
commands shown in this article can also be Please consider yourself thoroughly warned: lists internal USB hubs, making its output
applied to Bash scripts (such as the ones this command works only on Debian-based meaningful only when comparing before and
demonstrated on pages 28-31). distributions such as Ubuntu. Most other after scenarios.
Tune in to the following pages to ind out lavours of Unix will deploy a different way to
more about system temperatures, network set the various default commands. ~$ lsusb
connections and a variety of other stats useful Bus 004 Device 002: ID 8087:0024
for troubleshooting. In addition to that, let us >_003 List all running tasks Intel Corp. Integrated Rate Matching Hub
introduce you to the best command-line media Simply enter the command top in order to Bus 004 Device 001: ID 1d6b:0002
players – just in case you ever wanted to make obtain an overview of all the tasks that are Linux Foundation 2.0 root hub
a Bash script control your MP3 playback… currently running on the system. Bus 003 Device 003: ID 04f2:b2da
54
www.linuxuser.co.uk 55
MAN PAGES
up correctly, one workstation can even
service multiple users at the same
time. All of this is made possible by
a strict rights management system:
the operating system makes sure that
one user can’t mess up the iles or the
>_Although Google provides lots of info on most operating system.
Sadly, administrative tasks must
shell commands, Unix’s built-in help tools also be performed. This is the job of the
superuser, which is commonly known
deserve attention as root. As logging yourself into the
SU account each time is painful, an
>_010 What’s in a name? Another interesting method involves alternative exists in the sudo command
Should you ever wonder about the role of a the searching of content: using /pattern (best memorised as SUperuser DO).
speciic command, entering whatis followed searches forward, while ?pattern searches Its usage syntax is really easy. Simply
by the name of the command in question backwards. When entered, matching text put sudo in front of the command that is
tends to lead to further information on the passages will be displayed for you in a to be run: when invoked for the irst time,
you will be asked for the root password
topic. Our example, shown here, tells us what highlighted fashion.
before execution. Be aware that your
the gcc tool is all about.
input is not mirrored – you must type
>_014 man on man blindly, and terminate the password by
~$ whatis gcc The man page viewer also comes with a man pressing Return:
gcc (1) - GNU project C page on itself. It can be opened by entering
and C++ compiler the command man man – reading it through [sudo] password for tamhan:
provides you with insights on a variety of Android nativespace Templates
>_011 Simple help interesting aspects of the man system. . . .
Most shell commands come with an In addition to that, pressing the H key while
integrated help system providing further reading through a man page provides you with Should you ever feel like running multiple
information about the syntax. It can usually a list of keyboard shortcuts that are helpful sudo commands in a sequence, feel free
be accessed by passing in a parameter like when navigating man pages. to capture a ‘root shell’ instead. This
-help, --help, -? or --?. If the syntax is not is best accomplished by entering the
correct, the utility will usually show a little >_015 Do it the GNU way command sudo -s. When done, you ind
yourself inside a shell owned by root –
message informing you about the correct Some applications – the products taken from
this can be seen by the change of the
help parameter. GNU itself are a classic example – do not
preix shown in the image here; -s, by the
Be aware that experimenting around with come with proper man pages. Information way, stands for shell.
these commands can be dangerous: we on them must, instead, be gleaned from a
would not try to ind out the correct help similar utility called info. It can be opened by
parameter for rm or similar utilities which entering info <command> – simply entering
can cause harm to the ile system, especially info opens an introductory page describing
given the fact that other help systems are the local system.
readily available.
>_016 Handle the info viewer
>_012 Read the manual! The info tool differs from the normal man
Most commands come with a man page – page viewer in that it offers a cursor. It can
the abbreviation stands, unsurprisingly, for be moved across the screen freely, while fast
‘manual page’. It can be accessed by entering scrolling can be accomplished via PgUp and
man followed by the name of the command PgDown. Place the cursor inside the numeric
you want to ind out more about. When that brackets behind a hyperlink and press Return After entering sudo -s,
your shell has root rights
is done, the man page viewer will show up on to open the relevant page.
your screen along with the requested content.
>_017 Search your man pages relevant commands that you need. For
>_013 Advanced man handling Man pages are helpful as long as you example, entering apropos <what> leads
You can scroll through the man page by know which command is responsible for to the dumping of a list of all man pages
pressing the up and down arrows to move the achieving what you want to do. If this is not that match the entered query string. You
caret (^) around the screen. Pressing Q allows known, searching the man pages for a string can then look through the output to ind the
you to quit back to the command line. might be a helpful way to get a lead to the information you need.
56
Another common operation involves the updating require the presence of fully updated repository sudo apt-get update
of all packets on a workstation. As this tends to lists, the process is usually accomplished in a block: sudo apt-get upgrade
www.linuxuser.co.uk 57
INSTALLATION
>_020 Search the Use ‘apt-get autoremove’ to remove them.
INSTALLING
BINARIES
package information
The apt-get tool comes with a little brother called Fortunately, ixing that problem is really easy: >_Most packages are
apt-cache. It can be used to find out information just invoke apt-get autoremove to get rid of the
about the packages currently known in the cache, unneeded packages. However, be aware that binary. But what does
gathered from various repositories after apt-get
update is run. One simple use case involves finding
some dependencies are not tracked by apt-
get: if your system suddenly starts acting up,
that mean?
out more about the origins of a package. reinstalling the packages that you have deleted Compiling source code can be tedious, take it
might prove helpful. from us. Binary packages solve this problem in
~$ apt-cache show gcc a simple fashion: they contain readily compiled
Package: gcc images intended for the current user’s target
Priority: optional system. The installation process then consists
Section: devel of copying the files to the relevant locations – in
Installed-Size: 41 some cases, a script or two is run to handle the
... editing of config files.
>_023 Perform a deeper clean-up When dealing with unknown DEB iles, using Install that DEB
apt-get clean does not kill all of the gunk found the dpkg -c <file> version of the command While most DEB packages can be deployed via
in apt-get’s caches. Running apt-get clean is helpful. It dumps a list of all iles contained apt-get using the methods mentioned above,
autoclean invokes a more thorough cleaning in the package – be aware that this does not, some services (Skype, cough cough) provide
process, which, however, takes a bit of extra time. however, allow you to ind malicious routines their users with raw DEB file downloads. In that
hidden in binary iles. case, simply double-clicking the product is the
>_024 Learn to eliminate safest way to start a deployment via Ubuntu’s
orphaned packages >_026 Parallelise it Software Centre.
Command-line jockeys should alternatively
In some cases, a package gets upgraded and More than ten years after the introduction
use the dpkg command. A packet can be
loses one or more dependencies in the process. of dual-CPU workstations, make, by default,
installed by entering dpkg -i <debFileName>.
In this case, these packages can be orphaned – a still invokes but one thread at a time. When
state which apt-get announces at various times running make by hand, pass the parameter
when operated. -j followed by a number to tell the utility that memory tends to eliminate any gains from
more than one core should be used for the the extra core. Second, setting -j to a value
~$ sudo apt-get upgrade compilation process. signiicantly higher than the number of CPU
... cores is ineficient in all but a few boundary
The following packages were >_027 Don’t overdo it cases. Finally, when compiling on process
automatically installed and are no longer When compiling large projects for the irst computers, thermal overload can be caused
required: time, developers tend to set -j to an insanely by using all cores simultaneously – compiling
libhdb9-heimdal libkdc2-heimdal high value. This is not effective for a variety Qt with make -j 4 on a Raspberry Pi 3 is a
libvala-0.24-0 libvala-0.26-0 libvala-0.28-0 of reasons: irst of all, the use of swap recipe for a thermal reboot.
58
www.linuxuser.co.uk 59
MANAGE FILE
PERMISSIONS
FILES AND DIRECTORIES
>_Storing iles is among the most important jobs
>_Unix’s multi-user capability
requires solid ile-level rights of a computer. These command-line utilities keep
management. Here are four you in command
commands that are helpful >_033 Get file information traversal depth and the filtering of the files that
>_029 Who owns what? Sometimes you simply want to see what is are displayed.
The first step to successfully managing the contained in a text file. In that case, invoking the
permissions of files involves finding out who more command is helpful – it shows one screen- >_038 Find differences between
has what rights. Entering ls -l provides you full’s worth of content, which can furthermore be text files
with an expanded version of the normal ls scrolled down effortlessly. When dealing with text files, the diff command is
output which also lists owner and accessibility extremely helpful. Its output shows the difference
permissions in the form of a table similar to the >_034 Keep an eye on changes between the two files passed in – be aware that
one shown in the image. Tools such as the sensor utility are best watched the d stands for decimal, and describes the
as time goes by. This can be accomplished by position in a line.
prefixing it with the watch command, which runs
the specified command repeatedly. The tool can >_039 List all storage media
even be provided with the parameter -n, which Linux’s way of organising the ile system
allows you to configure the delay between the can get confusing, especially if Automount
individual updates. is enabled. Entering lsblk provides an
Above Each character describes one bit overview of the block devices along with any
of ile system information >_035 Find your current location mount points. In addition to that, the size is
Even though Bash usually does a quite displayed – it can be helpful when correlation
>_030 Understanding the output decent job at displaying the current path, is needed.
As long as the width of the terminal is some special folders are not displayed in
wide enough to take the entire output, full. This problem can be addressed via the ~$ lsblk
ls generates classic tabular output. The pwd command, which outputs the current NAME MAJ:MIN RM SIZE RO TYPE
eleven characters on the very left of each working directory. MOUNTPOINT
line provide information on the rights. After sda 8:0 0 223,6G 0 disk
that, the two usernames provide information ~$ pwd |-sda1 8:1 0 177G 0 part /
about the user and the group owning the ile: /home/<user> |-sda2 8:2 0 1K 0 part
groups are a very eficient way of sharing |-sda5 8:5 0 3,7G 0 part [SWAP]
rights across multiple users. >_036 Count the words sr0 11:0 1 1024M 0 rom
Word counts are useful things to know. The
>_031 Make files run wc command counts the words found in a ile. >_040 Find out everything about
One of the most common problems involves The syntax used is shown in the help snippet storage capacity
making downloaded files executable. Ext* file displayed here: Sometimes, you just need to know whether you
systems differ from FAT et al in that files can still have enough storage space for a particularly
be marked as executable via a special bit in the ~$ wc --help pesky file. Entering df -H lists all file systems and
file system. Fortunately, solving the problem ... their spaces – be aware that not all of them are
is easy – just use chmod with the +x flag, which Print newline, word, and byte counts also user-accessible, though.
sets the executable bit. for each FILE, and a total line if
more than one FILE is specified. With ~$ df -H
chmod +x <filename> no FILE, or when FILE is -, Filesystem Size Used Avail Use%
read standard input. A word is a Mounted on
>_032 Change file ownership non-zero-length sequence of characters udev 6,2G 4,1k 6,2G 1% /dev
In some cases, files need to have their delimited by white space. tmpfs 1,3G 1,4M 1,3G 1% /run
owner changed. This is the job of the chown /dev/sda1 187G 74G 104G 42% /
command, whose name is explained via >_037 Get a visual overview of none 4,1k 0 4,1k 0% /
CHange OWNer. Chown can take a large array the file system sys/fs/cgroup
of parameters, allowing you to affect the In many cases, the structure of a folder hierarchy none 5,3M 0 5,3M 0% /
permission system in a detailed fashion. must be presented in a document. This is a prime run/lock
Beginners should be aware that chown can gig for the tree command, which – when invoked none 6,2G 3,7M 6,2G 1% /
be used to assign file rights to other users – if – simply emits a visual representation of the entire run/shm
used wrongly, you can no longer access the file working directory. The command, furthermore, none 105M 74k 105M 1% /
unless you have superuser rights on call. takes a set of parameters allowing you to vary the run/user
60
MEDIA
product, though – if you don’t know vim by heart,
another media player with a simpler user interface
is likely to leave you happier in the end.
mp3blaster
>_Even though multimedia is not usually mp3blaster.sourceforge.net
If CMus is intended for vim heads, mp3blaster
associated with the command line, a nice array is the MP3 player ‘for the rest of us’. Its super-
easy user interface is full of hints, which explain
of media management tools await orders the various keyboard shortcuts needed for
multimedia manipulation. The developer claims
>_041 Change the file format convert in.png -resize 200 out.png that its design was inspired by traditional CD-ROM
Image processing is best handled via the players – if you ever handled a CD-ROM, you will
not have any problems with mp3blaster. Sadly,
ImageMagick tool. It is not deployed automatically >_043 Look at EXIF data support for OGG et al is not implemented.
on most workstations, and must instead be Digital cameras store a large amount of
installed manually by entering sudo apt-get information in their image files. Imagemagick SoX
install imagemagick. contains a utility that can read their contents – sox.sourceforge.net
Here, a simple task involves conversion simply entering the code accompanying this tip SoX is commonly described as the Swiss Army
between various file formats. Invoking the code might just reveal an amazing amount of detail knife of multimedia handling. The product can be
accompanying this tip converts a PNG file into a about your file. used for converting audio files between a variety
JPG file. of different formats. Command-line heads will
~/Downloads$ identify -verbose also like the package as it provides an easy-to-
convert myfile.png myfile.jpg IMG_20160727_012033.jpg use playback function which can be invoked from
scripts. This is ideally suited for emitting various
warning and/or status sounds related to the task
>_042 Resize your media >_044 Harness the ffmpeg currently processed in your script.
files efficiently On some versions of Ubuntu, the ffmpeg utility
Changing the file format is but a small part is available from the repository – 14.04 LTS ogg123
of image processing – in many cases, the file is a troublemaking exception. If the program www.vorbis.com
size needs to be reduced. When doing this in is available, it provides you access to a If your main interest is simply playing back OGG
bulk, specifying the number of pixels should be large selection of multimedia conversions. files, using the ogg123 utility found in the Ogg
handled in a flexible way so that the aspect ratio One nice example involves the changing Vorbis standard distribution might just be the
is preserved. of ile formats – an MP3 ile can easily be ticket. It is a super-simple utility which does not
The example shown accompanying this converted into an OGG ile when ffmpeg is require much memory and can be used easily.
tip intelligently reduces your image so that parameterised correctly. Users wanting to play back MP3 files must convert
their media elements before using ogg123 – the
the wider of the two edges is 200 pixels wide
program is not able to handle non-Vorbis files.
– both portrait and landscape pictures get ffmpeg -i input.mp3 -c:a libvorbis -q:a
processed correctly. 4 output.ogg
www.linuxuser.co.uk 61
NETWORKING
a command line works even over a throttled
mobile connection.
Initially, Unix workstations were accessed via
Telnet. SSH – the abbreviation stands for ‘Secure
SHell’ – is a more secure version of the protocol,
which foregoes simple plain-text transfers for a >_Connecting computers to one another is important.
more or less efficient form of encryption.
Some command-line tools make it more comfortable
Get connected >_046 Get the network status
Configuring the local SSH daemon depends from
When network problems occur, inding out
workstation to workstation: defer to Google to
more about the state of the various interfaces
learn more. Connecting to an instance is really
easy – the bickering about the host key can be is helpful. Simply invoke ifconfig to ind
ignored in most cases: whatever you want to know – be aware that it
also lists inactive or default interfaces such
~/workspaceAndroid# ssh [email protected] as lo.
Above The mtr command lets you drill down to
The authenticity of host ‘10.42.0.98 ind out where delays happen in the connection
(10.42.0.98)’ can’t be established. ~$ ifconfig
ECDSA key fingerprint is 3b:41:53:02:ca:df:c ... inding out where they occur. This is best
b:27:5d:35:6f:e6:61:a9:b2:cf. wlan2 Link encap:Ethernet HWaddr accomplished via the mtr utility, which prints
Are you sure you want to continue e8:de:27:0f:ea:ba out a detailed ‘time loss analysis’ of the
connecting (yes/no)? yes inet addr:192.168.1.219 data transfer between your machine and a
Warning: Permanently added ‘10.42.0.98’ Bcast:192.168.1.255 Mask:255.255.255.0 remote host.
(ECDSA) to the list of known hosts. inet6 addr: fe80::eade:27ff:fe0f:eaba/64
[email protected]’s password: Scope:Link >_049 Where U at?
UP BROADCAST RUNNING MULTICAST When routing process computers or similar
Stay alive
By tradition, a job started in a shell is terminated
MTU:1500 Metric:1 peripherals with your workstation, inding
along with it: disconnecting from a remote system RX packets:139536 errors:0 the IP address of the client is dificult. Nmap
kills its shell. This problem can be avoided by using dropped:21435 overruns:0 frame:0 is a powerful network scanner which can ind
the tmux command, which – on many systems TX packets:123348 errors:0 dropped:8 hosts in an IP range, and can also generate
– must be deployed with apt-get before it can overruns:0 carrier:0 a report on the various ports that are open.
be used. collisions:0 txqueuelen:1000 Once it’s installed, type the following:
In the next step, enter tmux after connecting to RX bytes:227160263 (227.1 MB) TX
the remote host. This will lead to a dialog which bytes:20342818 (20.3 MB) less /usr/share/nmap/nmap-services
can be used just like a normal terminal. The really
interesting part is disconnecting from the tmux
window by pressing CTRL+B, followed by D:
>_047 U there? >_050 List all ports!
Most networked systems respond to presence When debugging network issues, inding
detection packets called pings. Sending them out which port connections currently exist
~$ tmux
out can be accomplished by entering ping can be helpful. This is best handled via the
[detached]
<host> – be aware that the process must be netstat command. It, furthermore, takes a
After logging in again, the session can be ended by pressing Ctrl+C in order to get the list of different parameters allowing you to
reclaimed by entering tmux attach – if the statistics shown in the igure. customise the amount of information shown
system was not rebooted, all should be in place on-screen. When the list is limited, combining
just as you left it. >_048 Find network delays it with the aforementioned watch command is
If network issues occur, the next step involves especially helpful.
62
E • FREE
SU
EVERY IS
Available
RE
newsagents and
DS
DO supermarkets
WNLOA
ON SALE NOW
Smarter CSS animation techniques | Unleash the power of Node.js | 20 Best WordPress plugins
DESIGN INSPIRATION PRACTICAL TIPS BEHIND THE SCENES STEP-BY-STEP ADVICE INDUSTRY OPINION
facebook.com/webdesignermag twitter.com/webdesignermag
Contents
66 Producing clean
water with Pi 68 Set up a family
calendar on Pi 70 Evening photos
with Pi NoIR 72 Build an Explorer
robot: Part four
www.linuxuser.co.uk 65
Semiconductor
The titanium dioxide chemical is
spin-coated onto a glass wafer, which
in turn is placed at the bottom of a
beaker with a strong UV LED above it.
The wafer acts as a semiconductor,
so when the UV photons hit it, the
electrons become mobile
End goal
Monitoring voltage In an ideal scenario, the Raspberry Pi
As the solution is pushed through the will end up being a cost-effective way
system, the light passing through it to help make the process of purifying
is registered by a photodiode. The water that little bit better. While we’re
photodiode then turns this output into far away from this being used around
a voltage, which is then read by the the world, it’s a great start!
Raspberry Pi
66
www.linuxuser.co.uk 67
68
Can you do
updates?
The returned data is a structured data you entered when you created the event.
set. You can get the entries for the Some of the more important event
individual calendars by using the keyword details that you might be interested in While the main part of the article is about querying
'items'. The individual calendars have include the list of attendees and a list of Google Calendar to pull event details to populate a family
lots of information contained within any included attachments. Both of these calendar display, there is nothing stopping you from
them, such as a unique ID, a description are lists of structured data. For each event, working in the other direction and updating the remote
and a summary, along with much more you could loop through and pull out the calendar based on what happens at the monitor. This
information. You could get a print-out of all name of each attendee with this code. way, you can keep yourself synchronised with what is
of the summaries with this code. happening back home. The first thing you might want to
for attendee in event_ be able to do is to add a new event to a calendar. While
for cal_item in cal_list['items']: item['attendees']: there is an 'insert' method, it is probably overkill for
print(cal_item['summary']) print(attendee['displayName']) such a simple application. For your family calendar, you
probably just want to use the 'quickAdd' method.
With a list of the available calendar IDs, Items like the 'displayName' are optional,
you can start building up your list of the so you want to be sure that you actually get new_event = service.events().quickAdd(
actual events that are going to populate a string back before trying to do anything calendarId='primary',
your family calendar display. Each of these with it. In a similar way, you could loop text='Meeting at library on August 28
events has a full dictionary of details, through attached files to a given event. 2:00PM").execute()
similar to the information available for the
calendars. As a quick example, you can for attachment in event_ Let's say that you need to actually update an existing
grab the summaries for all of the events for items['attachments']: event. As an example let's say you got the time wrong on
the primary calendar with the code here. # Do something interesting the above newly created event. You could change it with:
event_list = service.events(). This is a bit messier if you wanted to pull new_event['start']['time'] = '3:00PM'
list(calendarId='primary').execute() any extra detail from the attachments. To updated_event = service.events().
for event_item in event_ begin with, you will likely want to look at the update(calendarId='primary', eventId=new_
list['items']: 'title' and the 'mimeType' properties to see event['id'], body=new_event).execute()
print(event_item['summary']) if there is anything useful that you can do
with it within your calendar display. If there You can do this update with any event that you can look
Using these examples, we could print off is, the attachment will show up in one of up the event ID for, in any calendar that you have access
the summary, start time and date with: two ways. If it is stored in Google Drive, to. The last simple operation you may want to do is to
there will be a 'fileID' property that you can delete an existing event. You can do this with:
for event_item in event_ use within the Google Drive API to pull the
list['items']: file information down. If it is a file located service.events().delete(calendarId='primary',
print(event_item['summary'] + ' ' somewhere else, there will be a 'fileUrl' eventId='eventId').execute()
+ event_item['start']['dateTime']) property that you can use to pull the file
down from. You may want to be careful with this particular function,
The format that the dateTime property We were only able to cover the most since your offspring may decide to quietly delete that
gets printed in is along the lines of '2007- essential parts of querying your Google upcoming dentist's appointment that they are less than
03-30T14:30:00-03:00'. So, you get the calendars in order to pull out information thrilled about attending. You may need to reorganise
date, then a 'T', then the time in 24 hour for your family calendar display. But these events after the fact. If so, you can move an event
format and then the timezone for the hopefully, you can see the possibilities of from one calendar to another with code like:
event. There is also an equivalent entry for how you can use all of this information to
the end of an event. This all works great, keep you and your family well organised. updated_event = service.events().
as long as a 'dateTime' property has been There are also APIs for all of the other move(calendarId='primary', eventId='eventId',
set for the given event. But you may have Google products that are accessed in a destination='destCalId')
all-day events, so you will need to do some similar way, so you could take the code
error checking when you start pulling above as a jumping off point to pull in even If your family calendar allows for some kind of
this data out. If you entered a location for more data from your online presence. If interaction, say by using a touchscreen attached to
the event, that is stored in the 'location' you were granted access, you could even your Raspberry Pi, you can now allow for updates to
property of the event that you can access pull in data from other people's calendars, propagate back out to the internet. This way, you will
in the same way that you pull out the so you can even keep synchronised with know immediately on your phone that a play date has
summary. This is just the free-form text what the grandparents might be up to. been added for your child back at home.
www.linuxuser.co.uk 69
Christian
Cawley
I’m a former IT and
software support
engineer and
since 2010 have
provided advice
and inspiration
to computer and
mobile users online
and in print. I cover
the Raspberry Pi
as well as Linux at
makeuseof.com.
70
Commands,
08 Try time-lapse
Time-lapse photography is a good option for capturing conditions
images remotely (over SSH) without draining the battery. and switches
raspistill -t 480000 -tl 5000 -o /timelapse/
image%04d.jpg To find out
more about the
commands that
Using millisecond values, this command snaps photos every 5 are available for
seconds for 8 minutes. Install libav-tools to convert your images raspistill and
raspivid, use:
into a movie.
raspistill
–help
Above Using your NoIR camera outdoors? Remember: your battery will
drain more quickly when recording video and
09
commands, which include specifying image size and rotation Compile your time-lapse to customise the
output of your NoIR
(see the tip on the right). To compile the time-lapse images into a single video camera, and get
file, use: great results.
Above Make sure you don’t overload your SD card storage - keep your
time-lapses brief!
www.linuxuser.co.uk 71
encoders. These can be as simple as a paper disc attached # trigger = output 1 on ExporerHAT
to a motor shaft connected to a light sensor or a Hall Effect # echo = input 1 on ExporerHAT
magnetic sensor. By counting RPM and knowing the turns # For other output or inputs consult http://
required to move a set distance we can start to compensate pinout.xyz
72
www.linuxuser.co.uk 73
def setup(self):
GPIO.setmode(GPIO.BCM)
06 Don’t crash into that wall
Now that we have a Python class which can take
measurements through the ExplorerHAT, let’s write a simple
print “trigger = “ + str(self.GPIO_TRIGGER) loop to read the values, then set up our robot to drive forward and
print “echo = “ + str(self.GPIO_ECHO) halt if it detects anything around 30cm away or closer. For a code
# Set pins as output and input sample that only reads the values and prints them on the terminal
GPIO.setup(self.GPIO_TRIGGER,GPIO.OUT) # Trigger use part4/distance/reader.py. For the example below use part4/
GPIO.setup(self.GPIO_ECHO,GPIO.IN) # Echo distance/dont_bump.py.
Also note that we are making the code self-documenting by
def measure(self, settleTime): naming variables such as safe_distance_cm, move_power_
# Set trigger to False (Low) percent and sensor_settle_time. Any number passed into a
GPIO.output(self.GPIO_TRIGGER, False) method without a clear name should be avoided. It is called a
# Allow module to settle magic variable, because who knows what it means?
time.sleep(settleTime)
```
# Send 10us pulse to trigger import explorerhat
GPIO.output(self.GPIO_TRIGGER, True) from ultrasonic import ultrasonic_sensor
time.sleep(0.00001)
GPIO.output(self.GPIO_TRIGGER, False) # trigger = output 1
start = time.time() # echo = input 1
while GPIO.input(self.GPIO_ECHO)==0:
start = time.time() # For other output or inputs consult http://pinout.
xyz
while GPIO.input(self.GPIO_ECHO)==1: trigger_pin = 23
stop = time.time() echo_pin = 6
74
explorerhat.motor.one.forwards(move_power_percent)
explorerhat.motor.two.forwards(move_power_percent)
11 Read the analog values from the ALS-PT19s
Analog values can be read through the Pimoroni library and
will give a value between 0.0-5.0 representing the input voltage.
Here is a quick example of how to read the sensors.
print(“%.1fcm” % cm)
``` ```
print(explorerhat.analog.one.read())
Once the robot has detected a distance of at least 30cm to an The simplest control program would read both sensors and then
obstacle then we need to act or it will remain stuck. A simple but immediately give more power to the left or right motors to initiate a
effective escape behaviour is to back up a little and turn left then steering motion. The best control programs would average out the
let the main loop continue. Note that this is going to be an open value to smooth it and perhaps use a PID controller mechanism to
loop so depending on the surface the turn may be small or large. make sure the system doesn’t over-correct. Here’s our attempt;
For now we will concentrate on smaller building blocks. See the we’ve left lots of room for improvement.
full code in part4/distance/roaming.py.
```
``` import explorerhat
def escape(): import time
backup_time = 0.3 from ultrasonic import *
turn_time = 0.15
explorerhat.motor.one.backwards(50) def get_percentage(left, right):
explorerhat.motor.two.backwards(50) if(left > right):
time.sleep(backup_time) return (20, 50, “<”)
explorerhat.motor.two.forwards(50) return (50, 20, “>”)
time.sleep(turn_time)
``` while(True):
left = explorerhat.analog.one.read()
tolerance = 0.10
trouble. You could do this by integrating the Wiimote from delta = abs(left - right)
part 3 of the series and a Bluetooth dongle. The A button if(delta >= tolerance):
could pause the robot, and then perhaps B could resume percentage_power = get_percentage(left, right)
the program after you have saved it from falling down a light explorerhat.motor.two.forwards(percentage_
of stairs. The advantage of a hybrid mode is extra control power[0])
www.linuxuser.co.uk 75
FIND
MAKER
SPACES
NEAR
YOU
Maker and
Hacker Spaces
can be a great
way to get in
touch with like-
minded people,
and can also
give you a way
to access tools
and machinery
which would
otherwise explorerhat.motor.one.forwards(percentage_ explorerhat.motor.two.forwards(50)
be outside of power[1]) time.sleep(turn_time)
your budget. print(percentage_power[2])
Raspberry Pi else: while(True):
Jams are also percentage_power = (50, 50) if(ultrasonic1.measure(0.10) <= bump_buffer_cm):
good places print(“^”) explorerhat.motor.one.stop()
to showcase explorerhat.motor.two.forwards(percentage_ explorerhat.motor.two.stop()
your own power[0]) escape()
handiwork. explorerhat.motor.one.forwards(percentage_
A great place power[1]) left = explorerhat.analog.one.read()
to demo your right = explorerhat.analog.two.read()
robot would be time.sleep(0.1)
at Cam Jam’s ``` tolerance = 0.10
PiWars event. delta = abs(left - right)
Find it
at https://
piwars.org.
12 Construct the final robot control program
This is the final part of our tutorial and our final robot
control program. It will roam around an environment making sure
if(delta >= tolerance):
percentage_power = get_percentage(left, right)
explorerhat.motor.two.forwards(percentage_
not to bump into anything and will seek out the strongest light power[0])
source. We were able to drive the robot around obstacles using explorerhat.motor.one.forwards(percentage_
a beam of light from a CREE LED torch with a beam that can be power[1])
focused. By shine the torch on either side of the robot it is possible print(percentage_power[2])
to control its direction and course. The full code is provided in else:
part4/follow_light/follow_dont_bump.py. percentage_power = (50, 50)
print(“^”)
``` explorerhat.motor.two.forwards(percentage_
import explorerhat power[0])
import time explorerhat.motor.one.forwards(percentage_
from ultrasonic import * power[1])
ultrasonic1 = ultrasonic_sensor(6, 23)
ultrasonic1.setup() time.sleep(0.1)
```
bump_buffer_cm = 20
76
de
in
th
e
U
K
IQaudIO
Audiophile accessories for the Raspberry Pi
a
M
PiMusicBox
IQaudio Limited,
Twitter: @IQ_audio Swindon, Wiltshire.
Email: [email protected] WWW.IQAUDIO.COM Company No.: 9461908
E • FREE
SU
Available
EVERY IS
RE
newsagents &
supermarkets
DS
DO
WNLOA
ON SALE NOW
• The ultimate guide to iOS 10 • Get ready for macOS Sierra
TIPS & TRICKS HARDWARE REVIEWS CREATIVE PROJECTS BEST ACCESSORIES iOS & OS X APPS
facebook.com/icreatemagazine twitter.com/icreatemagazine
7zip WinZip
GROUP TEST
www.linuxuser.co.uk 79
7zip WinZip
Does it still stand up well to the The pro version may cost a lot, but can
competition showcased here? WinZip justify the price?
n You can use the Benchmarking feature to track the compression n Options are placed around each side of the central column, which
and archiving speeds of your iles can lead to some confusion as to a feature’s whereabouts
Design Design
It’s testament to the team behind 7zip that despite the complexity of the While we wouldn’t say it’s exactly pleasing to the eye, WinZip does boast
features found in 7zip, everything is easy enough to find. Menus are easy to one of the best UIs out of the ones featured here. Options are easy to find
navigate and core features are listed appropriately. One small caveat is the and the menu system isn’t overly complicated. We especially like how the
advanced features, which do require a fair amount of digging to find, but this basic compression features are kept separate from the advanced offerings
is only a small issue overall. contained within.
Overall Overall
9 8
Despite the addition of a couple of superfluous We’re impressed with WinZip for the most part, but
extras, at its core 7zip remains one of the premier file the £42.95 price tag for the full version is actually quite
compression utilities around. It’s the perfect choice difficult to swallow when the free alternatives here are
for new users, despite the small annoyances. comparable in most areas.
80
n Each compression type has a variety of additional information, n Multiple iles can be compressed at once, which is helpful if
which can help you follow each stage of the process you’ve got a lot to get through
Design Design
What we especially like about PeaZip’s UI is just how organised it is. Sections Hamster certainly wins from a design point of view, with a highly functional
are cleverly mapped out to stop any navigation issues, while its selection UI that delivers in terms of both usage and looks. There’s some added twists,
of features can be found using the search function. Compared to the such as the compression rating, which helps you understand how secure your
competition, it does look a little basic, but the minimal approach does do it files are, and also offers tips on how you can improve its rating.
some favours here.
File compression and archiving
File compression and archiving Delving a little deeper into Hamster shows that it’s fairly basic throughout.
While not as quick as WinZip, compression and extracting are still fairly fast. Basic encryption and archiving tools are included, and transfer speeds are
Each unzipping process uses a helpful menu system, which outlines various decent, but not as impressive as some of the other utilities here. If you’re
aspects of the process. Users can monitor the state of the zip process, as looking for a more complete compression system, this may be a little too
well as its input and output rate. It won’t be of much use for many, but it’s a basic for you.
helpful extra for some.
File management
File management Similar to the issues we encountered with its compression options, the
The only downside to PeaZip’s minimal approach is that it’s fairly light in this management system within Hamster is too basic for our liking. There’s
department. Organisational tools are plentiful, but there’s little else that can some starter level document-editing options at hand, but you’re better
really help you take control of your files. That said, the one key feature here is off using LibreOfice instead. If, however, the ile management side of
the duplicate file finder, which is surprisingly good at finding copies of photos things doesn’t appeal to you, then Hamster’s minimal approach may be
located deep within your compressed photos. a good idea.
Overall Overall
7 7
PeaZip’s minimal approach works well for the most While we love the look and usability of the Hamster archiver,
part, but some may ind it lacking in certain areas. With it pales in comparison to the competition here. Options are
stronger emphasis on the management side of things, minimal, and advanced users will want to look elsewhere
PeaZip could eventually compete with the best. for sure.
www.linuxuser.co.uk 81
82
HAPPY BIRTHDAY
ADD A REMOTE
DBA TO YOUR TEAM
HARDWARE
84
7
how much bandwidth is consumed by individual performance . What’s more, you can also set the
want to
apps and devices, as well as being able to set router to automatically switch between bands
think twice
parental controls and set two distinct guest users, depending on your distance from the hub. This is just
so visitors can temporarily connect to the internet another way Synology is using smart software to
without accessing your local iles. improve your Wi-Fi experience. Jack Parsons
www.linuxuser.co.uk 85
DISTRO
LXLE 16.04.1
Changes are plentiful in the latest update
from LXLE’s team of developers
Despite the ever increasing number of Ubuntu- impressive feat to keep times down this low. Another
based Linux distributions appearing all over the key improvement to help keep boot times to a minimum
place, LXLE has managed to keep a small but is the lack of pressure on your computer’s resources.
RAM growing number of users. Compared to many of It’s one of the more CPU-friendly distributions we’ve
512mb its competitors, it boasts ones of the better update had the chance to get hands-on with, and while it isn’t
Storage histories, and its latest update, 16.04.1, is arguably its perfect in some areas, it does what’s required to keep
8GB best yet. At the core of the update is the vast selection things running smoothly at all times.
Versions of improvements in boot times. From start to finish, As ever, the LXDE UI takes centre stage here,
32-bit the whole booting process takes less than 60 seconds. and it still remains one of the premier interfaces
64 -bit Considering the swathe of features onboard, it’s an out there. While simplicity still remains at its core,
86
8
users and it complements the simplistic nature of goes from here, but in its current state, it’s certainly download
the distribution as a whole well. Searching for core worth a download. Both the 32bit and 64bit versions today.
functions has never been easier, but it does lack the of LXLE 16.04 are available for download from
customisation options we’ve come to expect from www.lxle.net.
similar distributions. The other big ix that becomes Oliver Hill
www.linuxuser.co.uk 87
LilyPond 2.19.46
A well documented, if challenging,
music score program
With three quarters of a million lines of code, the
20-year-old LilyPond is a mature project, yet releases
have increased incrementally in the unstable branch,
and development remains active. Despite that, many
musicians have yet to try it – put off by the demands of
learning a whole new notation format.
Admittedly it is a steep learning curve, as LilyPond
is capable of producing extremely complex scores,
but the basics are easy enough, and thanks to the
documentation, it’s easy to get started – see the
screenshot – and progress to the level you need
for your own projects. Installation is via shell script
and manages all the complexities of the latest
development version – but try the stable version in
your distro’s repository if you wish to just get started.
Thanks to its longevity and stability, LilyPond is
something of a standard format, despite the number
Above A full score looks fairly overwhelming, so start simple and build up - the documentation is excellent
of competing formats for music scores, and is well
supported by music software exporting compositions
in its format – from Rosegarden to TuxGuitar –
and there’s even a jEdit plugin; Emacs’ Org-mode, Pros Cons Great for…
The scores look stunning; the While no system of turning Producing beautiful printed
with its org-babel system and support for literate notation is logical, flexible and music notation into scores is scores - as advertised!
programming, supports embedded LilyPond scores powerful (but not simple). easy, LilyPond really demands
http://lilypond.org/
with MIDI auditioning. Well-supported. some learning effort!
Tornado 4.4.1
A scalable Python web framework and asynchronous networking library
The FriendFeed social media run up against the limitations of WSGI, which does not
website may have disappeared
beneath most peoples’ radars
support non-blocking requests.
Database support includes asynchronous drivers
Pros
Powerful asynchronous
since Facebook bought it for MongoDB and PostgreSQL, and a choice of drivers networking library and non-
seven years ago, but its great legacy is the non-blocking for CouchDB. It has more features than minimal web blocking network I/O.
Tornado Web framework. Designed to cope with frameworks like Flask, but its network library makes
thousands of simultaneous connections, its performance building more complex apps the way you like them Cons
remains ahead of other Python frameworks like Django achievable more quickly. Again, the documentation is a big Yet another web framework to
learn, and more Python package
and it’s ideal for sites needing long-lived connections to help here, along with working through some of the demo dependencies to worry about.
users – perhaps for your customer support department’s applications. Tornado isn’t a magic bullet, but if you’ve
new chat app? been trying to weigh the Django straitjacket against build-
The HelloWorld app on GitHub is one of a number it-yourself options on Flask or other micro frameworks, Great for…
of demos which play to Tornado’s strengths and show it’s an important alternative, with persuasive arguments Busy websites with realtime
update needs
you the possibilities from websockets to web spiders. for anyone looking at long polling and many thousands of
https://tornadoweb.org/
Speaking of websockets, Tornado is just the thing if you’ve open connections.
88
DOCUMENT PREPROCESSOR
LyX 2.2.1
Beautiful documents from a user-friendly GUI app
LyX will do for documents what LilyPond does for music
scores - beautiful output - but with the advantage
of a close to WYSIWYG input. In fact, LyX replaces the
WYSIWYG (what you see is what you get) paradigm with
WYSIWYM (what you see is what you mean), but still lets
you lay out the document fairly visually - where it really
differs from conventional word processors is that the
output will be consistent across printers and platforms.
Using the LaTeX typesetting system (whose
complexities we covered in a tutorial in LU&D 138), LyX
gives you a powerful but not unfamiliar front-end that
will enable you to produce all of the documents that
never work as well as planned on a word processor, from
dissertations to mathematics and physics homework. If
you do know TeX/LaTeX then you can use your knowledge
and files with LyX, but its real selling point is that it works
fine with no TeX knowledge.
Installation from provided deb packages was fine on
Debian Jessie; there’s a PPA for Ubuntu users, and most
other distros have documented support. Language Above It’s easy to get started, even from a blank page, but the start-up splash is a useful, concise intro.
support is excellent, including bidirectional and many
Asian fonts. Stability is legendary. It’s difficult to find
fault, particularly as you discover the features that make Pros Cons Great for…
producing well-structured documents a joy. It’s not just for From mathematics to Arabic, Not a drop-in replacement Anything academic, without
everything is laid out perfectly, for your word processor, and having to learn LaTeX
academics - if you have to write any sort of report, give it a with a friendly interface. more powerful than many www.lyx.org/
fair try and you may abandon your word processor. Good docs. users will need.
www.linuxuser.co.uk 89
April Madden
Editor
1 More programming
82 per cent of you told us
that you wanted more tutorials
on programming languages and
frameworks in the magazine.
Only
takes 3
mins!
Take part in our 2016 reader survey and you
can enjoy these fantastic benefits 2 FOSS focus
56 per cent of you said that
you like to read in-depth FOSS
Exclusive discount subscription to the magazine reviews and 65 per cent said you
Incredible savings for new and existing subscribers. wanted more FOSS tutorials.
Plus Free delivery direct to your door.
Exclusive savings on mags and books
Get a 10% discount code to use at our online shop 3 Pi for everyone
57 per cent of you like
Raspberry Pi articles to be balanced
Competitions Free gifts Have your say between your own projects and
Get the chance Become eligible for Gain a place on our ones for your children.
to enter exclusive free gifts including reader panel, giving
competitions for digital editions for you regular input on
money-can’t-buy prizes phones and tablets the magazine
Complete our survey & join the team today 4 Free DVD
You asked in overwhelming
RECOMMENDED
Hosting listings
Featured host: Having your own
www.cyberhostpro.com dedicated server will
0845 527 9345 give you maximum
performance; our UK
About us servers typically include
Cyber Host Pro are committed to provide the If you’re looking for a hosting provider who same-day activation
best cloud server hosting in the UK; we are will provide you with the quality you need to
obsessed with automation and have been help your business grow then contact us to
since our doors opened 15 years ago! We’ve see how we can help you and your business!
grown year on year and love our solid growing We’ve got a vast range of hosting solutions
customer base who trust us to keep their including reseller hosting and server
business’s cloud online! products for all business sizes.
What we offer
• Cloud VPS Servers – scalable cloud dedicated server will give you maximum
servers with optional Cpanel or Plesk performance; our UK servers
control panel. typically include same-day activation.
• Reseller Hosting – sell web and email • Website Hosting – all of our web hosting
hosting to your clients; both Windows and plans host on 2015/16 SSD Dell
Linux hosting available. servers giving you the fastest
• Dedicated Servers – having your own hosting available!
Testimonials
5 Tips from the pros Chris Michael
Glen Wheeler
sure that your website is mobile-responsive! “I am a website developer, I signed up with Cyber Host
92
www.cwcs.co.uk www.bargainhost.co.uk
0800 1 777 000 0843 289 2681
CWCS Managed Hosting is the UK’s Since 2001 Bargain Host have campaigned
leading hosting specialist. They offer a fully to offer the lowest possible priced hosting
comprehensive range of hosting products, in the UK. They have achieved this goal
services and support. Their highly trained successfully and built up a large client
staff are not only hosting experts, they’re database which includes many repeat
also committed to delivering a great customers. They have also won several
customer experience and passionate about awards for providing an outstanding
what they do.
Enterprise hosting service.
• Colocation hosting
• VPS
hosting: • Shared hosting
• Cloud servers
• 100% Network uptime • Domain names
www.netcetera.co.uk | 0800 808 5450
Formed in 1996, Netcetera is one services to effectively manage IT
Value hosting of Europe’s leading web hosting infrastructures. A state-of-the-art Value Linux hosting
service providers, with customers data centre enables Netcetera to
in over 75 countries worldwide. offer your business enterprise-
As the premier provider of data level solutions.
elastichosts.co.uk centre colocation, cloud hosting,
02071 838250 dedicated servers and managed • Managed and cloud hosting patchman-hosting.co.uk
web hosting services in the UK, • Data centre colocation 01642 424 237
Netcetera offers an array of • Dedicated servers
ElasticHosts offers simple, flexible and Linux hosting is a great solution for home
cost-effective cloud services with high users, business users and web designers
performance, availability and scalability looking for cost-effective and powerful
for businesses worldwide. Their team hosting. Whether you are building a
of engineers provide excellent support single-page portfolio, or you are running a
around the clock over the phone, email and database-driven ecommerce website, there
ticketing system. is a Linux hosting solution for you.
www.linuxuser.co.uk 93
COmment
Your letters
Questions and opinions about the mag, Linux, and open source
environment known as Pantheon and sports an OS
So over Ubuntu
Hello LU&D,
X-style dock for an Apple Mac look. Find it at http://
elementary.io/.
Low-res woes
Hello LUD team,
I’ve been using Ubuntu for over a year now. I’m Fedora is not just something you see hipsters I have an old desktop that dual boots Windows 7
bored of it. I suppose it does all the things that I wearing, it’s also a distro that allows you to and whatever Linux install I’m currently playing
want, but people ask me what is that ugly-looking completely switch up the way it looks. By default with at the moment. Recently I decided to give
Windows I have on my PC. Can you recommend it runs the GNOME desktop environment, but it’s Debian a try. It seemed to install fine, but when
something cooler? easy to make it run others such as Xfce, LXDE, I boot into it; it looks like something from 1998 –
Jake Boole MATE and Cinnamon. Have a look at https:// it’s low-resolution with terrible graphics.
getfedora.org/. I don’t think it’s a problem with my display as
The good thing about Linux, Jake, is that there are Speaking of the GNOME desktop, Apricity it’s absolutely fine in Windows, to the extent that
many, many different flavours of it. Some of them OS has planed away all of its non-essentials to it’s happy streaming video and playing older but
look pretty naff, it’s true, but some of them look create a smooth, sleek interface that’s ideal for still hardware-intensive games without a hitch.
awesome. So it all depends on what you’re after. running cloud-based apps. Give it a whirl at http:// I’ve even had the graphics card out to check
Linux Mint is as approachable as Ubuntu but apricityos.com/. on that and it’s absolutely fine. I’ve not had a
has a nice minimalist look and feel. It’s consistently Alternatively, how about making your own problem when I’ve run Linux Mint or live booted
the most popular distro on Linux fans’ crystal ball desktop? KDE – Plasma Desktop (https://www. Ubuntu from your free DVD. Does Debian really
DistroWatch, so it’s obviously doing something kde.org/workspaces/plasmadesktop/) allows you look this bad or has something gone wrong?
right. Check it out at https://www.linuxmint.com/. to configure menus and windows exactly the way Chris Yauch
Like Linux Mint, elementary OS is based on both you want them, add and remove widgets, and really
Debian and Ubuntu, so you’ll know your way around make your desktop your own. It’s available for most From the sound of it, we reckon that for some
it from the get-go, but it has its own custom desktop Linux distros. reason (probably known only to itself) Debian has
Above The KDE Plasma desktop allows you to conigure the look and feel of the Linux desktop UI exactly the way you want to
94
dpkg-reconfigure xserver-xorg
www.linuxuser.co.uk 95
Get started
Everything you need to
know about accessing
your FileSilo account
Unlock
every
issue
01 Follow the instructions
on screen to create an
account with our secure FileSilo
system. Log in and unlock the
issue by answering a simple
question about the magazine.
Subscribe today & unlock the free
gifts from more than 40 issues
Access our entire library of resources with a money saving
subscription to the magazine – that’s hundreds of free resources
Python
Discover this exciting and versatile programming language
with The Python Book. You’ll find a complete guide for
new programmers, great projects designed to build your
knowledge, and tips on how to use Python with the
Raspberry Pi – everything you need to master Python.
Also available…