Posts tagged with linux - page 2

Plymouth theme for Ubuntu

Bored of having the same boot animation screen again and again? There are plenty of Plymouth themes available out there. This is a theme I created by slicing some cool gif files found online. You can download the theme and find the installation steps on my github account. Link

ESP8266 WiFi IOT chip | Programing the Firmware

ESP8266 is a cheap WiFi chip you can use in your embedded projects. You can communicate the chip using AT commands through UART. You can setup a WiFi hotspot, connect to an existing WiFi network, act as a web server, send data (TCP/UDP). The real fun is that you can reprogram the whole chip and you don’t need an other micro controller to control it. The ESP8266 ES1 come with 2 GPIO pins. There are other variants of this chip with more GPIO. This ESP 01 cost around Rs. 250 which is so cheap while comparing with other WiFi modules.

Display text in color - Linux terminal

Ever wanted to print text in colours? You can do it with ANSI escape characters. You can use ANSI codes in any programming language as long as the terminal supports it.

echo -e "\e[31mRed"

Red

echo -e "\e[32mGreen"

Green

Replace the number to get different colors. You can make text bold, italics, underline etc. Following is a short table describing several codes.

39     Default
30     Black     
31     Red   
32     Green   
33     Yellow   
34     Blue   
35     Magenta
36     Cyan   
37     Light gray   
97     White     

For a complete reference, link. (The page has a complete list of ANSI codes)

Automating scripts using expect

Expect is one way to automate your scripts by expecting what the output may be. For example you want to create a script that helps you to login to a telnet session and enter your login and password for you. Here is the simple example which helps you to do it.


Above example will login to your router and enter your username and password and list all the possible commands using ? and then let you to interact with using interact command. You can automate anything for example applications, ssh etc..

How to use variable from bash to use in awk?

If you want to use your variable from script inside awk, do the following

column=2
ps | awk '{print $var}' var=$column


or

name="Hello"
echo $name | awk '{print var}' var=$name