How Do You Save a Linux Machine where You Overwrote the PATH Variables Such That No Command Will Work?

Problem scenario
The server seems to be in a hopeless condition. You want to recover the server, but no commands in Linux are working. You get “command not found” with simple commands such as ls. You cannot use sudo, cat, rm, or reboot. What should you do?

Solution
Use absolute paths. For example, use this command:

/bin/sudo reboot

If there is a new file that is causing the problem,

In Python, How Do You Call a Function as a New Thread with the threading Module?

Problem scenario
(The old problem scenario was “You want to write a program to call a unbound function in a new thread with the threading module. How do you do this?”)

You want to write a program to call a function in a new thread with the threading module. How do you do this?

Solution
Run this program (e.g.,

How Do You Examine an .xz File in the /var/log Directory (with No “tar” in Its Extension)?

Problem scenario
You have an mail.xz file in /var/log/ that has nor “tar” in its name. You want to view its contents. What do you do to view or use an .xz file with no “tar” in its name?

Solution
If you are new at this, copy the log to the /tmp/ directory (assuming this .xz file has no sensitive data or no one else uses this server).

How Do You Create and Store an Application-Level Secret on the AWS Cloud?

Problem scenario
You want to create and save an application-level secret in AWS. What do you do?

Solution
Use Secrets Manager.

Procedures

  1. Log into the AWS console.
  2. Go to “Secrets Manager”
  3. Click “Store a new secret”
  4. For the secret type choose “Other type of secrets”.
  5. For the left-most field,

When Does the DNS Server Override the /etc/hosts File for FQDN or Domain Name Resolution?

Problem scenario
You notice that on some Linux servers the /etc/hosts file controls the resolution of hostnames and on other servers the DNS server overrides the /etc/hosts file. Which has precedence in DNS resolution, /etc/hosts or the DNS server on the network?

Answer
It depends. The /etc/nsswitch.conf file will decide. There is a “hosts” stanza. This setting will have the DNS server override the /etc/hosts file:

hosts:dns files

This setting will have the /etc/hosts file take precedence for name resolution:

hosts:files dns

To get the hostname,

How Do You Fix a Mouse That Scrolls in a Different Direction Than It Is Supposed To?

Problem scenario
Your mouse scrolls up when you use the scroll wheel to scroll down. What should you do?

Solution
Is the problem reproducible on two different computers? If the problem stays with the mouse you may need to dis-assemble it and clean it. You may need a can of air and a small screwdriver. If you see no screws on the bottom of the mouse,

How Do You Get a PHP Program to Invoke a Python Program via Browsing a Website?

Problem scenario
You want Debian/Ubuntu Linux to support a website. You want a Python program to run every time a web page is downloaded. How do you get a PHP program to invoke a Python program on Debian/Ubuntu Linux?

Solution

Prerequisites
i. This assumes you have Apache2 and PHP installed. If you need assistance run this: sudo apt -y install apache2 php
ii.

Why Cannot You List Every Repository in Your GitHub Organization’s Account?

Problem scenario
You are trying to list the repositories in your GitHub organization with the REST API. You run something like this:

curl -u $username:$password https://api.github.com/orgs/$ORGNAME/repos

But as you add repositories, all are not showing. What is wrong?

Possible solution
Do you have more than 30 repositories? The output of the curl (GET REST) invocation can be the same as you add repositories if you exceed 30.

How Do You Remove the ECDSA Fingerprints of Old Servers That You Will Not Connect to Again?

Problem scenario
You have a server that has run SSH to connect to other servers. You want to remove the fingerprints so the ECDSA key fingerprint will challenge a user to continue connecting. What do you do?

Solution
Run this command where x.x.x.x is the IP address or hostname of the server whose finger print should be removed: ssh-keygen -R x.x.x.x

If you used a hostname with the SSH comands,

How Do You Create an Issue for a Repository in a GitHub Organization the API?

Problem scenario
You are running this command:

curl -u jdoe:$password -X PUT -d ‘{“title”: “Look at this bug”, “body”: “This is a serious problem here.”, “assignees”: [ “jdoe” ], “milestone”: 1, “labels”: [ “bug” ]}’ https://api.github.com/repos/$orgname/$reponame/issues

The message in the response you receive is “Not Found”. You found documentation that refers to an “owner” being in the URL. You see “POST /repos/:owner/:repo/issues” (with no reference to the organization).