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

Python time.sleep() to Pause, Sleep, Wait or Stop a Python Script

Pause Sleep Wait or Stop a Python Script

There is a useful function in Python called ‘sleep()’. It’s part of the ‘time’ module and allows you to pause, sleep, wait, or stop a Python script or application. Python can be used to make useful command-line tools to streamline your workflow, but sometimes you need to wait for the user, or for a pre-defined amount of time. For example, you may want to prompt the user to press a key when they have finished reading instructions or give them time to override a default … Read more

Python List ‘sort()’ Method – Sorting Lists in Python Easily

Sorting Lists in Python Easily

In Python, there’s an easy way to sort lists: using the sort() method. This tutorial explains how to use sort(), with examples. We’ve covered the following in Python: Removing list items Checking if items are in lists Finding items in lists Now it’s time to find out how to sort a list. Syntax for the sort() Method list.sort(reverse=True|False, key=sortFunction) Note that: ‘reverse’ should be a True/False boolean value and is optional reverse=True will sort the list descending The default is reverse=False True/False values case sensitive in Python! … Read more

Python: Find in a List and Return Values [using ‘filter’]

Python Find in a List and Return Values

This tutorial explains how to find items within a list in Python and return the values, using “filter”. Previously we covered checking whether items exist in a list in Python, but that could only tell us whether they were present, or not (with a boolean return value containing the result). If you are searching a list for a specific value, you already know what the value of the matching items will be so the above method is sufficient. However, what if you are searching by a set of … Read more

PHP trim() Function [With Examples]

PHP trim Function

You’ll want to process and tidy your user input before you do anything with it when building PHP apps. trim() is one of the tools available to do this – it removes all white space from the beginning and end of a string. Whitespace is things like spaces, tabs, and newlines which may be invisible to the user. PHP trim Syntax trim ( $string [, $character_mask = ” \t\n\r\0\x0B” ] ) Note that: By default, $string will be returned by trim() with all whitespace removed from the beginning and end, including: … Read more

Categories PHP

Raspberry Pi Alternatives [2021] – 8 Best Single Board Computers

Raspberry Pi Alternatives

The rise and rise of the Raspberry Pi’s popularity – as a home server, media box, emulation machine, or maker platform – has led to a host of imitators, and in some cases, successors. Finding the right single-board computer for your project will make development easier- so here’s a summary of some of the single-board computers getting about in 2021. 8 Best Alternatives to the Raspberry Pi We’ll only include boards with built-in memory and video out – all in one single board computers and … Read more

Using JavaScript ‘toLowerCase()’ String Method [with Examples]

JavaScript toLowerCase

Want to make a string all lower case in JavaScript? It’s the toLowerCase() method to the rescue! The toLowerCase() method is part of the string object and has full support in all browsers. In JavaScript, strings can either be a primitive or an object – primitives are the most basic kinds of variables, which are not objects, have no methods, and simply represent the given characters. However, String objects have useful methods for manipulating and measuring the string – like toLowerCase(). By default, JavaScript’s string variables are initialized as primitives – but will be automatically … Read more

How to Install Pip/Pip3 for Python [Simple Guide]

How to Install Pip3

This tutorial will teach you how to install pip3, the package manager for Python, on Ubuntu Linux. Pip is a Python Package Manager. It’s currently at version 3 – hence, Pip3. Python is useful on its own, but it’s even more useful when you can start leveraging other people’s pre-written code. The default repository used by Pip is the Python Package Index (PyPI) (https://pypi.org/). PyPI contains a collection of other users’ code for performing a multitude of tasks, from drawing graphs to artificial intelligence. Checking if Pip is Already Installed … Read more

How to SSH Into Your Raspberry Pi Remotely [Simple Guide]

How to SSH Into Your Raspberry Pi

Here’s a summary of the options available for connecting to your Raspberry Pi via SSH – from Linux, macOS, and Windows. Networking We’ll assume you have your Pi on your network – wired or wirelessly. Static IP Address vs DHCP Your Raspberry Pi will most likely be configured to receive an IP address via DHCP (Dynamic Host Configuration Protocol), which means your router assigns an available address to your Pi. As it’s assigned automatically, you won’t know what it will be in advance. If you’ve … Read more

GitLab vs. GitHub: A Simple Comparison

GitLab vs. GitHub

What is Git? Git is a Version Control system that allows you to track the changes you make to files stored in a repository. Git is most commonly used by programmers to store and track changes to their code, but is also used for tracking changes and progress on other text files or data sets – for example, it has become popular with Ph.D. students use it to store and manage the writing of their thesis’, and with authors writing complex books with many revisions. Terminology Here’s a quick … Read more

Listing Databases and Tables in MySQL and MariaDB

mysql mariadb list databases tables

This guide explains how to list databases and tables using MySQL or MariaDB using simple commands. Managing your databases from the Linux shell is quick and efficient compared to some of the bloated database management tools available. Here’s a quick primer on seeing what databases and tables you’ve got set up on your MySQL or MariaDB server. Listing Databases Once you’ve logged in to your database, simply enter the following to list your databases: SHOW DATABASES; You’ll get a list of all of the databases … Read more