Home » 2021 » May

Array Variables in Bash, How to Use, With Examples

Bash Array

We’ve covered using variables in Bash previously – this article will explain Bash array variables and provide some example usage. What is an Array An array is a type of variable that can hold multiple values. It’s a list of values you can loop through and perform operations on each individual value. For example, you might want to perform an action on a list of files. By storing that list as an array, you can loop through the file names in it and perform the action on each … Read more

Home » 2021 » May

Using The isNaN() Function in JavaScript, With Examples

JavaScript isNan()

isNaN() is a JavaScript function that will tell you whether a value is equal to NaN – or Not a Number. It can be used to determine whether the result of a mathematical operation is valid or not. Here’s how to use it. What is NaN? NaN is a special value that means Not a Number. It means that a value that should be a number could not be parsed as a number. Any mathematical operation between any other value and NaN will result in NaN. It usually means something has … Read more

Home » 2021 » May

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

Home » 2021 » May

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

Home » 2021 » May

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

Home » 2021 » May

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

Home » 2021 » May

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

Home » 2021 » May

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

Home » 2021 » May

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

Home » 2021 » May

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