script

All posts tagged script by Linux Bash
  • Posted on
    Featured Image
    The article explains how to automate the process of pairing Bluetooth devices using the `bluetoothctl` command on Linux in a non-interactive manner. This approach is especially useful in environments such as IoT systems where manual setup is impractical. The blog gives a sample script detailing how to power on Bluetooth, establish a pairing agent, pair and connect to a device via its MAC address, and then exit `bluetoothctl`. This method enhances efficiency in device setup and maintenance.
  • Posted on
    Featured Image
    The blog explores Bash's `compopt` builtin which allows dynamic modification of autocomplete options on the command line. By detailing features that enable the tailoring of behaviors, such as limiting file completions to `.txt` files and controlling spaces after completions, `compopt` is shown to significantly enhance user efficiency. Examples and script implementation advice offer practical insights for power users and system administrators.
  • Posted on
    Featured Image
    The article discusses using the `dd` command to split files into fixed-size chunks in Linux when `split` is unavailable. It explains the importance of specifying the correct byte size, counts, and offsets with `dd` to manage file data accurately in loops for different chunks. Examples of Bash scripts are provided to demonstrate how to split files and extract specific portions efficiently. The piece emphasizes `dd`'s versatility and caution to avoid data loss.
  • Posted on
    Featured Image
    The article explains using `reptyr`, a Linux utility, to reattach detached processes to a new terminal—a helpful solution when a process disconnects from its initiating terminal. Simple to install on various Linux distributions, `reptyr` allows for regaining control of background processes, crucial for effective long-term task management and system administration. It includes installation guides, usage steps, practical examples, and a script to demonstrate how to manage processes efficiently.
  • Posted on
    Featured Image
    The article discusses how to work safely with raw disk devices like `/dev/sda` in Linux. It emphasizes the importance of using commands such as `lsblk` and `fdisk -l` to correctly identify devices, ensuring that no mounted filesystems are involved before writing. It also provides a script that includes several safety checks and requires root access, which uses `dd` for data writing and offers progress status. The guide is aimed at preventing data corruption and loss by advocating for strict verification and backup procedures.
  • Posted on
    Featured Image
    The blog post details using `sysdig` to trace file accesses in Linux, highlighting its capability to capture system events directly from the kernel. It offers installation instructions for different Linux distributions and uses a command format with specified filters to monitor file accesses by scripts. Practical examples, including a Bash script, demonstrate `sysdig`'s utility in debugging, security, and system performance optimization.
  • Posted on
    Featured Image
    In Bash scripting, using `\command` helps avoid the unpredictable behavior caused by alias expansion. Aliases modify command functionalities and can disrupt scripts when run in different environments. Employing `\command`, such as `\ls` or `\grep`, ensures that scripts execute commands in their original form, enhancing portability and reliability across various environments.
  • Posted on
    Featured Image
    Learn to create a custom Bash script for network diagnostics with LinuxBash.sh's guide, ideal for system admins and network engineers. The guide explains how to script connectivity checks, DNS tests, interface monitoring, and network speed analysis. It also covers task automation with cron jobs, adding email alerts, and logging for better network management. Essential for efficient network troubleshooting and system reliability.