DeveloperBreeze

Introduction

Sometimes, you may find yourself needing to connect to a WiFi network from a root shell, especially when troubleshooting or working in a minimal environment without a graphical interface. This guide provides step-by-step instructions on how to connect to WiFi from a root shell using the nmcli and wpa_supplicant commands in Ubuntu.

Step 1: Identify Available WiFi Networks

Before connecting to a WiFi network, you need to identify the available networks:

  1. Use nmcli to list available WiFi networks:
   nmcli dev wifi list

This command lists all available WiFi networks, showing details such as SSID (network name), signal strength, and security type.

  1. Note the SSID of the network you want to connect to.

Step 2: Connect to the WiFi Network Using nmcli

nmcli is a command-line tool for managing NetworkManager, which controls network connections in Ubuntu.

  1. Connect to the WiFi network:
   nmcli dev wifi connect "SSID" password "your_password"

Replace "SSID" with the name of your WiFi network and "your_password" with the network’s password.

  1. Verify the connection:

After running the command, you should see a message indicating that the device has successfully connected to the network. To verify:

   nmcli dev status

This command shows the status of your network interfaces, confirming if the WiFi connection is active.

Step 3: Manually Connecting Using wpa_supplicant

If nmcli is not available, or you prefer a more manual approach, you can use wpa_supplicant to connect to WiFi.

  1. Create a configuration file for wpa_supplicant:
   sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Add the following configuration, replacing your_ssid and your_password with your network’s SSID and password:

   network={
       ssid="your_ssid"
       psk="your_password"
   }
  1. Start wpa_supplicant:

Use the following command to connect to the WiFi network:

   sudo wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf

Replace wlan0 with the name of your wireless interface, which can be found using the ip link command.

  1. Obtain an IP address:

Once connected, obtain an IP address using dhclient:

   sudo dhclient wlan0

This command configures the network interface with an IP address, allowing you to access the internet.

Step 4: Troubleshooting Connection Issues

If you encounter issues connecting to WiFi, here are some troubleshooting steps:

  1. Check the interface status:
   ip link show wlan0

Ensure that your wireless interface is up and running.

  1. Check the logs:

If the connection fails, check the logs for wpa_supplicant:

   sudo journalctl -u wpa_supplicant

This command provides detailed logs that can help diagnose the issue.

  1. Restart the network interface:

If the connection is unstable, try restarting the network interface:

   sudo ip link set wlan0 down
   sudo ip link set wlan0 up

Conclusion

Connecting to WiFi from a root shell is a useful skill, especially when working in a non-GUI environment or troubleshooting network issues. By following this guide, you can easily connect to a WiFi network using either nmcli for simplicity or wpa_supplicant for a more manual approach. These methods ensure that you can maintain network connectivity even when operating at the root level.

Continue Reading

Discover more amazing content handpicked just for you

Tutorial

How to Stop SSH From Timing Out

nano ~/.ssh/config

Add:

Aug 21, 2025
Read More
Tutorial

How to Translate URLs in React (2025 Guide)

Sample en.json:

{
  "routes": {
    "home": "home",
    "about": "about-us"
  },
  "title": "Welcome to our site!"
}

May 04, 2025
Read More
Tutorial

Globalization in React (2025 Trends & Best Practices)

In 2025, Google rewards localized content.

  • ✅ Use language-based subpaths: /en, /fr, /ar
  • ✅ Generate hreflang tags for each locale
  • ✅ Translate meta tags: <title>, <meta description>
  • ✅ Avoid client-only routing for indexable pages
  • ✅ Pre-render pages via SSR (e.g., with Next.js)

May 04, 2025
Read More
Tutorial

Implementing Internationalization (i18n) in a Large React Application (2025 Guide)

const { t } = useTranslation('dashboard');
  • ✅ Add lang attribute dynamically to <html lang="...">
  • ✅ Use language subpaths (e.g., /en/home, /fr/home) for SEO indexing
  • ✅ Translate all visible UI, not just text
  • ✅ Localize URLs and metadata (title, description)
  • ✅ Use hreflang tags in SSR setups (Next.js, Remix)

May 04, 2025
Read More
Tutorial

Building Micro-Frontends with Webpack Module Federation (2025 Guide)

cd app-shell
npx webpack serve

Visit http://localhost:8080 — you’ll see the React dashboard with the Vue analytics module seamlessly loaded via Module Federation.

May 04, 2025
Read More
Tutorial

State Management Beyond Redux: Using Zustand for Scalable React Apps

  • Project Size: For small to medium-sized projects, Zustand's simplicity can accelerate development.
  • Team Experience: Teams new to state management may find Zustand's learning curve more approachable.
  • Boilerplate Reduction: If minimizing boilerplate is a priority, Zustand offers a cleaner setup.
  • Performance Needs: Zustand's selective rendering can enhance performance in applications with frequent state updates.

However, for large-scale applications requiring complex state interactions, middleware, and extensive tooling, Redux might still be the preferred choice.

May 03, 2025
Read More
Tutorial

Mastering React Rendering Performance with Memoization and Context

Best Practices:

   const ThemeContext = React.createContext();
   const UserContext = React.createContext();

May 03, 2025
Read More
Tutorial

✅ How to Disable MySQL Password Validation on Ubuntu 25.04

Query OK, 0 rows affected

Check that the validation system is gone:

May 01, 2025
Read More
Tutorial

How to Move the MySQL Data Directory to a New Location on Ubuntu 25.04

You should see:

+---------------+------------------+
| Variable_name | Value            |
+---------------+------------------+
| datadir       | /mnt/data/mysql/ |
+---------------+------------------+

May 01, 2025
Read More
Tutorial

How to Install PHP, MySQL, and phpMyAdmin on Ubuntu 25.04 (LAMP Stack Setup Guide)

During installation:

  • When prompted to choose a web server, select apache2.
  • Choose Yes when asked to configure the database for phpMyAdmin with dbconfig-common.
  • Set a password for the phpMyAdmin application.

May 01, 2025
Read More
Tutorial

How to Fix NVIDIA Driver Issues on Ubuntu (Dell Vostro 3521)

sudo chmod +x /usr/bin/prime-run

Now test:

Apr 14, 2025
Read More
Tutorial

Avoiding Memory Leaks in C++ Without Smart Pointers

  • How memory leaks happen.
  • How to structure your code to avoid them.
  • A design pattern to manage dynamic memory safely (RAII without smart pointers).
  • A reusable ScopedPointer class to emulate unique_ptr in old C++.

Consider this code:

Apr 11, 2025
Read More
Tutorial

Deep Copy in C++: How to Avoid Shallow Copy Pitfalls

This tutorial covers:

  • What shallow vs deep copy means
  • The problems caused by shallow copy
  • How to implement deep copy correctly
  • A practical class example with dynamic memory
  • When to use Rule of Three vs Rule of Five

Apr 11, 2025
Read More
Tutorial

🛡️ Protect Your Forms Like a Pro: Anti-Spam Techniques That Actually Work

Then send that timestamp with the form, and on the server:

const duration = Date.now() - formStartTime;
if (duration < 3000) {
  return res.status(403).send("Too fast, bot?");
}

Apr 04, 2025
Read More
Tutorial

Build a Custom Rate Limiter in Node.js with Redis

Create a .env file:

REDIS_URL=redis://localhost:6379

Apr 04, 2025
Read More
Tutorial
javascript

Building a Real-Time Object Detection Web App with TensorFlow.js and p5.js

  • Setup: The setup function initializes the canvas and video capture. The video is hidden by p5.js’s default element so that we can draw it onto the canvas manually.
  • Model Loading: We load the COCO-SSD model asynchronously. Once the model is ready, we start continuous object detection by calling detectObjects().
  • Detection Loop: The detectObjects function uses the loaded model to analyze the current video frame and stores the detection results. It recursively calls itself so that new frames are analyzed continuously.
  • Drawing: In the draw loop, the video feed is displayed and for each detected object, a rectangle and label are drawn. The bounding box coordinates and object class are provided by the model.

Now that you have a basic real-time object detection app, consider extending its functionality:

Feb 12, 2025
Read More
Tutorial

Building a Cross-Platform Desktop App with Tauri and Svelte: A Step-by-Step Tutorial

We’ll start by creating a new Svelte project. You can use a template via degit:

npx degit sveltejs/template tauri-svelte-app
cd tauri-svelte-app
npm install

Feb 12, 2025
Read More
Tutorial

Implementing a Domain-Specific Language (DSL) with LLVM and C++

#ifndef DSL_AST_H
#define DSL_AST_H

#include <memory>
#include <llvm/IR/Value.h>
#include <llvm/IR/IRBuilder.h>

// Base class for all expression nodes.
class ASTNode {
public:
    virtual ~ASTNode() = default;
    virtual llvm::Value* codegen(llvm::IRBuilder<>& builder) = 0;
};

// Expression for numeric literals.
class NumberExprAST : public ASTNode {
public:
    NumberExprAST(double value) : value(value) {}
    llvm::Value* codegen(llvm::IRBuilder<>& builder) override;

private:
    double value;
};

// Expression for a binary operator.
class BinaryExprAST : public ASTNode {
public:
    BinaryExprAST(llvm::TokenType op, std::unique_ptr<ASTNode> lhs,
                  std::unique_ptr<ASTNode> rhs)
        : op(op), lhs(std::move(lhs)), rhs(std::move(rhs)) {}
    llvm::Value* codegen(llvm::IRBuilder<>& builder) override;

private:
    TokenType op;
    std::unique_ptr<ASTNode> lhs, rhs;
};

#endif // DSL_AST_H

Implementation: AST.cpp

Feb 12, 2025
Read More
Tutorial
python

دليل عملي: بناء روبوت دردشة (Chatbot) باستخدام Python و NLP

لنبدأ بإنشاء مجموعة بيانات بسيطة تتضمن الأسئلة الشائعة والردود:

# قاعدة بيانات للأسئلة والردود
qa_pairs = {
    "مرحبا": "أهلاً وسهلاً! كيف يمكنني مساعدتك اليوم؟",
    "كيف حالك؟": "أنا مجرد روبوت، لكنني بخير إذا كنت بخير!",
    "ما هو اسمك؟": "أنا روبوت دردشة بسيط. اسألني أي شيء!",
    "وداعاً": "وداعاً! أتمنى لك يوماً سعيداً."
}

Dec 12, 2024
Read More
Tutorial
python

كيف تبدأ رحلتك مع الذكاء الاصطناعي: دليل عملي للمبتدئين

حان وقت استخدام النموذج:

new_data = [[2000, 3, 15]]  # الحجم، عدد الغرف، عمر العقار
prediction = model.predict(new_data)
print(f"السعر المتوقع: ${prediction[0]:.2f}")

Dec 12, 2024
Read More

Discussion 0

Please sign in to join the discussion.

No comments yet. Start the discussion!