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

Hash Tables/Associative Arrays in JavaScript – How and Why?

JavaScript Hash Tables

JavaScript does not have a native object class called a “hash table” – but that doesn’t mean that the functionality of hash tables doesn’t exist in the language. Here’s how to use hash tables in JavaScript, with working example code. What is a Hash Table? Also known as hash maps, hash tables are a data structure which maps a list of keys to a list of corresponding values for each key. Any value in the table can be retrieved by accessing it through the associated key. … Read more

LinuxScrew’s Linux Shell/Bash Scripting Tips

Bash script hot tips

Here are some handy tips to keep in mind when writing your shell scripts in Linux. Shell scripts are a versatile way to automate your workflows in Linux (and MacOS, and now Windows, with the Windows Subsystem for Linux). Shell scripting syntax and behaviour does have its quirks, and there are useful shortcuts you can take as well to simplify your scripts. Bash Scripting Tips These tips are collected from around the internet, with a few of my own thrown in. Bash scripts will keep … Read more

How to Generate the Fibonacci Sequence of Numbers in Python

Python fibonacci sequence

This quick tutorial will show you how to generate the Fibonacci sequence of numbers in Python. This is a useful example for new coders and those just learning Python as it shows how variables, loops, and arithmetic are used in Python. What is the Fibonacci Sequence The Fibonacci sequence is a procession of numbers in which each number is the sum of the preceding two numbers. 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144… Above, the first 13 numbers in the Fibonacci … Read more

Linux Tip: Free Self Hosted Cloud Desktops Using Linux and TailScale

Free cloud desktops

This article will show you how to build your own cloud desktop environment. Virtual desktops have become a popular way to make your work space portable. You can leave all of your applications running in the cloud, and log into your desktop from anywhere and resume work. Here’s how you can build your own cloud desktops, for free. Google, Amazon, Microsoft, and other vendors all provide cloud-based virtual desktop solutions, but the costs can quickly add up. By using a VPN and some virtualisation software, … Read more

How to Install and Use Netstat on Linux (CentOS/RHEL, Debian/Ubuntu, OpenSuse & Arch Linux)

How to Install and Use Netstat on Linux

This article provides a tutorial on how to install and use Netstat, a command-line network tool, on Linux. Netstat is a command-line utility that can be used to view network connections, routing tables, and a variety of other network-related information on Linux systems. While Netstat is typically used to troubleshoot network issues, it can also be used for tasks such as monitoring server traffic or checking which ports are open on a system. Why Use Netstat? Netstat is a network monitoring tool that can be … Read more

Converting String to Boolean in JavaScript, With Examples

JavaScript string to boolean

This tutorial will show you how to convert a string value to boolean in JavaScript, with working code examples for several situations. Why Are You Converting Strings to Booleans? Really, you should not be storing boolean data in a string, but there are several scenarios where it can arise: Boolean values arising from user input Values taken from HTML form elements, which can only contain string values Data taken from poorly formatted third party sources, like APIs or CSV files Once you have data containing … Read more

Using the JavaScript toUpperCase() String Method [Examples]

JavaScript toUpperCase()

This article shows how the toUpperCase() method is used in JavaScript to make all letters in a string UPPER CASE. The toUpperCase() method is included in the string object and is fully supported in all browsers. In the JavaScript programming language, strings can either be a primitive or an object – primitives are the most basic kinds of variables – they have no methods, and simply represent the raw data for the given characters. String objects, however, have additional methods for manipulating and measuring the string – the toUpperCase() is one of these helpful methods. String variables in … Read more

Linux Tip: Using visudo to Avoid Costly Mistakes

Linux visudo

Linux Tip: Use visudo to Edit the sudoers File to Avoid Costly Mistakes This article will show you how to use visudo to edit the sudoers file to grant root access to users – and protect against making mistakes that could lock you out of your Linux system forever. What is the sudoers File? The sudoers file defines which users have access to the sudo command on Linux systems. The file is located at: /etc/sudoers …and it looks like this: # # This file MUST be edited with the ‘visudo’ command as root. # # … Read more

How to Create and Use JavaScript Classes [Examples]

JavaScript Class

This tutorial will explain JavaScript classes and how they relate to objects. Syntax and code examples are provided. But first, a quick refresher on JavaScript objects. JavaScript Objects In JavaScript, objects are a container for a set of properties and methods. A car, for example, could be modelled as an object. It could have properties describing the manufacturer, year it was made, and the colour. Methods are functions which are part of the object, which when called, interact with the object in some way. A car might have a honk method which triggers an alert, … Read more

How to Check if a Variable is a String in JavaScript

JavaScript Check if String

This quick tip will show you how to check if a variable is a string in the JavaScript Programming Language. What is a String? A string is a type of variable. A variable type determines what values a variable can contain and what can be done with the variable. Strings are a series of characters – letters or numbers or symbols. They can be joined, split, and iterated over. Strings are used to store words, sentences, and other non-numeric data like encoded images or serialized data which is going … Read more