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

Converting Variable Types in Python, Howto, With Examples

Python Type Conversion

This article will show you how to use Python’s built-in variable conversion functions, with examples. A variable’s type determines what kind of data it can store and what can be done with it. For example, string typed variables contain sequences of characters that can be joined and split (think words and sentences). In contrast, numeric typed variables contain numeric values intended to be used in calculations. Being able to convert a variable’s type allows data to be used in different ways. Converting a Variable to a … Read more

Print an Array in PHP using print_r and var_dump, With Examples

PHP Print Array

This article will show you several methods on how to print an array in PHP, with some examples. Arrays in PHP can be processed using foreach loops to interact with each element in the array. This article focuses on directly printing an array in full rather than each element individually. Using echo to Print an Array (It Won’t Work) You might think that you can just use the echo statement to print an array in PHP – this is not the case, as seen below: <?php // Define an … Read more

Categories PHP

Linux clear Command and Clearing Shell/Terminal Screen

Linux clear Command

This article will show you how to use the Linux clear command to clear the terminal screen. Quick and easy! Clearing the Terminal/Shell Screen If you’ve been executing a bunch of commands from your Linux terminal, things can start to look a bit cluttered. It would help if you could clear the screen of previous output and commands and have a fresh start. That’s what the clear command is for. clear Command Syntax Here’s the syntax for the clear command: clear Pretty simple. There are a couple of options to change … Read more

Linux man Command and Man Pages [Explanation/Examples]

Linux man Command

This article describes the purpose and usage of the man command in Linux and other Unix-like operating systems. Linux is a highly modular operating system, consisting of the core operating system (the Linux Kernel) and a collection of software packages that add functionality to it. These packages are generally individually maintained. Thus, each computer system will have different packages depending on what the user requires their system to do (for example, a graphic designer will have some drawing tools installed, whereas someone writing a novel may instead … Read more

How to use the Linux locate Command, With Examples

Linux locate Command

Here’s another tool for your Linux file searching toolbox – the locate command. This explains how to use it. The locate command is specifically made for finding files and folders by their name. It’s easy to use and can search for files using patterns. This is helpful if you are looking for files with a specific type/file extension. Installing locate locate may not be installed by default on your system. To install on Debian/Ubuntu-based distributions, run: sudo apt install mlocate Or on Redhat/CentOS/Fedora: sudo yum install mlocate Linux locate Command Syntax The locate … Read more

How To View and Create Hidden Files in Linux

Linux hidden files

Hidden files are files that are, well, hidden. Here’s how to find and view them on Linux-based Operating Systems. Hidden Files? Hidden files are hidden from view by default unless otherwise specified. Why would you want some files to be hidden? Usually, they are configuration files. You don’t really need to see them during your day-to-day tasks; they’d just clutter things up and get in the way. Your home directory, which includes all of your user files, has several hidden files and folders in it. These include … Read more

Check Type of Variable in JavaScript with typeof [Examples]

JavaScript typeof Operator

This article will explain JavaScript variable types and how to find the type of a variable using the typeof operator. The typeof operator is quite similar to the instanceof operator – but they do not function the same way.  instanceof returns TRUE or FALSE when checking if a variable is of a certain type, whereas typeof returns the name of the type. What are Types? The type of a variable determines what it can or can’t do. It determines what value the variable may take and … Read more

How to Count Files in a Directory in Linux/Ubuntu

Linux Count Files in Directory

This tutorial will show you how to count the number of files/folders in a directory on Linux, both recursively and non-recursively. The wc Command The wc (word count) command counts lines and words. It’s useful here as we’ll use it to count the outputted lines from various tools which list the files in a directory or directories. The below examples will show you how to use the wc command to count files. If you want to know more about it, you can check out the full user manual by running: man … Read more

How to use the JavaScript trim Method, with Examples

JavaScript trim

This easy tutorial will show you how to use the JavaScript string trim() method and give some example usage. The trim()* method is available to any string type variable in JavaScript. It removes any white space (spaces, tabs, newlines) found at the beginning and the end of the string. Why is this useful? Sometimes you wind up with a bunch of un-needed white space padding your strings – often from the end-user hammering the space key when a space isn’t required. Unnecessary white space can also occur after splitting … Read more

How to Get the Last Item in a JavaScript Array [Quick Tip]

JavaScript - Get last item in array

This quick article will show you how to get the last item in an array in the JavaScript programming language. Arrays and Array Indexes in JavaScript Arrays are an ordered list of items. Each item in the array has a numerical index that defines its permission in the array. The first index is index 0 (indexes start counting at 0, not 1!), so the last index is the array’s length; subtract 1. Getting the Last Item in an Array So, to get the last item in an array, we just … Read more