Welcome to LinuxScrew

A site for Linux lovers worldwide. For newbies, system engineers, administrators, and everybody in between. We cover all things Linux, plus various programming languages, including Python, Javascript, and PHP.

View our featured tutorials and projects in the slider below or scroll down to see all recent articles.

How to Convert a USB Printer to Wireless with a Raspberry Pi
How to Use a Raspberry Pi for Digital Signage
The Worst Things You’ll Probably Google As a Programmer on Linux
How to Build a Raspberry Pi Internet Kiosk
Browsing the Internet on a 1989 Macintosh II with a Web Rendering Proxy
previous arrow
next arrow
Slider

Linux: Set Which Network Connection You Get Internet From [Default Route]

Linux set default internet route

This quick tutorial will show you how to set which network Linux uses to access internet when multiple networks are connected by setting the default route. If you have a Linux device (for example a Raspberry Pi) connected to multiple networks (like being connected to a wireless and wired network simultaneously), you might have trouble connecting to the internet. That’s because Linux will have automatically set up some default routes, and will have somewhat arbitrarily picked which interface it tries to use to access the internet … Read more

Using PHP sleep() and usleep() to Pause Execution [Examples]

Pausing PHP with sleep and usleep

This short tutorial will show you how to use the PHP sleep() and usleep() functions to pause script execution for a number of seconds/microseconds, and provide some code examples. The PHP sleep() and usleep() functions both pause execution of the script, but both behave a bit differently. Why Pause/Sleep PHP Script Execution? Delaying, sleeping, or pausing PHP script execution is commonly used when scheduling an event. A call to the sleep() function might be placed at the end of a loop, so that after the code inside the loop has been run, a certain amount of time … Read more

Categories PHP

How to Use Single/Multiline Comments in your PHP Code

PHP Code Comments

This article will quickly walk you through how to comment your PHP code with single and multi-line comments. What is a Comment? A comment in programming is one or more lines of text that aren’t interpreted as programming instructions. Instead, the computer skips the commented lines when executing your code, completely ignoring them. Comments don’t have to conform to any valid syntax. They’re just text that you read, and the computer doesn’t. Comments can span single or multiple lines. Single Line Comments Single line comments are any lines of … Read more

Categories PHP

How to use the JavaScript ‘while’ Loop, With Examples

JavaScript While Loops

This article will show you how a JavaScript while loop is constructed, and what it us used for, with code examples. While loops are one of the simplest kinds of loops, and appear in most programming languages. A while loop runs a block of code repeatedly, until a condition is met. When the while condition is met, the loop stops. It’s important to get comfortable with using loops – and understanding how they work – as they form the backbone of just about every game and application you might write. Make sure you’re familiar … Read more

JavaScript Print – To the Console, WebPage, or a Printer [Examples]

JavaScript Print to Printer, Console, Page

You’ve searched for ‘JavaScript Print’ – so you’re probably trying to output data to the console, to the webpage or to a printer. Here’s how to do all three. Printing to the Console with console.log() The JavaScript console.log() method prints data to the JavaScript console (visible in your browsers web inspector). Any type of data can be logged to the console, including strings, numbers, arrays, and objects, and either the contents of, or a text representation of, the value will be displayed. console.log() is frequently used for debugging – developers use it to view … Read more

DIY Raspberry Pi Chopping Board HomeLab

Raspberry Pi Chopping Board Lab

Here’s an odd solution I came up with to deal with the tangled mess that is my Raspberry Pi HomeLab – mounting it on a cheap kitchen chopping board. There’s not a lot more to be said for it really – it’s a Raspberry Pi attached to a chopping board. But why? I noticed that the micro-HDMI connection to the Pi was getting wonky – every time I shifted things around force was applied to the tiny connector.  I wanted to mount the Pi and … Read more

JavaScript Escape Quotes / Escape Strings [Examples]

JavaScript Escape Quotes

This article will explain how to use escape characters to escape quotes in strings in the JavaScript programming language, with some examples. What is a String Variable in JavaScript? A string is a type of variable. It represents a series of zero or more characters. Other variable types are numeric, boolean, and array variables. A variable’s type defines what values it can hold and what can be done with it. For example, string variables can be split and joined to form new strings, and numeric variables can have mathematical operations … Read more

How to Use the JavaScript ‘do while’ Loop, With Examples

JavaScript do while loops

This article will show you how a JavaScript do while loop is constructed, and what it us used for, with code examples. do while loops are one of the simplest kinds of loops, and appear in most programming languages. A do while loop runs a block of code repeatedly, until a condition is met. When the do while condition is met, the loop stops. It’s important to get familiar with using loops – and understanding how loops work – as they form the backbone of just about every game and application you might … Read more

DietPi – A lightweight Raspberry Pi OS Alternative

Diet-Pi - A lightweight Raspberry Pi OS Alternative

Here’s a quick screenshot walk-through of the installation of DietPi OS for Raspberry Pi.  DietPi is a minimalist but fully featured alternative to Raspberry Pi OS.  I’ve run through the install process so that you can see how everything looks before trying it yourself. Previously, we covered TwisterOS – another Raspberry Pi targetted Linux distribution  which aims to be super user friendly and includes a lot of extra software – check it out if you don’t think the minimalist DietPi is for you. Download & … Read more

How to change DNS servers on Linux (Ubuntu/RedHat/All Distros)

How to change your DNS servers on Linux

Here’s a quick tutorial for a simple but important task – manually setting the DNS server on your Linux system. The steps in this tutorial should work for all Linux distributions – both server and desktop. Manually setting your DNS server is particularly useful if you’re setting up a Pi-Hole ad blocker. Backup Existing DNS Configuration If an existing manual DNS configuration exists, back it up by copying it to a new file: sudo cp /etc/resolv.conf /etc/resolv.conf.bak Edit Linux DNS Configuration The nano text editor … Read more