Home » Articles by: Brad Morton

How to Write to a Text File in Python

Python Write File

This article will show you how to write to a file in the Python programming Language – examples included! All files are, essentially, text files. Data is formatted and stored in various ways – comma-separated values for spreadsheets (CSV), plain text for text files (TXT), all the way to complex image formats for storing documents and images like PDF and JPG files. Once the program you are building is up and running, you’ll want to be able to save the output it produces – so … Read more

Home » Articles by: Brad Morton

Linux for Kids – Distributions, Fun Tools, Games & Learning

Linux for Kids

Want to keep the kids busy over the holidays? Get them interested in computing. It’ll keep them busy for the rest of their lives. Computing is a huge field that covers many different subjects and skills – programming, digital art, music-making, engineering – and understanding computing concepts is increasingly important, and it opens the way for learning about just about anything else one might want to learn. A computer can’t just be a tablet playing youtube videos – kids need to be able to understand … Read more

Home » Articles by: Brad Morton

HEREDOC (Here Documents) in Bash and Linux Shell – Tutorial

Bash Heredoc

This article will show you how to use a Heredoc (Here Document) in Bash/Shell scripts to work with multi-line text. Heredocs are most useful for accepting multi-line input- the user can enter a line of text, press enter, then enter the next line, and so on. It can also be used to define multi-line text in scripts. It can also send multiple commands into an interactive program – this will be shown in the examples later. The examples in this article will work in both … Read more

Home » Articles by: Brad Morton

Check Disk Health in Linux/Ubuntu [How To / Guide]

Linux Check Disk

Concerned that you have a failing hard drive? Make a backup. Then, use these Linux tools to check your disk/drive. Not concerned that you have a failing drive? Back up anyway. It could be failing, and you don’t know it. Or it could get stolen. Or a meteorite could hit it. Back. Up. Your. Files. What is SMART? S.M.A.R.T. (Self-Monitoring, Analysis, and Reporting Technology) is the system most hard disks use to report their health to the installed system. This information can be queried to find out whether a drive is … Read more

Home » Articles by: Brad Morton

Using the printf Command in Bash/Shell, With Examples

Bash printf Command

This article will show you some practical examples for using the printf command in the Bash/Shell on Linux. The printf command outputs text much like the echo command does – but it allows for more control over the output formatting. It’s a useful tool for generating your own formatted text output – especially if you need to embed variables in text, include newlines, align and format text, and even display converted values. printf Syntax The printf command has the following syntax: printf [-v var] format [arguments]… Note that: The -v option … Read more

Home » Articles by: Brad Morton

How to Prompt for User Input in Bash/Shell Scripts

Bash Prompt For Input

This short tutorial will teach you to prompt the user for typed input from your Bash/Shell scripts. It’s easy to learn, easy to do, so read on! The read Command To read user input in shell scripts, use the aptly named read command. It has the following syntax: read OPTIONS VARIABLES Note that: The read command will read a line from standard input and split that input into fields Usually, standard input is the terminal with input from your keyboard, but you can also pipe or redirect input to the read command From the users perspective, they will … Read more

Home » Articles by: Brad Morton

How to Run a Program or Command On Login in Linux

How to Run a Program or Command On Login in Linux

This article will show you how to set up a command to run automatically each time you (or any user) log in on the Linux operating system. Several tasks may be useful to run on login – perhaps you want to connect to a network share or mount a USB drive each time you log in. You might even want to write a script that emails someone to let them know you’ve arrived at work safely and have it sent automatically when you log in. … Read more

Home » Articles by: Brad Morton

How to Run a Script/Command on Startup on Linux/Ubuntu

How to Run a Script/Command on Startup or Login on Linux/Ubuntu

Want to run a program, command, or script when you start or log into your Linux OS? This article will show you how. Running Scripts on Startup with Crontab The best way to run a command whenever your system starts is using crontab. cron is the job scheduler used by Linux to schedule the execution of tasks. The crontab is the text file where those tasks are defined. There is a system-wide crontab file, and each user also has their own individual crontab file for scheduling their own tasks. Adding a System-Wide Startup … Read more

Home » Articles by: Brad Morton

Office Software for Linux/Ubuntu – What are the Options?

Office For Linux

This article will cover some options for office productivity software for Linux. Microsoft Office dominates the office productivity space – it’s the industry standard. If you’re in business, other businesses probably expect to be able to send you an Excel or Word file and for you to be able to view or edit it. Microsoft Office, of course, does not run on Linux (unless you want to run an ancient version under emulation). It’s also not open-source or free. Here are some of the best alternatives … Read more

Home » Articles by: Brad Morton

Python 2 vs Python 3 – Which Should I Be Using?

Python 2 vs Python 3

There are still many tutorials and resources online that are written for Python 2 rather than the newer Python 3 – So, which should you be using? The short answer is below: Python 3. Why You Should Use Python 3 Python 3 is better in every way. It is a major revision that was released almost a decade after Python 2. The smart people who build programming languages probably learned a lot of lessons in that time. The syntax in Python 3 is more consistent … Read more