radiolist-widget

How to use ncurses widgets in shell scripts on Linux

In this tutorial we will learn the basics of the dialog utility, in order to use ncurses widget in our shell scripts. We will see how to install dialog in the most used Linux distributions, some of the common options we can use to alter the behavior of dialog, how to use some widgets; among the others: inputbox, checklist, radiolist and yesno. Finally, we will see how to use the data obtained by the widget processing.

In this tutorial you will learn:

  • How to install the dialog utility on Linux
  • What are the most relevant dialog options
  • How to use the inputbox, checklist, radiolist, passwordbox, msbox, calendar and yesno widgets
  • How to manage data derived from the widget processing

Read more

Transmission Web Interface

How to set up transmission-daemon on a Raspberry Pi and control it via web interface

Introduction

Transmission is probably the most famous torrent client in the Gnu/Linux world, and it’s very often used even on other operating systems. It’s really easy to use, and its graphical interface is very intuitive; however in this tutorial we will see how to install transmission-daemon and run transmission on a headless machine: that’s an ideal setup to create a “Torrent-box”, using for example a Raspberry Pi, to reduce power usage.

Once installed and configured, we will be able to manage the application using the web interface. For the sake of this tutorial I will install transmission-daemon on a Raspberry Pi, using the Raspbian operating system, however the same instructions should work on Ubuntu and Debian.

Read more

Bash Script Comment Example

How to write comments in Bash Scripts

Well you have written an awesome Bash script. It works perfectly and perhaps there is no need to add new functionality. Well, maybe not for now, at least! At this stage you are happy with the script. However, after few months you reopen your bash script again to add new feature and you get a headache to figure out on how the script actually works. Hence, you need to spend additional energy and time before you can actually start editing the script in order to add new feature.

Well, at this point you regret that you did not put some comments ( notes ) into the script to remind you of how the bash script is structured. Not only that Bash comments serve as excellent notes for you or anybody else who might work with your script they may be to some extend also used as a basic bash script debugging tool.

In this tutorial you will learn:

  • How to comment on bash command line
  • How to write comment bash scripts
  • How to create multiple line comments

Read more

Bash Terminal

How to Debug Bash Scripts

There are techniques from traditional programming environments that can help.
Some basic tools like using an editor with syntax highlighting will help as well.
There are builtin options that Bash provides to make debugging and your everyday Linux System Administration job easier.

In this article you will learn some useful methods of debugging Bash scripts:

  • How to use traditonal techniques
  • How to use the xtrace option
  • How to use other Bash options
  • How to use trap

Read more

bash scripting

How to modify scripts behavior on signals using bash traps

Objective

The objective of this tutorial is to describe how to use the bash shell trap builtin to make our scripts able to perform certain actions when they receive a signal or in other specific situations.

Requirements

  • No special requirements

Difficulty

EASY

Conventions

  • # – requires given linux commands to be executed with root privileges either
    directly as a root user or by use of sudo command
  • $ – requires given linux commands to be executed as a regular non-privileged user

Introduction

bash scriptingWhen writing scripts that are meant to run for a considerable time, it’s very important to increase their robustness by making them able to react to system signals, executing specific actions when some of them are received. We can accomplish this task by using the bash trap builtin.

Read more