Linux Mint 19.1
Scripting | Python & C++ (ad!
Coding for
Linux
Master Linux and expand your programming skills
” &sPacked with dtLearn Python 3 &Starttolearn 4 Discover the world
toptipsand andapplyittoreal — thebasics aie EI
aot world programs (iG with LinuxDiscover more of our complete
manuals on Readly today...
BS
Mee
Uthys)eM|
Manual
The Complete
Building Your
The Complete __
Android
Manual
Photograph
Rael Y
The Complete
untu
Manual
7
san
Mae
WhatsApp
Manual
The Complete
Google
Manual
>
ary _
Ere ea
ancy icy INE
_, The Complete
Linux Mint
Manual
The Complete
WordPress
ww. Manua
=
TED
VeTalelel"#t Black Dog i-Tech Series
Coding for
Linux
“That's what makes Linux so good: you put in
something and that effort multiplies. It’s a positive
Feedback cycle.”
Linus Torvalds (developer of the Linux kernel)
Linux is everywhere. It powers the Internet as the main operating system
behind the Web's servers, it powers spacecraft, it's the operating system
for the Fastest supercomputers in the world and it’s used in smart TVs and
mobile devices. Why? Becauseit's ultra stable, lightning fast and completely
free of charge.
However, there's more to Linux than simply being a free to use operating
system. Its unique configuration allows the user to customise and
Personalise the OS into any form they wish. A Linux user can change
their OS look and Feel From one day to the next, install thousands of freely
available apps and programs and take back control of their computer.
Linuxis about freedom. Freedom from the walled-garden approach of other
restrictive operating systems, freedom to choose what you want on your
computer, freedom to alter it and use it how you please. It’s a worldwide
community of like-minded users, all striving to get the best development
from this incredible OS.
With this book, you too can become a part of the open community of Linux
users. The tutorials within these pages will help you get to grips with Linux,
show you how it works, what you can do with it and how you can code with
it to take your Linux experience to even greater heights.
Discover Linux. Discover freedom.
www.bdmpublications.com
O @bdmpubs Gi BDM PublicationsContents
Coding For Linux
8 Why Linux?
10 The Best Linux Distributions
12 Equipment You Will Need
14 Desktop Environments
16 Which Distro?
18) Getting Started with Linux
20 Creating a Linux installer on Windows
22. Installing Linux on a PC
24 Installing a Virtual Environment
26 Installing Linux in a Virtual Environment
Recut d aus Q
30 Introduction to the Cinnamon Menu
32 _ Navigating the Cinnamon Desktop
34 10 Things to do After Installing Linux Mint
36 _DidyouKnow...Apollo 11
38 Creating Users
40 _Customising the Desktop
42 _ Becoming Anonymous Online
EE) 0 see seunest
46 Basics of the Terminal
48 Update Mint via the Terminal
50 Install Apps via the Terminal ~Part 1
52 Install Apps via the Terminal —Part 2
54 Did you Know...Linux Kernel 0.01
56 Creating a File Using the Terminal
58 Creating and Removing Directories
60 Fun Things to do in the Terminal
62 _ More Fun Things to do in the Terminal
64 LinuxTips and Tricks
66 Did you Know...Linux and the Big Bang
68 Creating Bash Scripts- Part 1
70 Creating Bash Scripts—Part 2
72 Creating Bash Scripts — Part 3
74 Creating Bash Scripts Part 4
76 Creating Bash Scripts—Part 5
7B _ PixLinux= The Perfect Combination
80 Command Line Quick Reference
82 AZof Linux Commands
84 Did you Know...Good enough for NASA
CONT
88 WhyPython?
90 How to Set Up Python in Linux
92 Starting Python for the First Time
94 — Your First Code
96 Saving and Executing Your Code
98 Executing Code from the Terminal
100 Did you Know...Space Invaders102 Numbers and Expressions
104 Using Comments
106 Working with Variables
108 User Input
110 Creating Functions
112 Conditions and Loops
114 Python Modules
116 Didyou Know...Debugging
120 WhyC+4?
wn bdmpublcatonscom
122 _ Your First C++ Program
124 Structure of a C++ Program
126 Compile and Execute
128 Did you Know...Virus!
130 Using Comments
132 Variables
134 Data Types
136 Strings
138 C++ Maths
140 User Interaction
142 Did you Know...The Hobbit
144 Common Coding Mistakes
Coding or LinuxLY index
“How did you knowso much
about computers
Kelemen aa lol a
~ Admiral Grace Hopper (pioneer programmer)
CU ca Ld el ee
lack Tech Seres-Volume 38worm bdmpubleations.com
Say Hello to Linux “vy
Why Linux? What is it? Where do | get it?
Why are there so many different versions
of it? Most beginners ask these, and many
more, questions when starting out. It's
true that Linux is an incredibly versatile
and powerful operating system but
where do you start? Thankfully, you can
Find the answers in this section.
‘There is so much you can do with Linux
but you need to know where to start;
we're here to help you out. In this section
you can learn what Linux is, what a distro
is and what a desktop environment is.
You can also begin to explore how Linux
works and how it can work For you.
8 WhyLinux?
10 The Best Linux Distributions
12 Equipment You Will Need
14 Desktop Environments
Which Distro?
Coding or Linuxvy Say Hello to Linux
Why Linux?
FREE AND OPEN
Linuxis a Fantastic fit For those who want something different. The efficiency of the system, the availability of applications and
stability are ust a few good reasons.
‘The first thing you need to know is that there sno such operating
system called Linux. Linux isin Fact the operating system kernel, the
ore component of an OS. When talking about Linux what we, and
‘thers are reFerring to are one of the many distributions, or distros,
that use the Linux kemel, No doubt you've heard of atleast one o
the current popular distros: Ubuntu, Linux Mint, Fedora, openSUSE,
Debian, Raspbian, the ist goes on. Each one of these distros offer
something alittle different for the use. While each has the Linux
keanel at its core, they provide the user with a different looking
desktop environment, different preloaded applications different
\ways in which to update the system and get more apps installed
anda sightly different look and Feel throughout the entre system.
However, atthe centre lies Linux, which is why we say Linux
Linuxis a great operating system on which to start coding.
BlackDop Mech Seres- Volume 38
Linux works considerably differently to Windows or macOS. I's Free
Fora stat: Free to download, free to install on as many computers
asyou lke, Free to use for an unlimited amount oftime and free to
upgrade and extend with, equally, Free programs and applications.
his ree to use element's one ofthe biggest draws For the
developer. While a Windows license can cost up to €100, and a Mac
considerably more, a user, be they a developer, gamer or someone
‘who wants to put an older computer to use, can quickly download a
distro and get to work in a matter of minutes.
Alongside the free to use aspect comes a level of freedom to
customise and mould the system to your own uses. Each ofthe
available distros available on the Internet have a certain spin!There are thousands of free packages available
for programmers under Linux.
in that some offer increased security, Fancy looking desktop,
‘8 gaming speci spn, or something directed toward students
This extensibility makes Linux a more desirable platform to use,
‘as you can quickly mould the system into a development base,
including many different kinds of IDES for the likes of Python, web
development, C++, Java and so on; or create a base for online
‘anonymity, perhaps asa Minecraft server, media centre and
‘Another remarkable advantage for those looking to learn how
to.code, is that Linux comes with mast ofthe popular coding
environments builtin, Both Python and C+ are preinstalled in a
high percentage of Linux distros availabe, which means you can
start to pragram almost as soon as you install the system and boot it
up For the First time,
Generally speaking, Linux doesn't take up as many system resources
‘as Windows or macOS; by system resources we mean memory, hard
drive space and CPU load. The Linux code has been streamlined
{ands Fee from third-party ‘bloatware’ which hogs those systems.
resources. A more efficient system of course means more avalable
resources for the coding and testing environment and the programs
you eventually create. Less use of resources also means you can
Use Linux on older hardware that would normally struggle or even
( Why Linux? om
Roe A
cation == Mandriva slackware
it yp
cotos @ @ &
Each distro offers something unique to the user
butall have Linuxat the core.
refuse to run the latest versions of Windows or macOS;so rather than
throwing away an old computer, it can be reused with a Linux distro,
It’s not all about C++, Python or any ofthe other mere popular
programming languages though, Using the commandline of
Linux, also called the Terminal, you're able to create Shell scripts,
‘which are programs that ae designed to run from the command
line and made up of scripting languages. They are used mainly to
‘automate tasks or offer the user some form of input and output for
‘certain operation,
Finally, although there are many more advantages we can lst, there
are thousands and thousands of free programs and apps avalable
that cover nearly every aspect of computing, Known as packages,
there are (atthe time of writing) over 8,700 specific programming
applications ust on Linux Mint alone and an incredible 62,000+
overall packages catering For everything from Amateur Radio to
WWW tools
Linux then, isa great resource and environment For programming
in. t's perfecty suited For developers ands continually improving
‘and evolving. If you're serious about getting into coding, or you just
‘want to try something new, give Linux a try and see how it works.
For you.
‘A Linux programming environment can be as simple or as complexas you need itto be.
wn bdmpublcatonscommy Say Hello to Linux
The Best Linux
Distributions
MUN tk Tm (ole Xoo Nel aU alle) om cael ae e lola fo nm =e)
Ciel eee) kee ee Melee eel eee ACM RCA VLR ole)
can get them.
GOING LINUX
‘The installation process for most distributions is similar. You download a disk image from the website and burn it to an optical disk or
‘create a USB Flash Drive installer. Just be careful to get the right distribution For your hardware and read the instructions carefull.
Tae
By Far the most popular Linux astro (distribution) i Linux Mine.
Mint began life back in 2006, as an alternative tothe then most
popular distro, Ubuntu. Although based on Ubuntu’s Long Term
Support build, Linux Mint took a different direction and offered
the usera better overall experience.
Linux Mint has three main desktop versions avaliable with
teach new version ofthe core OSit releases. This may sound
confusing at first buti’s quite simple. Currently, Linux Mint
uses the Cinnamon Desktop Environment as its Flagship model,
there's MATE and xfce models available too.
Cinnamon sa graphically rch desktop environment, MATE uses
less fancy graphics, and is more stable ona wider variety of
desktop systems, and XFce san extremely streamlined desktop
environment that’s built for speed and ultimate stability
“Throughout thistite well be using the Cinnamon version;
however, you can try out any ofthe other desktop environments
asyouwish. In fact, t's recommended that you do spend some
time trying different environments, and even different distros,
toee which suits you and your computer best
‘wwwilinuxmint.com
TNT
The second most popular distro avaliable is Ubuntu, which
Isan ancient African word meaning ‘humanity to others
Ubuntu’s popularity has fluctuated overits Fourteen year ie
‘Lone time, itwas easy the most used Linux-based operating
systemin the world but some wrong choices along the way
with regards toits presentation, and some unfavourable,
controversial elements involving privacy, sadly sawit topple
from the number one spot
Thatsaid, Ubuntu has since made amends and isslowing
crawling its way back up the Linux leader board. The latest
versions of the OS use the GNOME 3 desktop environment, an
impressive environment, although itcan be litle confusing
For Former Windows users and isalittle heavy on systern
resources, especialy you'r planning on installing it on an
‘older computer.
Ubuntu, forallits Faults is good Linux distro to start
‘experimenting wth. Is a clean interface, easy to use and install
{and offers the user a complete Linux experience.
www.ubuntu.comArch is one of longest running Linux
distributions and Forms the basis oF
‘many other versions of Linux. Why install
Mint or Ubuntu when you can install
‘Arch? Many users do exactly that but i's
notideal for beginners. Ubuntu and Mint
both offer an easier installation path and
come with software packages to help
you get started
‘Arch ontthe other hand, is amore
tare bones’ affair. Arch is committed to free software and
its repositories contain over 50,000 apps to install, including
multiple different Desktop environments, and use as you would
with any other distro
Rig 145g a kel
No doubt you've heard ofthe Raspberry Pi. shard not to have,
2asthis remarkable, tiny computer has taken the technology
world by storm forthe lasts years since it was intr
‘There are several aspects to the Raspberry i that make t
such asought after piece of the computing world. For one.
it's cheap, costing around £25 for what s essentially a fully
working computer. e's small, measuring not much bigger than
a credit card You can build electronics wth t, using a Fully
programmat ace; and it comes with Raspbian, its own
sustom-made, Debian based operating system that includes a
offce suite alongside mary different programming languages
‘and educational resources.
Raspblan is exclusive to the Pi hardware, since the Raspberry
Piuses an ARM processor to power it. However, the Raspberry
i Foundation has since released a PC version of Raspbian:
Raspberry Pi Desktop.
Just lke the Pi version, Raspberry Pi Desktop comes withthe
allthe coding, educational and ather apps you will ever nee
Its quick, stable and works superbly. Fyou'e interested in
stretching your Linux experience, then ths is certainly one of
the top distros to consi
www.raspberrypiorg/downloads/raspberry-pi-desktop
worm bdmpubleations.com
meansyour Arch ditro wor't come with athe unnecessary files and
appsthat others have preinstalled ts custom made For you by you
The Best Linux Distributions om
Archisa distro for when yo
experienced with Linux. Yo
‘nothing but the command line and From
there you have to manually partition your
hard drive, set where the installation
files go, create a user, set the OS locale
and finally installa desktop environment
along with the apps you want,
The advantage though forall this hard
work isa distro that you have created. This
"Most Linux distributions Fall into two camps. There are ones
with the latest Features and technology like Ubuntu a
‘Mint and those with few new features but rack solid reliability,
lke Debian.
“Meanwhile, openSUSE attempts to cover both bases.
(OpenSUSE Leap is the rock solid system. It's developed openiy
bya community along with SUSE employees, wha develop
an enterprise-level operating system, SUSE; this powers the
London Stock Exchange amongst other things. Itis designed
For mision critical environments where there is no scope
Forinstablty’. you Find al that too sensible, openSUSE
Tumbleweed sa rolling release with all the latest Features, and
‘openSUSE isa highly respected Linux distribution and many
of ts core contributors work on the Linux Kernel, LibreOffice,
Gnome and other key Linux areas. n short, openSUSE is where
youllfind the proshanging out.
wwwopenSUSE.orgme Say Hello to Linux
Equipment You
Will Need
BO ene Mieunedomteccs iM ure T acer ery
Up oracale WAC eR Cone Reel em ea eer Oe ToL RMT ar) Men Kel acem
However, it’s worth checking you have everything in place before proceeding.
MINTY INGREDIENTS
Before we start working our way through this book, here's what you need to install and run Linux Mint. You have several
choices available, so take your time and see which works best for you.
SiMe Mey sy eeuel |
‘The minimum system requirements for Linux Mint are ‘You can install Linux Mint onto your computer via USB or OVD.
asfollows: We look into each ate later on but i you're already Familiar
with the processor thinking oF USS and just gathering the
7 hardware you need, then you're going to
Ca) need a minimum 4G8 USB fash drive
RAM/Memory—512MB, tostorethe Linux Mint SO.
Hard Drive space ~ 9GB (20GB recommended)
Display - 1024 x 768 resolution
‘Obviously the better the system you have, the better the.
‘experience willbe and quicker too
DVD INSTALLATION
WD installation of
Linux Mint simply
requires blank
DYDR disc. OF
course, you also
need an optical
dive (a DVD Writer
drive) before youre
able to transfer or
burn the SO image
tothedisc,
FED 2teck 009 tech Sries- Volume 38( Equipment You Will Need vy
M3 PNWeN MLN Ls
Installation toa virtual environment i a Favourite method of testing and using Linux distros. Linux Mint works exceedingly well
‘when used ina virtual environment but more on that later. There are many different virtual environment apps availabe; however
VirtualBox, From Oracle, is one ofthe easiest to into, You can Find the latest version at wwwvirtualbox.org
Saves
o7 VirtualBox
INTERNET CONNECTION
It. goes without saying really, that an internet connection is vital for
‘making sure that Linux Mint is up to date with the latest updates and
patches, as well as the installation of Further software. Although you
donttneed an internet connection to use Linux Mint, youl miss out on
‘world of free software available forthe distro.
Xe
Although Linux Mint can be installed
‘onto a Mac, there's @ school oF
thought that recommends Mac
owners use a virtual environment,
such as Vrtualbox or Parallels;
and why not, macOS's already a
splendid operating system. If you're
wanting to breathe new lif into an
colder Mac, make sure i's an intel
CPU madel and not the Power PC
models. Beware though, it's nat as
pain free as installing on to aPC.
Poor Coni rts
wn bdmpublcatonscom Coding or Linuxwv Say Hello to Linux
Desktop Environments
WHICH MINT?
‘A Desktop Environment is the graphical interface which you use to interact with the core Linux system. Just as the graphical
desktop For Windows 10 is also called Fluent Design.
Linux Mint offers the user a choice of versions of the isto:
Cinnamon, MATE and Xfce, While that may sound alittle confusing
or the newcomer, essentially each ofthe versions available contains
re Linux structure and kernel, the kernel isthe core of
he operating system, that handles ll the instructions between the
software and hardware
fh versionis simply a different desktop environment, the
Graphical User Interface (GUI) that you use to interact with the
‘operating system. Each ofthe desktop environments uses diferent
apps ta accessor use the system, suchas the file manager to browse
he operating system's file structure or the way it launches other
‘apps. Again though, the core available productivity, video and
a
—
ae
Follow that by clicking on the System section,
then the Processor tab. Depending on your CPU,
allocate as many cores as you can without detsimentto your host
system; we've opted For two CPUs. Now click on the Display section,
slide the Video Memory up to the maximum anc
‘Acceleration’. Click OK to commit the new settings
k’Enable 30
Click on the Start button and use the explorer
ca
button a folder with a green arrow) inthe ‘Select
Startup Disk’ window to locate the downleaded 1SO of Mint; then
ickStartto boot the VM with the Linux Mint Live Environment. You
1h now install Linux as per the standard PC installation requirements.
=Gettingto » |
nae LINUX“Anyone can build a Fast
processor. The trick is to
build a fast system.”
~ Seymour Cray (Electrical Engineer, and
designer/founder of Cray Supercomputers)
#
worm bdmpubleations.com
Getting to Know Linux @&Y
We've used Linux Mint asa guideline
here, as it’s an easy to use distro and
perfect for former Windows users.
It’s also one of the most developed
and well documented Linux distros.
as well as having some fantastic
configuration options.
In this section, we introduce the Linux
Mint Cinnamon Menu and Desktop
Environment, how it works and what
you can do to customise it. Want to
create another user or even discover
how to become anonymous online?
Then read on.
Introduction to the Cinnamon Menu
Navigating the Cinnamon Desktop
10 Things to do After Installing Linux Mint
Did You Know...Apallo 11
Creating Users
Customising the Desktop
Becoming Anonymous Online
Coding ortinuxwy Getting to Know Linux
Introduction to the
Cinnamon Menu
CINNAMON VIRTUALBOX FIX
You've already looked at some list functions, using insert, .remove, and .pop but there are also functions that can be applied
to strings.
FETED fore we beoin, we're assuming youre having this REINEMEM artera moment or two you're automaticaly
issue within Vitualbox. The Software Rendering dropped into a commandline view, called the
message appears in the top right of the desktop. To Fix thi, click erminalin Linux. This details the installation of the new VirwalBox
‘on Devices in the Virtualbox window, Followed by Insert Guest drivers, eemoving any old drives it has detected, and installing the
Additions CD image. latest versions. won't take Long and when its done you will be
asked to hit Return to exitthe Terminal
PEPE D The Cucst Additions CD contains drivers For FEI D The virtualbox Additions CD iconis on the desktop,
Virtualbox, including the virtual video hardware so right-click itand then scroll down the menu to
\when its loaded in, you get a ‘software needs running’ notification Eject. You can now restart Linux Mint by clicking the Menu, the
box with two options, Cancel and Run. Click the Run button and bottom icon inthe stripto the left, then the Restart button. This
enter your Linuxuser password. boots Mint and the problems fixed.
box 64s 602 °
automatically stated, Would you ike to run
Black Dog ech Series-Velume38CINNAMON ON THE MENU
Introduction to the Cinnamon Menu om
Now the Software Rending issue for Virtalbox users is out of the way, let's take a look at the Mint Menu and how it all works.
Remember, this s just For Mint Cinnamon, other distros look and behave differently.
PEPER F'scoFF you may have already noticed the Welcome
Screen that pops up when you login to Linux Mint
se through the options, read the First Steps
Take a moment to brow
‘option and so on, When you're done, click the Xin the top
comer of
e window to close it
You've already used the Mint Menu to reboot
the system and when you first used the Live
ronment. Thistime, click the Menu button and haver ove
the Office entry in the middle column. This changes the icons
represented inthe right-hand column detaling what apps are
installed under that section
ESTER L2unching any ofthe apps from the Menuis as
simple as finding one and clicking it. For example,
under the Office section, click on LibreOffice Writer, Writer isthe
preinstalled word pracessor for Linux Mint. It opens and saves as
Microsoft Word and functions in almost the same way.
wn bdmpublcatonscom
FTI D open up the Menu again but this time hover
the mouse pointer over Graphics, then click on
CGN Image Manipulation Program. GIMP isa powerful imag
nanipulation app that’s probably as effective as Adobe's Photoshop
but requires alittle more workto getthe results you want. It's
certainly worth taking the time to master, though,
IF you're looking for a particular Function or app,
such as setting up a printer, click on the Search box
‘at the top of the Menu box. Start typing the app or function you.
‘want, such as printers, and the Mint Menu displays the relevant
options below. This works with most modem Linux menus,
regardless ofthe distro.
FPP tiover over any ofthe apps listed onthe righthand
calumn and right-click, to be presented with als of
options: Ad to Panel, Add to Desktop, Add to Favourites and Uninstall
Most of these options are abviousin their use. Ad
though places the app inthe left-hand, quick-access_
my Getting to Know Linux
Navigating the
Cinnamon Desktop
Each desktop environment behaves differently to that of the next. Some DEs offer
widgets that can be customised and placed on the desktop, others instead opt for a
clean, sharp look to keep everything running as fast as possible. Let's see what the
Cinnamon desktop has to offer.
A TOUCH OF SPICE
‘The Cinnamon desktop environment isa great blend of style and performance. There's lots to like about it, which is why it’s
such a popular DE.
PEPPER) eccin exploring the Cinnamon desktop by double. SPPED Nemohas many different Features, views and
clicking the Computer icon. This brings up Nemo, ways so that you can view and manipulate files and
the ile manager used in Cinnamon. The Computer icon opens up Folders. For example, if you have any images n the Pictures Folder,
the root level ile system, with access and views to the optical rive you can select the icon zoom level forthe images by using the sider
(Fyou have one installed), hard drive and core Linux fle system, located in the bottom right af Nema, labelled Adjust Zoom Level
WHEE Gowe
SERRE EE
ZEEEBSERaE
PEPER) The Linux ile system can appear confusing to EEPP DD ust ike any good file manager, you right-click
a former Windows user, so until you're alittle any of the Fle or Folders within you get a wealth of
‘more knowledgeable on how it all works, we'd recommend you __optons.n the case of Cinnamon, the defaults alow you to play or
concentrate on the Home con on the desktop instead. Inhereis _viewa file depending on what type of fileitis and copy, cut, delete,
‘everything relating to your user account: where youstore Pictures, compress, rename, send via email and view its properties.
Videos, Musi, Documents, Downloaded items etc
ck op eh SteleAte bottom ofthe destop there's the Panel
SNAPE ‘We've already looked at one section of the Panel,
the Menu. If you right-click anywhere on the Panel, other than on 2
Panel app, you see a menu allowing you to edit, add and set up the
Panelin a different way
“ Navigating the Cinnamon Desktop om
FEPD From that desktop right-lick, context menu, select
Customise, allowed by the Desktop Settings lnk at
the bottom of the newly opened window. This opens new window
where you're able to edit which desktop icons are present. you're
using a setup with multiple monitors attached, you can also choose
which monitor displays which icons.
ESTEE) For example, ifyou click the option Modify Panel
you can remove, move, remove the Panel, add 2
new one and clear it of any Applets that are currently present. An
‘Applet, by the way, san app that’s designed to work and it into the
Cinnamon Panel
IF you rightclick anywhere on the Cinnamon
desktop you see a set of aptions that allows youto
Further add to, editor view the desktop content differently. t's very
similar to that of Windows, which s why Mint is @ good choice For
ex'Windows users.
=
B creme NewDociment
Ds
Bi change Deny nackround
+ creme anewlauchertere
0
wn bdmpublcatonscom
Clickon the Menu and type system settings and
‘open the resulting icon. This takes you to the
System Settings options. From here you'e able to control and edt
the way Linux Mint Cinnamon looks and works as well add new
users, manage the firewall and enable accessibilty options
eas a
Bas Ss S
@ Gacgss 8
PEPER | short Linux mint cinnamon can be configured
tolook quite extraordinary. There are many
examples avalable of how good it can get and what can be
achieved. You can go as complex or as sim
rent component and animations or ust
easy toread,
ss you want, adding
-epingit plain ayD Getting to Know Linux )
10 Things to do After
Installing Linux Mint
Linux Mint is a polished distro out of the box but, as with most Linux distros, there are
some tweaks that can be applied to improve the way it works. Although these are Mint-
specific tweaks, most can be applied to other distros.
LINUX TWEAKS
‘Some of these post-installation actions are highly recommended, while others are just handy additions and simply tweak the
system or add a customisation.
The first, and most important, postnstallation Click the OK button and you can see acouple of
actions to update the system. lickon the shield ‘Updates ready for installation. Before you update
icon in the Panel, found at the bottom right of the desktop next to though, click on the blue bar OK button to switch toa Lacal Mirror.
the time and date. This launches the Update Manager. ‘This opens the Software Sources option. nthe Mirrors section, click
‘on the Main and Base drop-down menus and select aserver closest
toyour current location,
PEPER Linux Mint offers the usera three level policy Bea ick the Update the Cache button and close the
approach to updates: Don't Break My Computer, Software Sources window. Back n the Undate
Optimise Stability and Security and Always Update Everything Manager, click on the Install Updates icon and enter your password,
The recommended options the Optimise Stability and Security, __The updates automatically apply themselves and relaunch Update
which only updates safe, essential patches that won't impact critical Manager, this time with a lot more updates, Again, click Install
elements ofthe core OS, Read through the descriptions but choose Updates, OK any messages and wait for ther to Finish
the middle, and recommended option.10 Things to do After Installing Linux Mint “
SE the und: graded by level, 1 being alow BSTTSEDD when asked to accept the changes, enter ¥and also
level update, level 5 being a dangerous one. Stick wen asked to configure ibdvd, Make sure OK is
tollevel 3 updates, is our advice; and lace for any messages highlighted and press Ente, then Yes to any Further questions. Next
-egarding overwriting a configuration file, With regards to the up, stilin the Terminal, enter: cat. /proc/sys/vm/sappiness;
Software Rendering issue and lack oF drivers For non-VirtualBox _the result should be 60. F your computer has less than 4GB of RAM/
Users, click the Menu and type ‘diver int the search box. memory, then enter: gksudo xed /etc/sysctl..conf.
Click the Driver Manager app that appears asa ‘This tweak helps speed up systems with ess than
result ofthe search and enter your password, Mint 4G8 RAM/memory. Scroll down to the bottom of
akes amo vallable and presents youwith the fileyou just opened and add the Following new lines:
a selection of potential drivers based on your detected hardware.
Those with graphical problems, such as Software Rendering, should
‘optto use the lates, recommended Graphics drives
ent to analyse what's
# Decrease snap usage to a more reasonable Level
‘vm. swappiness=10
Click File > Save, then File > Quit. Reboot Linux Mint and you should
= notice a slight hike in performance
EEPTEM) 2: this point you'l probably need to restart Linux PBIB Security i always a concernin this modern digital
‘Mint, sa do that now. Aftera reboot click the Menu age. While Linux Mint isa secure system, t's
n again, Followed by the Terminal. The Terminal icon s Found in advisable to always try and improve't Click the Menu button and
he left-hand column, above the Files icon. With the Terminal open, search for Firewall click the Firewall Configuration icon and enter
enter: sudo apt-get install Libdvd=pkg, press Enter and your password. In the Firewall window, click the Status slider to On.
ype in your password, This enables encrypted DVD playback
worm bdmpubleations.com Coding or LinuxApollo 11
[DID You KNOW... AAR
Dee tans aca)
Pesca halo!
Beare st ae oe eters
Preece Meus
re era Lee elie)
Tne aks
Pere ieute che eens
Saas ene ca
een ee uae)
ee ree us
ere Ae eee ECS
to view on GitHub. Uploaded by a
researcher in 2003, you can view the code
Rn Rae a Sa
Apollo-11/.Look out for code snippets,
tenes Mune ac gS
Sa Seu Nak le) Meo
Peed :
humour
Seawhatelsel
inthers
S
Pee eeOne giant leap for
\ mankind, and coding.my Getting to Know Linux )
Creating Users
When you first install Linux Mint it is configured For use with a single user. While
Slee Melee aan eMC eM Reo eRe ROR ole]
Dre feet eR MATTOON eM en ate) Le
NEW USERS
‘on are separate, as with multiple users on other opers
different users means each user has access to his or hers own areas on the system. Documents, pictures, videos and so
systems,
BETTE click on the LinuxMmint Menuand type ‘users to
begin searching For the relevant console. From the
search results, choose Users and Groups and enter your password,
The Users and Groups console i quite basic looking, and thankfully
‘easy to use. At First, you can just see your own username From when,
you installed Linux Mint
To add anew user, click the Add button atthe
bottom of the console. There are two types of
ser you can create, Standard and Administrator. Unies the new
ser has need to install new apps or access parts ofthe file system
beyond their Home folder, then opt for the Standard account type,
(Otherwise, use the Administrator account type.
BlackDop Mech Seres- Volume 38
PEED Enter the new user's FullName, followed by the
Username they need when logging into Linux Mint
Make sure the username'sallin lower case, a and 0-9 characters
‘only. You can have full stops, underscores or hyphens iF you wish
Click the Add button when you're ready to continue.
FST The new user appearsin the list of current Linux
Mint users in alphabetical order. At present, there's
no password set so click the user inthe lst of current users, then
Update Mint via
the Terminal
Up to now you've been using the shield icon to launch Mint Update Manager in order
to update the system and upgrade the currently installed apps, tools and other
elements. However, you can also accomplish a complete system update and upgrade
From the Terminal.
USING APT-GET
‘To update and upgrade via the Terminal you use the APT (Advanced Packaging Too!) command. It's a powerful command and
‘combines different elements depending on its use.
ESSER 2tbyopening anew Terminal orifyoustready EEE Apt-act is used to update and uparade the
have one opened clear its contents with the clear oftware in Mint, as well as Ubuntu and other
‘command. This starts you off witha clean slate on which ta work. _Debiarvbased distros. Using the Update element retrieves
new package lists and updates the list of source files. Uparade
loads and performs an upgrade tothe latest versions of those
files. To start the entire Upgrade and Update process, enter: sudo
‘apt-get update, followed by your password.
Fe Edt View Search Tein Hp
ESTEE [ster apt-get intothe Terminal This brings upa ENEMY Notice now the addition ofthe sudo command. The
list of the most used apt-get commands, along with sudo command once meant Super User Do; these
brief description of what the command does. I's worth having a ‘smore acceptable as Substitute User Do. It means that the
look at, even iFit doesn't makea huge amount of sense at this time. administrative user (Super User) uses APT (Advanced Packaging
Too!) to Get any Updates. Now try ths: sudo apt-get. upgrade,
BB) stk op itech series-Volume38Depending on the state of your updates, iFyou
have any waiting to be installed, you might be
‘asked you want to apply the results ofthe sudo apt-get
upgrade command. You can press to accept and continue. What's
happening here is that apt-get has some updated software to apply
20 Mint, and you're okaying the action
TERMINAL VS UPDATE MANAGER?
‘Why use the Terminal to update and upgrade over the Update
‘Manager, regardless ofthe distro you're using? Some users
‘areatly prefer using the Terminal to update their Linux systems
and accompanying apps, in the belief that it’s better. However,
that’s not often the case.
Using the Terminal, apt-get upgrade, doesn't handle changing
‘dependencies between versions of packages, so ita package,
thas its dependent files changed from one version to another,
then the upgradeis held back,
‘The Update Manager, or Software Manager (depending on the
distro), often phases its updates and marks those packages.
wn bdmpublcatonscom
“ Update Mint via the Terminal
8
iy, that’s it, your system is now up to date
ding to the availabe ist of packages From the
apt-get update command, You can run through the pracess one.
more time, just to checkif everything went okay. To recap, enter:
sudo apt-get update, press Enter, then type: sudo apt-get
upgrade and press Enter
interestingly Linux Mint, among other distros,
(offers you the ability to chain several commands
together. In this example, therefore, we can use sudo apt-get
update &% sudo apt-get upgrade. The double ampersandis
what combines the commands and works perfectly, providing the
preceding command went without a hitch. t's recommended to
start any session with the update and upgrade combo.
Bs
‘with changed dependencies for updating, However, and thisis
‘where Linux can often get confusing, sometimesit doesn't,
Itall bolls down to the developer of the package being
‘updated and the way the package is held in the distro’s
repositories and whether the update is classified as stable
‘or not, In essence, From the point of view of the user, iF you
‘update and upgrade using both the Terminal and the Update
Manager regularly, then you will be as up to date as possible,
‘and get the essential and necessary stable versions of the
packages and core software. If you're looking for cutting edge
package updates, then it's best to opt Fora rolling release
distro instead.
codingfortinn48
Using the Terminal
Install Apps via the
Terminal—Part 1
There are different ways to install apps and programs on Linux. You can opt for the
graphical route, using a Software Manager, or you can use the Terminal. Often, the
Terminal provides better control over the software being installed and sometimes, you
have no choice in the matter.
COMMAND LINE INSTALLS
Installing an app with the Terminal may require some nifty keyboard work but you get a better sense of what's being installed
and where,
he system is up to date. To do this open up the Terminal and enter
sudo apt-get update && sudo apt-get upgrade. Enter
your password and accept any necessary updates.
PRPTSP DD ust asyou've seen, sudo apt-get update/ung
and so on are designed to upgrade the software
that's already installed onthe system. How do you install more apps
‘though? Iejust so happens that i's extraordinarily simple. Fist you
need an app to install so let's use Stella again. Enter: sudo opt=
get install stella
BB) sick op itech series-Volume 38
PERE stating apps form the terminalis often relatively
simple. First though, you need to make sure that
‘automatically created the Games category in the Menuas well as
the app shortcut.
PPP DD sometimes, when instaling software, you need to
he app's Repository. The repository, or repo,
issimply the remote server lacation whe ware is held
along with allits dependencies (the vital libraries and such it need
tofunction). Start by typing inthis sudo add-apt-repository
pa: peterlevi/ppa. Press Enter when asked to and add the PPA
(Personal Package Archive)Install Apps via the Terminal-Part1 @fy
PRPTSD) Thisadds the repo forthe app Variety W EEE Now toinstal Variety, enter: sudo apt-get
Changer, an Ubuntu-based app that w install. variety. Press to confirm and accept
‘and changes the wallpaper automatically. Now that the repo is added, — the installation, and to continue with the install, Once installed, you
enter: sudo apt-get update, tou ‘ew information and can type variety into the Terminal torun the app.
‘add the contents ofthe repo to the package datab
REMOVING APPS
In addition to installing apps, the apt command can also be used to remove any apps and helps keep the system tidy and free
up resources.
PEPPER To uninstall orremove, the Variety appenterthe EIEN when you remove apps From the system you're
following: sudo apt-get remove variety. be informed that some packages that were
rer to continue with the uninstall ofthe app; notice also that automatically installed are no longer required. You already saw in
You're informed of how much space you'e Freeing up on the hard the previous tutorial, that you can tidy things up with the Following
drive as a result of removing the app. command: sudo apt-get autoremove, foliowed by pressing y
pt the process.
ie tet ven Seach tem Heb
PEPER wie the apt-get remove’ command uninstals an AAR Finally, to tidy upallthe non-used packages in
app, it doesn’t get rd ofthe extra clutter that comes he system, and to remove elements that the
with an app, such as configuration and library Files, To complet autoremove command didnt, youcan enter: sudo apt-get
remove the clutter, enter:sudo apt-get purge variety. ‘autoclean, These last Few steps are vital for keeping your Linux
Mint setup in good working order and to trim off the unnecessary
excess caused by installations and upgrades.
et Ww Sh Trip
re tik ven semch Tern Heb
nbdmpublcatonscom coding fortinnZV) Using the Terminal >
Install Apps via the
Terminal—Part 2
Most of the time you'll get to install apps from the Terminal using the standard apt-
get command. However, sometimes an app demands a little more work. This means
installing an app From its source code, which isn’t as scary as it First sounds.
FROM THE SOURCE
‘The commands you'll need to become Familiar with here are Configure, Make and Install. You'l Find a lot of apps use installing
from source, so it’s certainly a skill worth investing time in.
Source code files for Linux usvally come in the form The wget command retrieves content from the
(Of TARGZ or TAR.822, Both are compressed files internet, inthis case the .822 file for Vim, To check
idng all the coe Files needed to make’ the app. Startoff this _the lle was downloaded successfully, enters. According to Mints
storia by creating a new folder in Home: mkdir. Vim Filesystem colour ke, the compressed file should be displayed in red
Fle St View Search Terminal Hp
FRPTER vi by the way, isan advanced text editor which VB wenced to uncompress the contents ofthe file
well use as an example to instal Enter the new now, soenter: tar =xF vim-7.4.tar.b22 into
falder, cd Vim, then fram within the new Vim folder, eter the the Terminal. Note: you can type in tar =F vand pressthe Tab
fallowing command into the Terminat wget Ftp://Ftp.vim. key to autofillthe remaining filename.
org/pub/vin/unix/vim-7.4.tar.b22.
BB) stock op itech series-Volume38Install Apps via the Terminal-Part2 @/¥
You may need to keep installing new dependencies
depending on the app. After each new dependency
isinstalled, rerun ./configure and when it doesn't report back
the installation,
Fy enter Ls again youl nate that new
Susp folder has been created: vim74; in lig
presenti
for the main app, then as you upgrade apps through this method _ with an error you can continue to the next stag
he incvidval versions will each have thei own Folder. Note: you may need to search online For some error messages,
Fie Edt Vow Search Terminal Help
ESTEE Tein cd vin74 to enter the folder and 1s again EIB with a successful ./configure, the system will
toviewits contents. There wil likely bea fair numbe create a Makefile. This needs to be ‘made’ by
les present; most are the app’s core files, while others wil entering:make into the Terminal. This may take a while, depending
labelled README or INSTALL It’s always wise toread these files fist on the size ofthe app
asthey provide valuable information regarding the installation,
ESTEE AD The first part oftheinstallation requires youto enter SESE Finally, you need to enter: sudo make instal
/configure. The /configute command will check inco the Terminal. Ths wil install the app, and
your system for any missing dependencies associated withthe app. IF make it ready or use inthe system. When complete you can execute
you received an error regarding a C Compile, then enter: sudo apt= the app, in this case by entering vim into the Terminal or searching
get install build-essential. The third-party app Neurses __Foritvia the Dash.
was recorded as missing, We need to install that with: sudo apt=
get install Libncurses5-dev LibncursesnS-dev.
na bmpublicatonscom codingfortinx(nner mer trie icres
lockO rootfstype=jffs2 init=/etc/preinit noinitrd console=tty0 console=ttyS0, 384
Coemore ots
Found and enabled local APIC!
GE bUr co aa eC mc
Enabling unmasked SIMD FPU except:
Itnitializing CPUO
PONT Cm ae Cease NCD)
ac Bee e ae
Coe Cemes Tc a (cea che
console [tty0] enabled
SMacm iss Eom Cty
Dentry cache hash table entries: 1024 (order: 0,
Mi eM Cc CRC eC Cg nD
done
De eee
lay pve ae aC CC aCe Sy aCe)
(ata eC)
Pure cna emo rs
Bee) Cea Me ORR ae Cm OP: Od)
0xc1000000 (1007 MB)
lowmem x0000000 - Oxc ( TA)
init : 0xc0313000 - Oxc0344000 = ( 6 kB)
Cle (597 kB)
text 6 (1497 kB)
Checking if this LCL eC eau ee eee
calibrating dela pemieud 1p}=20238210)
Cee aneeee er onZV) Using the Terminal >
Creating a File Using
the Terminal
Using the Terminal, you're able to create Folders, Files and even execute Linux Mint
apps. In truth, if you didn’t have the GUI at hand, you could still accomplish the same
From the Terminal.
MORE TERMINAL WORK
Creating content using the Terminal isn’t quite as strenuous as it may first appear. Yes, the Terminal can look a daunting place
for the newcomer, but once mastered it’s really quite intuitive.
perepieeatandmatesreyieinhe EERE Your cine sou cange tothe ele
sua Home folder. If not use the ed ~ command to retum EPS and if you enter Ls (List folder contents) there'll
fereveryouecurentylocated benothing within thefolder as youve strated. The mkdir
commands fairly self explanatory: Make Directory Followed by the
Gaaeaaem) name of your choosing,
youto the Home folder Fr
ie at en sear Temes)
PPB ets start by creating a new folder within Home, PEP D To create an empty text fie, called Test.txt, enter
and call it Test. The command youtl need is inthe Terminal: touch Test..txt. You can then
mkdir Test. Press Enter to create the folder when you've typed _—_use L to view the new file inthe folder. Touch isa standard Linux
inthe command, then cd Test and press Enter. Thiswill Change command that allows the creation of files without the need to open
Directory hence €) to the newly created Test Folder. atext editor, save the file, then close
BE) stk op itech series-Volume 38PEPTIR L2t's say you now wanted to create a text file, wel
callitTest2.tx, complete with some content. To do
so,enter:Cat > Test2. txt. Thiswill create the file Test2.txt and
put the Terminal into an
aovidedavi
Fle Eat View Search Terminal Help
Sora
contents tothe fe.
BPTI MD (0F course you don't always have to use the Terminal
to-enter text into ale. Mint comes with atext
editor called Xed, whichis similar to Windows’ Notepad. To view the
viously created fein Xed, type into the Terminal: xed Test2.
‘ext, and press Enter.
wn bdmpublcatonscom
M
( Creating a File Using the Terminal
FETT %ed is 2 cul app, and youcan e
the file, or any File, accordingly by usin
main window, and the File > Save, or File > Save As functions From
its top menu bar options
koojias
F however, you prefer to remain working in the
Terminal
edie/save/create files, you
Nano. Nano isa simple Terminal based text editor. To uy it with
the example, enter:nano Test2. txt. There'sa menu along the
bottom of the screen. To exit and save any content in Nano, press
Ctrl4X and Follow the on-screen instructions
We've used the Terminal to launch a Mint app,
Xed, but any app can be launched from within the
erminal. For example, ty: Firefox, and press Enter. Close Firefox
toretur to the Terminal. Providing you know the name ofthe app,
itcan run from the Terminal
Firefox, AND lets yousstil
tionally, entering fireFox8 opens
he Terminal.
coding fortinxZV) Using the Terminal >
Creating and
Removing Directories
As with creating files in the Terminal, you can also create and delete directories, or
Folders if you prefer. Directories Form the structure of your file system, without logical
directories the filing system would be in utter chaos.
MANAGING FOLDERS
Learning how to create and delete folders in the Terminal is an important Mint, and indeed Linux overall, skill to master. Here's
the basics for you to try out.
With the Terminal open enter cd ~ to make sure I you were to enter the command again, mkdir
you're inyour own Home directory, Now enters testdir, youll receive a message stating: mkdir:
0 view the current folders you have housed inthe Home directory, cannot create directory ‘testdin’: File exists.
YYou'l notice that folders are labelled in Mint in cyan (ight blue). oes without saying then, that you're only able to have one uniquely
Let's start by creating a new directory. Enter:mkdin testdir. named directory within the current directory, However, as Linux's
case-sensitive, ou can have Testi, TestDir, testDir and so on
PEPER i youncw enterls again, youl see thatthe ni FRPP You can create crectories within directories youve
directory, testdir, has been created alongside the already created. For example, enter the testdir
ir directories in the Home area. Obviously the command mkdir ry with ed. testdirr followed by to listthe folder structure.
is what creates the directory, and no doubt youve already guessed Naturally there's nathing present, as you've just created the directory.
it stands For Make Directory. Now drop back to Home with ed ~ and entermkdir testdir/
reports. Gobacktothe testdir, cd testdir/, and Ls again.
BB) stock op itech series-Volume 38The command to create director
therefore. Youll create the direct
directories within, However, what iF you want to create a directory
and a sub-directory ina single command? Make sure you're at Horne
(ed~)andenter:mkdir =p Temp/finances. Now, ed Temp/, and
Istolist the new directory.
sis quite logical,
ry, and any sub
‘The-p optionis what enables the mkdir command
to.reate the sub-directory as well as the parent
directory. In Linux, commands always Follow the same structure
Command, Option, and Argument. n the previous step example,
‘command (mkdir), option (p), and argument (Temp/Finances).
File Edit View Search Terminal Help
ee ee CTT |
PRED you want to drill down into the various options
available for the mkdir command, you can enter
mkdir =-help into the Terminal. This wil provide a quick help
‘uide detailing the options and how the command structure works,
wn bdmpublcatonscom
( Creating and Removing Directories 4
Now that we've creat
some directories, let's see
about removing them, Start by entering the testdir
directory and listing its contents: ed testdir, then ls, The previously
created reports sub-directory is present. One way to remove itis to
enter: mdir reports, then s again to confirmit’s not there.
A.quick warning: removing a directory in the
Terminal doesn't place it inthe Mint Rubbish Bin, via
IFyouremovea
Nemo file manager. The same goes For any files,
dicectory From the Terminal command then it’s gone For good.
ERED Prdir wil only eemove empty directories, to
remove directories containing sub-directories, or
even files, you'll need to use the rm command with the R option.
For example, on the Temp/finance directories, use rm -R Temp.
‘A quicks reveals that the parent folder and all ofits contents are
removed, Careful when using this command,
codingfortinnZV) Using the Terminal >
Fun Things to do
in the Terminal
Despite the seriousness of an operating system, the Linux community are certainly no
strangers to a bit of fun. The developers over the years have created and inserted all
manner of Fun and odd elements into the Terminal.
TERMINAL FUN
You'll be working exclusively in the Terminal for these next two sections, so start warming up your Fingers. After all, all work
and no play... as the saying goes.
ESTER) the frstcommand wee going to use iss it's PETER you've ever fancied having the computer read a
not installed by default so enter: sudo apt-get ‘andom fortune out to you, then you'te in luck. Most
install sl. The command can be run withsland when executed distros require you to instal the Fortune app, however Linux Mint
will display a Steam Locomotive traveling across the screen (hence differs somewhat by having it already pre-loaded. All you need to do
‘st) Entering LS, note the upper case also works isenter the command fortune into the Terminal, and enjoy.
PEPTPD F20s.f starwars even getafixwhenitcomesto FB the revcommandis certainly interesting, and at
the Terminal. By linking toa remote server via the first what seems a quite useless addition to the
slnet command, you can watch Episode IV: A New Hope being 0, However, it can be used to create some seemingly unbreakable
played out, albeit in ASCIL To view thisspectacle, enter: telnet _ passwords. Enter: rev, now type some text, when you press Enter
‘tonel .bLinkenlights.nl. next, everything you typed in will be reversed, Press Ctrl+C to exit
BBP stk op itech series-Volume38Fun Things to do inthe Terminal @2¥
offer much output, whereas Factor 60 displays more aphical cow equivalent: Fortune | xcowsay. Plus there's
always comthink. Try cowthink ...This book is anesone.
et Ww seh Tei ip
FETE There'sarine line between the rather cool and FETE The command toilet doesnt inspire much
really quite weird. Having an ASCII cow repeat text confidence, well admit, However, i's nt as bad as
10 you could potentially fallin the latter. Enter cowsay followed _it ist sounds. Start by installing it with: sudo apt-get install
byany text you want, such as: cowsay Linux Mint is ace!. toilet. Then when installed, type something along the lines of
Infact, you can even output the lscommand through the cow, by toilet David. Or perhaps list the contents ofthe current folder
entering: Ls cowsay. through it, with: Ls I toilet.
Tofurtherthe cow element heres evena graphic Expanding the tot comman, you can actual
Suzy ie. non-Terminal, cow available. Install it with: Sue : fh
generate some decent looking graphics through
sudo apt-get install xcowsay, then whenit'sinstaledenter it. For example, try this: toilet -F monol2 -F metal David.
something similar to cowsay, suchas: xcowsay BDM Publications. You canenter toilet --help, for alist of the command line
arguments to expand furt
na bmpublicatonscom codingfortinxZV) Using the Terminal >
More Fun Things to
do in the Terminal
IF the previous list of Fun, and quite bizarre, things to do in the Terminal has you
wanting more, you're in luck. We've put together another batch of some useful, and
some not so useful, commands for you to try out.
MORE FUN, YAY
Since the Terminal session is already open, and your keyboard digits are nicely warmed up, here are another two pages of
Terminal nonsense.
Remember the old 2x Spectrum days of computing, Having alittle white cat chase your mouse poin
when you could type in 10 print “Hello", 20 goto 10, around the desktop may sound tke a terrible waste
‘and Hello would lst dowa the screen? Well in Linux Mint you can do of time, Oddly though, itisnt. Enter: sudo apt-get install
he same. Simply enter yes Followed by some text, yes Linux _onteko, then type oneko to have the cat appear. Move your ‘mouse
is ace. itil keep going until you press Ctrl+C. cursor around the screen and the cat wil chase it. Use CerL4€ to
exit the action
EEE The Matrix was one of the most graphically copied — ESESIPWM This entry isa litle more serious than the previous
films ever released; there's even a version of the t's called the Fork Bomb and what it does, bas
Matrix code available for Linux Mint Installit with: sudo apt-get is continually replicate iself until it has used up all the available
install cmatrix when t's done enter cmatrix and follow system resources, thus causing your computer to crash. You don't
the white rabbit, Neo, Unlike the real Matrix though, youcan press have to try but t's interesting nonetheless. Simply enter : OE
CerL+C to ext. 1:8 }: and be prepared to reboot
le de View Search Terminal Help
BB) swxk oop itech series-Volume 38EEE t:naing several commands and piping them
through other commands is what makes scripting
such a powerful element to an 0S, Using the while command, For
her with toilet, can yield some impressive results
rerwhile true; do echo “SCdate ‘+XD XT” | toilet
term -F border =-metal)”; sleep 1; done.
Talking computers were the craze ofthe 80s, ente
espeak “Hello, this is Linux Mint”
computer repeat the text inside the quotes to you.
Make sure your volume is turned up, and try the following: 1s >
folders.txt && espeak -f folders. txt. This will have Mint
ead back the contents of the ls command,
8 Vow Search Terminal Help
Eee 8 (02"ing ASC Fire isn't the most useful command
tohave at your disposal, but i's Fun. Install t with
sudo apt-get install. Libaa-bin, then when installed use:
afr. i's not exactly warming but you get the idea. To expand
he above, enter: sudo apt-get install bb caca-utils,
hen, cacafire.
worm bdmpubleations.com
More Fun Things to do in the Terminal
M
Used as music demo from theo Amiga and
SPE) DOS days, the bb command reminds us of getting
hold of hee and shalFinchRoppies crammed ith all manner oF
We vealreadyinstaled Bo From te revs
step, sols enter bb Folow the onscreen structions and turn up
smoscene got
your volume,
Ts entyisintwo parts, Fistyou need to get
Sa?) id of the necessary packages: sudo apt~
get install Libcurses-perl, wen thats done enter ed
Downloads/ && wget. nttp://search.cpan.org/CPAN/
cuthors/id/K/KB/KBAUCOM/Term-Anination-2.4,¢or.92
84 tar “xf TemAnination-2.4,tar.gz 88 c@ Term
Anination-2.4/ Then:perl Nakefte,PL&& noke 88 make
test 88 sudo make install
With that tte lat done, onta the next. Enter: cd
= && wget http://w. robobunny..con/
projects/asciiquariun/asci iquarium.tar.gz && tar
=xf asciiquarium.tar.gz && cd asciiquarium1.1/
8& chmod +x asciiquarium Providing al went wel, enter «/
sci iquarium and enjoy your very own ASCI-based aquarium,
coding fortinnA Using the Terminal. )
Linux Tips and Tricks
As you've seen, the Linux Terminal is quite an exceptional environment. With a few
extra apps installed, and a smidgen of command knowledge, incredible, and often
quite strange, things can be accomplished.
TAKING COMMAND
There are countless Linux tips, secrets, hacks and tricks out there. Some are very old, originating from Linux's Unix heritage,
while others are recent additions to Linux lore. Here's our Favourite ten tips and tricks.
PITTED Eres. the texteditor isagreatpiece of A NMCETAM EMER Ever fancied being able
software, however, did you know it also browse the Internet from
Contains a hidden Easter Egg? With Emacs installed (sudo apt-get the Terminal? While nt particulary useful its quite a Fascinating
install emacs25), drop toa Terminal session and enter: thing to behold, To do so, enter:
emacs -batch -1 dunnet sudo apt-get install elinks
Dunnetisa text adventure written by Ron Schnell in 1982, and mini
hidden in Emacs since 1994, Enter the website you want to vst.
TT aD S25ed on the classic 1982 arcade came, FRMEENTSSNYR Snowing inthe Terminal console isnt
Moon Patrol, Moon Bugay appeared on something you come across every day. IF
the home computers of 1985 amid much praise. l'sacracking Atari you'reinterested, however, enter:
‘game, and t's available inthe Linux Terminal by entering RAKEEE TERE
sudo apt-get instal moon-bugay 1805483/raw/7d024716e0S7e69Fb52632Fee09F42
753361¢4a2/snowjob.sh
Then ‘chmod +x snowjob.sh
rmoon-bugay -/snowjob.sh
Enjoy. cea |
BB stock op itech series-Volume38Pee At Lee (30u need to see what apps.
consuming the most memory on
pS aux I sort =rnk 4
‘This sorts the output by system memory use
Linux Tips and Tricks
M
1c n the days of dial-up conne:
was made up of Bulletin Board Systems. These remote
servers provided hang-outs for users to chat, swap code, play games
and more, Using telnet in Linux, we can stil Connect to some acti
Bases:
telnet battlestarbbs.dyndns.org
here are countless operational 88Ses available, check out https://
www.telnetbbsguide.com/bbs/list/detaly, for more
BITS Whenyou delete afile, there's a chance of
someone with the right software being
to retrieve it. However, to securely and permanently delete ale,
use Shred
shred ~zvu NAMEOFFILE. txt
Replace NAMEOFFILE with the name of the file to delete.
Ferm 8S! acccan be quite striking when applied to
some images. However, it's often dificuleto
‘get ust right. You can create some great ASCII art from the images
you have by using ima2bxt:
‘img2txt NAMEOFIMAGEFILE..png
with the actual name of the
image File on your system. IF
img2txt install installed, use:
sudo apt-get install
caca-utils,
wn bdmpublcatonscom
IF you want to create an entre
directory (or Foldet) tree with 3
Dy reife) alta}
single command, you can use:
iikdir =p New-Dir/
{subfoldert, subfolder2, subfolder3, subfolderd}
This creates a NewDir with four sub folders within,
cevabaentins ewe
Reco C ALD snteey ving
to remember all the
available Linux commands. Thankfully, we can use apropos tohelp,
us. Simply use i, along with a description ofthe command:
‘apropos “copy files”
‘apropos “rename files”
coding fortinxVv
co
i
U0
Cc
oO
x
5
&
7DID YOU KNOW.
that Linuxis at the heart of the
ien ind
Collider? Using a
\le at CERN have developed
several different: their
‘own custom Linux distro to help
of the LHC. Most
table is SLC, or Scientific Linux
N, also known as CERNE
ding to report
cotter ————ZV) Using the Terminal >
Creating Bash Scripts
eee oie
Eventually, as you advance with Linux Mint, you'll want to start creating your own
automated tasks and programs. These are essentially scripts, Bash Shell scripts.
to be exact, and they work in the same way as a DOS Batch file does, or any other
Programming language.
GET SCRIPTING
‘A Bash script is simply a series of commands that Mint will run through to complete a certain task. They can be simple or
remarkably complex, it all depends on the situation,
ESTED Youll be working within the Terminal and with a ESTED Tobesin with, and before you start to wite any
text editor throughout the coming pages. There 1uneed to create a folder where you can
are alternativesto the text editor, which we'lllook at inamoment put all ourscriptsinto. Start with mkdir scripts, and enter the
forthe sake of ease, we'llbe doing our examples in Xed. Before folder cd_scripts/. This will be our working Folder and from here
you begin, however, run through the customary update check: sudo you can create sub-foldersif you want of each script you create
‘apt-get update && sudo apt-get upgrade.
Fle Edt View Seach Terminal Hei
le Et view Search Terminl_ Help
STEP2 EOC STEP 4
ab: ed, VI, Nano, Vim, GNU Emacs and
soon.inthe end i wn to personal preference. Our programming within t,t
iptinthe
dows users will be aware that in order fora
ch ile to work, asin be executed and follow the
Linux
Fle Edt View Seach Teil Hep
BB) stk op itech series-Volume 38