Home » Linux

Why You Should Wrap File Paths in Strings in Your Shell Scripts

Why You Should Wrap File Paths

I stumbled across a thread about terrible programming mistakes and found this: https://github.com/MrMEEE/bumblebee-Old-and-abbandoned/commit/a047be85247755cdbe0acce6f1dafc8beb84f2ac Which contains the line: rm -rf /foo-bar-usr /lib/nvidia-current/xorg/xorg Note – I’ve added foo-bar- to the string so that if you try to run it, it won’t do the thing I’m warning about –even having that on my clipboard makes me nervous!. What happens when it’s run? It wipes out the entire /usr/ directory – essentially bricking your computer! All because of a single space. Due to the space after /usr, the rm command interprets it as two separate directories … Read more

Home » Linux

Command Line Arguments in Shell/Bash Scripts [Tutorial]

Command Line Arguments in Bash Scripts

This tutorial explains how to pass command-line arguments to your bash scripts. There are many examples included to help get you started. Bash/Shell scripts are a great way to automate your Linux workflow and speed up your workday so you can leave the office early (or hide in the server room until 5 pm hits). Making scripts re-usable makes them more useful – you don’t need to write a script that does the same task for different sets of information or on different days – … Read more

Home » Linux

How To Fix Broken Packages in Ubuntu [Tutorial]

How To Fix Broken Packages in Ubuntu

Package managers like apt are one of the big selling points of Linux operating systems and Ubuntu – a vast curated collection of software that can do just about anything, available with a few keypresses. A vetted and (usually) reliable source of great software to meet any task. However, when something can go wrong, eventually it will go wrong. A package may only partially install or conflict with something else in your system environment. Maybe an update is pushed out that breaks an installation. When this happens, Ubuntu has a few … Read more

Home » Linux

Setting up a LAMP Stack on Ubuntu 20.04 (And Raspberry Pi)

LAMP Stack on Ubuntu

This tutorial covers setting up a full LAMP (Linux, Apache, MySQL, PHP) web stack, including HTTP server, MySQL database, and PHP for app logic. This is commonly called a LAMP server – Linux, Apache, MySQL, PHP. Linux rules the web server world – the operating system powers the vast majority of web servers worldwide. Apache is a popular web server – the software with which web browsers connect to receive content. MySQL is a popular database server – it stores information in rows and columns inside tables. There is also a drop-in replacement … Read more

Home » Linux

touch Command in Linux and Bash [with Examples]

touch Command in Linux

The touch command in Linux updates the timestamps on a file or creates the file if it doesn’t exist. See some examples and use cases below. It sounds useless, but it’s actually useful. For example, if you want to create an empty file called my_file.txt, you can just run: touch my_file.txt Easy! Updating the timestamps of a file is also useful. Say you have a file called favorite_tv.txt, which you use to keep the name of your current favorite TV show. Your favorite show 10 years ago was … Read more

Home » Linux

What Does “./” (Dot Slash) Mean in Linux?

What Does Dot Slash Mean in Linux

In Linux, *./ (dot slash) represents the relative path to the current working directory. This article lays out exactly what it means and how to use it. . (dot) and .. (double-dot) . (single dot) and .. (double dot) are special directory names in Linux (And other *nix operating systems). . represents the current directory. .. represents the parent directory (of the current directory). ./ (dot slash) So, the . in ./ represents the *current& directory – and the slash is the path delimiter so that what follows will refer to the contents of the current directory. Example To edit … Read more

Home » Linux

How to Install & Use Bash (Linux Shell) on Windows 10 [Tutorial]

bash for windows

Here’s how to set up and use the Linux shell on Windows – using the Windows Subsystem for Linux (WSL). This tutorial is intended for up-to-date versions of Windows 10 from 2020 onwards. I’m not going to cover how to use WSL on older versions of Windows 10 or other methods for Windows 8/7/XP/3.1 because you shouldn’t be using outdated software. If you must use Windows, use a version that still receives security patches! WSL is a great tool and allows you to pretty much run Linux software on windows … Read more

Home » Linux

Raspberry Pi & Python Powered Tank – Part II

Raspberry Pi Python Powered Tank Part II

This is part 2 of the Raspberry Pi and Python powered tank project. In this article, we attempt to display a live video stream and buttons to control the tank in a web UI. In the Last Episode In part 1, I gutted a toy tank and wired in a Raspberry Pi, and wrote some Python to make it move around. Now, to write a remote control interface that runs in a web browser, with a live video stream and buttons to control the motors. … Read more

Home » Linux

The Macintosh Pi – Vintage Apple Macintosh + Raspberry Pi!

Vintage Apple Macintosh Raspberry Pi

In this project, I will be putting a vintage Apple Macintosh to use with Linux and Raspberry Pi! My latest purchase. The Powermac G4. Stylish. Powerful (For 2001). Completely impractical in 2021. Why did I get it? Because it looks cool, and I really like the late 90’s/early 2000’s design of Apple’s hardware. It’s all translucent and cool. There’s still a lot of good software for these old macs – and the simplicity of them is kind of nice, so I thought – could I use … Read more

Home » Linux

What is the ‘#!’ in Linux Shell Scripts?

in Linux Shell Scripts

#! – Usually nicknamed shebang, shabang, hashbang, poundbang – we’ll stick with shebang for the duration of this article. It is found at the beginning of countless Linux shell scripts – but what actually is it? Let’s break it down. It Usually Looks Something Like This #!/bin/bash The #! appears at the beginning of the file, usually on the first line, followed by the path to an executable (in this case, the bash shell). It’s a Comment It starts with a #, so it’s not executed as part of the script itself – it does affect how the … Read more