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

Creating Multiline Strings in JavaScript [With Examples]

Creating Multiline Strings in JavaScript

There are several ways to create text that spans multiple lines in JavaScript – so here they are! Method 1: Backticks This is the best method, so it goes first. It is only compatible with ECMAScript 6 and onwards, so it is only for use in modern browsers (really, if you’re using any browser that isn’t Internet Explorer, you should be fine, but you should always test your code on the browsers you want to target). var multiText = ` This is multiline text!`; console.log(multiText) // … Read more

Python Scatter Plots with Matplotlib [Tutorial]

Python Scatter Plots

Graphs are awesome. If you disagree, you probably shouldn’t read on. The best (and easiest!) way to create graphs and scatter plots in Python is using the package Matplotlib. This tutorial explains exactly how to do so. https://pypi.org/project/matplotlib/ What is matplotlib? I’ll let them introduce themselves in their own words: Matplotlib is a comprehensive library for creating static, animated, and interactive visualizations in Python. This article will give you a jump-start on using Matplotlib to create scatter plots. Install Python Dependencies First, you’ll need to install MatplotLib using … Read more

PHP var_dump() Function [With Examples]

PHP var dump Function

The PHP programming language includes various built-in variable types and allows you to create your own complex object classes. Third-party packages also come with their own object classes. So it’s useful to find out what type of variable a variable is, its value, and the type/value of any properties or values the variable may contain. The PHP var_dump() function returns a given variable or value’s properties, including the value and type. It works through the variable’s properties or value recursively doing the same. Read on to learn … Read more

Categories PHP

How To Fix Broken Packages in Ubuntu [Tutorial]

How To Fix Broken Packages in Ubuntu

Package managers like apt are one of the big selling points of Linux operating systems and Ubuntu – a vast curated collection of software that can do just about anything, available with a few keypresses. A vetted and (usually) reliable source of great software to meet any task. However, when something can go wrong, eventually it will go wrong. A package may only partially install or conflict with something else in your system environment. Maybe an update is pushed out that breaks an installation. When this happens, Ubuntu has a few … Read more

Setting up a LAMP Stack on Ubuntu 20.04 (And Raspberry Pi)

LAMP Stack on Ubuntu

This tutorial covers setting up a full LAMP (Linux, Apache, MySQL, PHP) web stack, including HTTP server, MySQL database, and PHP for app logic. This is commonly called a LAMP server – Linux, Apache, MySQL, PHP. Linux rules the web server world – the operating system powers the vast majority of web servers worldwide. Apache is a popular web server – the software with which web browsers connect to receive content. MySQL is a popular database server – it stores information in rows and columns inside tables. There is also a drop-in replacement … Read more

touch Command in Linux and Bash [with Examples]

touch Command in Linux

The touch command in Linux updates the timestamps on a file or creates the file if it doesn’t exist. See some examples and use cases below. It sounds useless, but it’s actually useful. For example, if you want to create an empty file called my_file.txt, you can just run: touch my_file.txt Easy! Updating the timestamps of a file is also useful. Say you have a file called favorite_tv.txt, which you use to keep the name of your current favorite TV show. Your favorite show 10 years ago was … Read more

What Does “./” (Dot Slash) Mean in Linux?

What Does Dot Slash Mean in Linux

In Linux, *./ (dot slash) represents the relative path to the current working directory. This article lays out exactly what it means and how to use it. . (dot) and .. (double-dot) . (single dot) and .. (double dot) are special directory names in Linux (And other *nix operating systems). . represents the current directory. .. represents the parent directory (of the current directory). ./ (dot slash) So, the . in ./ represents the *current& directory – and the slash is the path delimiter so that what follows will refer to the contents of the current directory. Example To edit … Read more

How to Install & Use Bash (Linux Shell) on Windows 10 [Tutorial]

bash for windows

Here’s how to set up and use the Linux shell on Windows – using the Windows Subsystem for Linux (WSL). This tutorial is intended for up-to-date versions of Windows 10 from 2020 onwards. I’m not going to cover how to use WSL on older versions of Windows 10 or other methods for Windows 8/7/XP/3.1 because you shouldn’t be using outdated software. If you must use Windows, use a version that still receives security patches! WSL is a great tool and allows you to pretty much run Linux software on windows … Read more

PHP strtotime() Function – Converting Text to Timestamp [With Examples]

PHP strtotime

The PHP strtotime() function takes a string containing text and converts it to a Unix Timestamp. Find out how to use this function in this guide. A Unix timestamp is a number representing the number of seconds since 00:00:00 UTC on 1 January 1970. From it, you can build more complex Date/Time objects which can readily provide Dates/Minutes/Hours/Seconds or other information about the supplied time. strtotime Syntax strtotime ($datetime , $baseTimestamp) Note that: $datetime is your supplied text string (possibly) containing a date strtotime() supports the English language only See … Read more

Categories PHP

Raspberry Pi & Python Powered Tank – Part II

Raspberry Pi Python Powered Tank Part II

This is part 2 of the Raspberry Pi and Python powered tank project. In this article, we attempt to display a live video stream and buttons to control the tank in a web UI. In the Last Episode In part 1, I gutted a toy tank and wired in a Raspberry Pi, and wrote some Python to make it move around. Now, to write a remote control interface that runs in a web browser, with a live video stream and buttons to control the motors. … Read more