ShellHacks
43 subscribers
170 links
www.ShellHacks.com | Command-Line Tips & Tricks
Download Telegram
🌐 Home Assistant: LG webOS TV Turn On (Wake on LAN)

LG webOS TV is perfectly integrated with the standard Home Assistant's media player.

However, since some update you may not be able to turn on your LG webOS TV.

Luckily, this issue can easily be solved using vanilla Home Assistant (HA) and Wake on LAN (WoL) integration.
πŸ“– Continue Reading
πŸ‘3
🌐 SSH into Home Assistant using Terminal & SSH Add-on

SSH access to Home Assistant (HA) can be useful in multiple cases:


To reboot HA remotely if this cannot be done through the web interface
To edit some configuration files
To debug OS-related issues - check logs, processes, network settings, etc.
To install or update additional packages or dependencies
To backup or restore HA


The easiest way to SSH into Home Assistant is by using the official Terminal & SSH add-on.

It is based on OpenSSH and allows to log into Home Assistant using a web-based Terminal or any SSH client.

This post describes how to install and configure the Terminal & SSH add-on to access Home Assistant over SSH.
πŸ“– Continue Reading
πŸ‘2
🌐 ArgoCD: Reset Admin Password

Are you getting "Invalid username or password" while trying to log in to ArgoCD as admin?

In this article, I'll walk you through the process of resetting the ArgoCD admin password.

Whether you've forgotten the ArgoCD admin password or need to update it for security reasons, these clear instructions will help you get back in control.
πŸ“– Continue Reading
🌐 Git – Change Remote URL

When managing a Git repository, there are several scenarios where updating the remote URL becomes necessary:


Repository Migration: When moving the repository to a different location or hosting service, the remote URL needs updating.
Switching Protocols: Developers may switch from HTTPS to SSH for security or convenience.
Ownership Changes: If the username or ownership of the repository changes, the URL must be updated.


To update the remote URL in Git, you can use the git remote set-url command.
πŸ“– Continue Reading
🌐 MikroTik: NordVPN Setup

MikroTik routers support many VPN services, including NordVPN.

Starting from RouterOS v6.45, it is possible to establish IKEv2 secured tunnel to NordVPN servers using EAP authentication.

Learn how to set up NordVPN on your MikroTik router for enhanced privacy and security.

Follow these simple steps to safeguard your network traffic and enjoy seamless protection.
πŸ“– Continue Reading
🌐 Kubectl: Add Label to Kubernetes Node

Labels in Kubernetes are used for attaching meta tags to different resources, including nodes.

This helps to organize the nodes and allows to select specific subsets of nodes.

By adding labels to Kubernetes nodes, we can have more control over the resources that we create.

For example, we can make Kubernetes to schedule specific deployments onto nodes with the specific labels only.

In this post I will show how to get, add, overwrite and delete labels from Kubernetes nodes using the kubectl command.
πŸ“– Continue Reading
❀1
🌐 K8s: Spread Pods Evenly on Nodes in Different Zones/Regions

Kubernetes automatically spreads Pods for workload resources (such as Deployment, StatefulSet, etc.) across different Nodes to reduce the impact of failures.

In a multi-zone (multi-region) Kubernetes cluster it is required to ensure that Kubernetes will place the replicas of a Pod on the Nodes in different zones, to reduce the impact of zone failures.

In this note I will show how to distribute Kubernetes Pod replicas evenly on Nodes in different zones using topologySpreadConstraints.
πŸ“– Continue Reading
🌐 Kubectl: Delete Context | Cluster | User

A context in Kubernetes is basically a combination of an information about clusters and users, stored in a kubeconfig file.

Every time you execute the kubectl command, you reference a context inside kubeconfig.

The kubectl config command is used to manage Kubernetes configurations, primarily by editing the kubeconfig file.

In this short note I will show how to delete a Kubernetes context, cluster or user from kubeconfig using the kubectl config command.
πŸ“– Continue Reading
🌐 MikroTik: Enabling HTTPS for WebFig & API

MikroTik supports HTTPS for WebFig and API, but it is disabled by default.

Transferring data over HTTP is not secure, even within a Local Area Network (LAN), because HTTP does not encrypt the data being transmitted. This can include sensitive information such as login credentials, configuration details, or any other data sent to or from your MikroTik router over HTTP.

If any devices on your LAN are compromised, an attacker can intercept HTTP traffic between you and your MikroTik router.

To improve security and encrypt communications with your MikroTik router, you need to enable HTTPS. This is not a straightforward process, as enabling HTTPS on MikroTik for WebFig and API requires you to manually configure and use a valid certificate.

In this post, you will learn how to generate a self-signed SSL certificate on MikroTik, enable HTTPS for WebFig and API, and disable services that use insecure HTTP.
πŸ“– Continue Reading
🌐 Windows β€œls” Equivalent: Find and List Files Easily

The ls command is a go-to tool for Linux and macOS users to list files and directories. However, running the ls command in the Windows Command Prompt returns the error:

'ls' is not recognized as an internal or external command, operable program or batch file.

The Windows ls equivalent is the dir command, which provides similar functionality. Below, we'll explore how to effectively use the dir command for basic listing, listing hidden files, and displaying detailed information.

Basic Listing

In Linux/macOS, you would use the ls command to list files and directories. On Windows, the equivalent is the dir command:

C:\> dir


Listing Hidden Files

Hidden files can be revealed in Linux/macOS by using the ls -a command. On Windows, use dir /a to include hidden files in the listing:

C:\> dir /a


Displaying Details

For a more detailed view, Linux/macOS users add the -l flag to the ls command. In Windows, the similar detailed output can be achieved with dir /q, which shows ownership details and timestamps:

C:\> dir /q


Conclusion

Switching from Linux/macOS to Windows may feel challenging, especially when accustomed to commands like ls. Thankfully, the dir command serves as the perfect Windows ls equivalent for listing files and directories. From basic listings to hidden files and detailed views, dir is the reliable alternative for file management in Windows. Dive into related topics like Window cat command equivalent and Window grep command equivalent for more tips!
🌐 Shutdown Synology NAS Safely: Avoid Critical Errors

How to shutdown Synology NAS? The simplest method is to press and hold the power button until you hear a beep. This initiates a safe shutdown, preventing data corruption. For new Synology NAS owners, shutting down the device safely is essential to avoid hardware damage and ensure data integrity. Below, you will find detailed methods for safely shutting down your NAS, along with tips and links to additional resources.

1. Using the Power Button
The easiest and safest way to shutdown Synology NAS is by pressing the power button located on the device. This action signals the NAS to complete its shutdown sequence, ensuring all running processes are terminated safely.

Locate the power button on the front panel of the NAS.
Press and hold the button until you hear a beep.
Wait for the NAS to completely shut down before disconnecting power.

Using the power button is completely safe as the system manages the shutdown sequence, avoiding abrupt interruptions that could cause data loss or hardware damage.

⚠️ Warning: If the power button is pressed and held for too long, it may force the device to power off abruptly. This can interrupt ongoing processes, cause potential data corruption, or even damage the file system. Always release the button after the beep to ensure a proper shutdown sequence.

2. Shutdown via DiskStation Manager (DSM)
The DSM interface offers another reliable way to shutdown Synology NAS.

Log in to the DSM interface using your web browser.
Click on the user icon in the top-right corner.
Select "Shut Down" and confirm the action.

Shutting down via DSM ensures all active services and tasks are terminated properly. It is especially useful when the NAS is being accessed remotely.

3. Utilizing the DS Finder Mobile App
The DS Finder app provides a convenient option to shutdown Synology NAS from your mobile device.

Open the DS Finder app.
Navigate to the power options.
Select "Shut Down" and confirm the action.

This method is ideal for users who prefer managing their NAS remotely or when accessing the physical device is not feasible.

4. Scheduling a Shutdown
To automate the process, a shutdown schedule can be configured within DSM.

Open DSM and navigate to the Control Panel.
Select "Hardware & Power" and then go to the "Power Schedule" tab.
Set the preferred time for the NAS to shut down automatically.

This is an excellent option for users who want to save energy by turning off the NAS during periods of inactivity.

Conclusion
Shutting down your Synology NAS safely is crucial to maintaining both its durability and data integrity. Whether you use the power button, DSM interface, mobile app, or an automated schedule, these methods ensure a proper shutdown process. For more information, explore Synology NAS: First Time Installation & Setup Guide or learn advanced tools like Synology: Virtual Machine Manager – Install & Setup.
🌐 How to Get Telegram Bot API Token in 3 Easy Steps

If you've created a Telegram bot and now you need to get its API token, the process is simpler than you might think. Using BotFather, Telegram's official bot management tool, you can quickly retrieve or regenerate the token. This guide will walk you through the necessary steps to locate your Telegram bot API token quickly and securely. Below are the step-by-step instructions.

πŸ“– Continue Reading
🌐 The Best Windows Dig Equivalent for DNS Queries

The dig command is an essential DNS troubleshooting tool on Linux and macOS. However, attempting to use it in a Windows Command Prompt or PowerShell will return the errors as follows:

'dig' is not recognized as an internal or external command, operable program or batch file.
---
dig : The term 'dig' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.


The Windows dig equivalent are the Resolve-DnsName command in PowerShell and the nslookup command in Command Prompt.

Below is a quick guide on how to use these commands to check DNS records in Windows.

πŸ“– Continue Reading
🌐 MikroTik Script: Create, Run & Schedule – Example

Fore more efficient network management, different tasks in MikroTik can be automated using scripts. For example, you can create a script to check the availability of some host(s), and it run manually, or automatically using the MikroTik scheduler. This guide will show you how to create, run, and schedule a script on MikroTik RouterOS.

πŸ“– Continue Reading
🌐 Roborock Test Mode: How to Run a Full Self-Test Diagnostic

If your Roborock vacuum isn't working properly - whether it's sensor errors, cleaning issues, or docking failures - running a built-in self-test can help. To enter Roborock BIT mode: remove the robot from the docking station, turn it off, then hold down the Power button and quickly press the Home button five times in a row. This activates Roborock test mode for diagnostics. This guide explains how to run the test and what each step means.

πŸ“– Continue Reading
🌐 Force `cp` Command to Overwrite Without Confirmation

The cp command in Linux is used to copy files and directories, but by default, it may prompt for a confirmation before overwriting an existing destination. If you're running the cp command from some script, these prompts can interrupt the execution. To ensure the cp command overwrites files without confirmation, you can bypass aliases or use the yes command. Below, you'll find practical ways to achieve this.

πŸ“– Continue Reading
🌐 Find File by Name in Linux – 7 Basic Examples

Finding files in Linux can be tricky, especially when you need to search through thousands of files across multiple directories. However, this is achievable, using the Linux find command. It lets you search for files in Linux recursively by full name, partial name, or pattern.

Many users waste time manually browsing folders. With the right Linux find command syntax, you can locate anything fast. This guide shows how to use the Linux find command to search files recursively by exact name, extension, regex, and more. You’ll also learn how to combine find with grep for finding which of the files contain a certain string.

πŸ“– Continue Reading
🌐 Base64 PowerShell Decode & Encode – One-Liners | CheatSheet

On Linux or macOS, encoding and decoding with base64 is simple. But on Windows, there's no built-in base64 command in CMD or PowerShell. That's why many users search for fast alternative of the base64 command in Windows. The simplest way to convert Base64 encoded/decoded data is to use PowerShell's ToBase64String and FromBase64String methods. The one-liners below will let you work with strings and files securely - without sending your data to any third-party tools. This guide shows how to use Base64 PowerShell commands to make all Base64 data converts locally.

πŸ“– Continue Reading
🌐 PowerShell Select-String in Context: Lines Before & After Match

The grep command in Linux is widely used to search for patterns in files and show surrounding lines using flags like -A, -B, or -C. But when switching to Windows PowerShell, many users struggle to find an equivalent. The PowerShell Select-String command is the answer. To show lines before and/or after a match, use the Select-String command with the -Context parameter. This lets you display a number of lines before, after, or both around the matching line. This guide explains how to use PowerShell Select-String to replicate grep's context flags.

πŸ“– Continue Reading
🌐 Arduino Variable Types: Quick Start for Beginners

The concept of an Arduino variable is one of the first things beginners need to understand when programming microcontrollers. Variables store data that your Arduino sketch can use and modify. To declare a variable in Arduino, you must specify its type and name, like int ledPin = 13;. This tells the compiler what kind of data the variable will hold. Choosing the correct Arduino type of variable is important because it affects memory usage and how the data behaves. This guide explains what variables are, how to declare them, and which Arduino variable types are available.

πŸ“– Continue Reading