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

What is $@ (Command Line Arguments) In Bash/Linux?

Bash $@

This article will explain what the $@ is in Bash and Bash/Shell scripting and how and why you might use it. The $@ variable is a special variable in Bash which holds the value of all of the command line arguments/parameters passed to the script. Command Line Arguments/Parameters in Bash Using command-line arguments/parameters in shell scripts is an important and useful feature, so we have a full article on it: This article follows on from our article on Command Line Arguments in Shell/Bash Scripts $@ Contains All Parameters/Arguments Passed to … Read more

Merge Tables in MySQL (UNION/MERGE TABLES) – Tutorial

MySQL Merge Tables

There are one of two things you might be looking for – merging two MySQL tables, or the MERGE TABLE syntax – this article explains both, with examples. Merging Tables in MySQL (Moving Data From One Table Into Another) A note before I get to the code – if you’re moving data from one table to another, you should take into account the contents of the data and ensure that it will still be valid when merged with the second data set. This is particularly important if … Read more

Find Large Files in Ubuntu/Linux (du/ncdu), With Examples

Ubuntu Linux Find Large Files

Running out of disk space? Here’s how to find large files in Ubuntu (and other Linux distributions) without any fuss using the du and ncdu commands. The du Command The du (Disk Usage) command does what it says it does – tells you about the disk usage of files in a given directory. du Command Syntax du OPTIONS PATH Note that: – OPTIONS is an optional space-separated list of options from the du command manual – OPTIONS will allow you to specify things like maximum and minimum file sizes to include, what unit to measure file sizes … Read more

PHP Validator – Safely Checking Your PHP Code Syntax Quickly and Easily

PHP Validator

This is a quick “now you know” article showing you how to validate your PHP code using PHP from the command line instead of using an online PHP validator. Online PHP Validators So, you’ve got some PHP code, and you want to check that it’s valid—a pretty common scenario. Maybe there’s a bug in it you can’t find; maybe your web host doesn’t allow you to view errors to debug. You probably just search for ‘PHP Validator’ and paste your code into the text box on … Read more

Categories PHP

Restarting the Network in Ubuntu [Instructions/Example]

Restart Network Ubuntu

If you’ve recently updated your network configuration or just can’t get things to connect, you may need to restart the networking services on your Ubuntu System to get things back up and running. Restarting the network is particularly useful if you’re recently updated your WiFi network details or changed your IP address or hostname. These examples will work for Ubuntu and should work for Ubuntu-based distributions like Pop!_OS and Linux Mint. Restarting the Network Service from the Linux Terminal/Command Line This is probably the solution you’re looking for … Read more

Linux diff – How to Show Differences and Make Patches, With Examples

Linux Diff Command

The diff command is an easy way to compare files or directories from the Linux shell. This article will show you how to use it, with some examples of common usage. The diff command performs a line-by-line comparison of two files or directories and outputs the differences between them. Why would you want to compare files or directories? You might have two files with the same name that look similar and want to see the difference between them. Comparing changes to the programming code in a project you’re … Read more

Recover Deleted Files in Ubuntu/Linux, With Examples

Ubuntu Recover Deleted Files

We’ve all been there (I’ve been there) – a file was deleted that shouldn’t have been. Here is how to attempt recovery on Ubuntu/Linux. with examples. Backup Your Files First up, keep backups of your files, and keep your backups up to date. The easiest way to recover a file is not to have to try to recover it at all – you can just go and retrieve it from your backup. No fuss. No stress. No praying. How Deleted Files are Recovered When a file … Read more

Show Privileges in MySQL/MariaDB using SHOW GRANTS, With Examples

MySQL Show Privileges

This article will show you, with examples, how to show what database privileges users have in MySQL and MariaDB. List All Users To show the privileges for a user, you need to be able to query the user’s name. Here’s how to generate a list of all users on a MySQL server: SELECT user FROM mysql.user; …and here’s how to list all users, with the host they are allowed to connect from: SELECT user, host FROM mysql.user; Both of the above queries pull information from … Read more

cat Command in Linux/Bash – How to Use It, With Examples

cat Command Linux Bash

The cat (concatenate) command in Linux/Bash is most commonly used to read the contents of a file. It outputs the contents of a given file. Here’s how to use it. cat concatenates files to standard output – by default, this is to the console for viewing on your computer screen. This makes it useful for quickly viewing the contents of files. It also has other uses, but first, the syntax: cat Syntax cat [OPTIONS] [FILE] Note that: If FILE is not specified, will read from standard input (stdin) Multiple FILEs can be specified, separated by … Read more

Running Ubuntu in VirtualBox on Windows/Mac [Tutorial]

Running Ubuntu In VirtualBox

Here’s a straightforward set of instructions (with lots of screenshots) on how to set up Ubuntu Linux in VirtualBox for running Ubuntu in a Virtual Machine on Windows 10 and macOS. VirtualBox allows you to set up and run virtual machines on your computer easily.  A virtual machine is a whole computer, virtualized running on top of your current operating system – allowing you to try out and experiment with new operating systems and tools without reformatting your computer. Download and Install Virtualbox The first … Read more