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

How to Use if…else Conditional Statements in PHP [Examples]

PHP If...Else

Here’s a handy guide on using if/else/elseif conditional statements in PHP to execute code based on certain conditions. if/else statements are found in pretty much all programming languages. Computer programs need to perform actions based on a user selection, or the result of a calculation, or the value received from a sensor – and if/else statements are how this is programmed into the system. When building even the most basic programs, you’ll use them, so they’re worth getting to know. PHP Syntax There are several parts to an if … Read more

Categories PHP

Appending Items to a List in Python with append() [Examples]

Python - Append to List

This article will show you how to add items to a list in Python using the append() method. Lists are a type of Python variable that can hold any number of member elements. They’re analogous to arrays in other programming languages. Lists can be defined and altered in several ways: Using the Python ‘filter()’ Function to Filter a List, with Examples Using the Python ‘map()’ Function to Process a List, With Examples Python List ‘sort()’ Method – Sorting Lists in Python Easily How to Reverse a List in … Read more

How to Use the PHP echo Statement, With Examples

PHP echo

This quick tutorial will show you how to use the PHP echo statement to print/display information on screen. A computer program isn’t much good if it doesn’t display some output to the user. The echo statement prints a simple string of text in PHP – usually to the web browser. Syntax echo is a simple statement with a simple purpose – and it has simple syntax: echo expressions Note that: expressions should be one or more strings containing the text or characters you want to display on screen If more than … Read more

Categories PHP

Limit Column Values With The MySQL CHECK Constraint [Examples]

MySQL CHECK CONSTRAINT

This article will demonstrate the usage of the SQL CHECK Constraint to limit column values, as used in MySQL/MariaDB. The SQL CHECK constraint allows you to define limitations to the value which can appear in a table column. It also allows you to apply constraints to a whole table, letting you restrict a column’s values based on the values of other columns in the table row. This behavior is useful for making sure you are only getting valid data inserted into your database. For example, you might … Read more

Default MySQL/MariaDB Port, Finding It, Changing It

Changing the MySQL Port

This article will show you how to find the default or current MySQL (or MariaDB) port and how to change it. What is a Port? A port is a numerical identifier for a communication endpoint on a computer network. Or, put simpler, it’s a unique number on your computer that points to a specific program that is running so that other programs can connect to it. MySQL/Maria DB, being networked database services, expose themselves to other computers via a configured port, allowing other computers to connect to and … Read more

How to Use the which Command in Linux, With Examples

Linux which Command

This tutorial will teach you how to use the which command in Linux with some simple examples. The which command will tell you the path to the executable used by a command on the system if it exists. Why is this useful? Say you’ve got two copies of the MySQL executable installed on your system (installed via different means), and you want to know which one is actually in use so that the other can be removed – the which command can tell you which of the two is called when you execute MySQL on … Read more

How to Set/Change the Date/Time in Linux

Linux set time

This simple tutorial will show you how to view, set, or update the time and date on your Linux system. You may also want to check out our article on changing the timezone in Linux. Find out the Current Time and Date Before you change the time and date, it’s worth checking what it’s currently set to – it may already be correct! The following command will display information about the time and timezone as it is currently set on your system: timedatectl The returned … Read more

Beginners Guide: Create and Use JavaScript ES6 Modules

JavaScript Modules

This short tutorial aims to get you started creating and using JavaScript modules and provides some simple examples. What is ES6? JavaScript’s official name is actually ECMAScript, and version 6 introduced module functionality to create and consume modules, so you might see JavaScript Modules referred to as ES6 or ES2015 Modules. What is a JavaScript Module? As you get more adventurous with your JavaScript programming projects and your code becomes more complex, it might start to become harder to manage. One way of mitigating this is splitting … Read more

How to Set/Change the Timezone in Linux

Linux set timezone

This simple tutorial will show you how to view, set, or update the timezone on your Linux system. You may also want to check out our article on changing the date/time in Linux. Find out the Current Timezone Before you change the timezone, it’s worth checking what it’s currently set to – it may already be correct! The following command will display information about the time and timezone as it is currently set on your system: timedatectl The returned information will look something like this: … Read more

Guide to Renaming Multiple Files in Linux

Linux rename multiple files

This guide will show you how to rename multiple files in Linux – renaming files sequentially, changing the extension, adding the date, and other renaming tasks. We’ve already covered moving and renaming files and directories using the mv command. However, renaming multiple files at once is a bit more complex. While it can be done with the mv command, some tools are built specifically for the task. Read on to find out what those tools are and how they can be used. Each tool has differences in how the renaming … Read more