Skip to main content

Posts

Showing posts with the label Linux

Featured Post

Product Design of a 4 wheel differential drive robot

Raspberry pi based Car Infotainment system

Out in the market, there are a handful of car infotainment systems that you can buy for 10 to 30k INR. But nothing beats the thrill of making one from scratch and put it on your own car. So this is my effort to make one from the scratch. At heart, it is a raspberry pi 3 Model B single board computer. For those who don't know about raspberry pi, it is a single board compute with a Quad Core 1.2GHz Broadcom BCM2837 64bit CPU with on board WiFi and Bluetooth. See this for a complete spec. It is connected with a 7 inch multi touch display running Ubuntu Mate (a Linux variant). Os is modified so that it is only running the bare minimum services to run the system. It will save the boot up time and improve performance a little bit. It is connected to a GPS module via UART to get current location. It is used in the navigation section. It is also used to get time, when the device is not connected to internet. It uses google map API for navigation. The complete infotainment system is...

PlymouthTheme-TheRun

This is an another theme I created for Plymouth (   a bootsplash for Linux). This will replace your native boot and shutdown animation. Credits to Joel Roset for the FX animation. A step by step instruction of how to install this theme is in this video.

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 I found online. You can download the theme and find the installation steps on my github account. ( https://github.com/krishnan793/PlymouthTheme-Cat )  The theme is created for Ubuntu 16.04. But this can be installed on previous versions with slight modification. If you have a slow computer then you can watch the whole animation loops. (The VM I used to record the screen was fast though. :))

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. One thing to remember is that the device is 3.3 V logic. Do not connect 5V supply or 5V RX/TX pins to the device. Connection ======== VCC       ->       3.3V GND       ->       GND CH_PD   ->       3.3V RX          ->       TX TX          ->       RX If you a...

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..

Linux command awk extract anything

Awk is pretty use full when you are writing automatic scripts to do your jobs. Some simple examples of how we can use awk are given below ps | awk '{print $1}' It will print first column of ps command.  If you want to print second column also write ps | awk '{print $1 $2}' Output seems to be pretty crowded? Add a simple space by ps | awk '{print $1 " " $2}' Want to limit it display only second line? ps | awk ' NR==2{print $1 " " $2}' Want to exclede first row? You can do it by ps |awk 'NR !=1{print  $1 " " $2}' Similarly you can print rows greater than a value by ps |awk 'NR >1{print  $1 " " $2}' You can extract virtually anything using awk... Feel free to explore every options. Type man awk or awk --help to explore other options. Feel free to comment also... :) This site has some good examlpes.

Pass output of one command to argument of other

Well Linux is famous for combining things in power full ways in which anything is possible from a command line. The real fun of Linux came when you start focusing on terminal to do everything... It's possible to pipeline commands in terminal. Also it's possible to pass output of something as an argument of other. For example you can ping to your own external ip by ping $(curl -s  curlmyip.com) curl curlmyip.com returns you ip address. This address is passed to  the telnet as an argument. Whatever you put between $( and ) will execute as if it is a bash command.

How to know external IP address from Linux terminal?

ifconfig displays only local ip address of your system. If your system is directly connected to internet then it will be your external ip address. It may not be the case always. Because you will be behind a router or a modem. You can know the external IP address by going to www.whatismyip.com or www.ipecho.net . If you want to know it from a terminal type curl curlmyip.com What curl do is it fetches the content of the link to the terminal. There are also several other websites that offers this same service. Some of them are listed below. curl  ipecho.net/plain curl myexternalip.com/raw curl curlmyip.com curl ifconfig.me/ip curl icanhazip.com curl ip.appspot.com

Testing NAT Port Forwarding and reverese NAT

For a long time I have been trying to configure port forwarding using NAT. But every attempt was futile...  Finally I found that my port forwarding works just fine. But it just appears to be not working because my router doesn't support reverse NAT. In this post I will show you guys how to test whether you configure your NAT correctly or not. (Read a detailed write up by shane. Link ) First make a port forwarding rule in your router say 1600. Download this little tool called simple internet tools. Install it and open port listener and select your internal IP(192.168.x.x). Then type your port number and press start listening. Go to this site  and check whether it says port is opened. If your connection is successful you will notice it in the port listener application. Then go to your browser and type your internet ip address. (You can find it from www.whatismyip.com) . Tnen type your port number after a colon. (116.211.22.12:1600). Your browser shows a webpage not availa...

How to hide and unhide files in Linux?

If you are new to linux OS, it's a common mistake to add a (.) in front of your files and suddenly the file disappears. In Linux filenames starting with a dot (.) are hidden. You can intentionally make a folder or file hidden by renaming it. mv filename .filename If you want to view you hidden files or folders, first go to the location where the file resides using cd command. cd /root/Desktop/ Then list all files and folders using ls command. ls -a If you want to permanently unhide then use mv command again. mv .filename filename

Linux: How to find your serial (any connected) device?

In Linux all devices that are connected to the system are listed in /dev If you connect your mouse to your system it will detect it as hidraw. Other serial devices will be named as tty0, tty1,etc. So if you connect a serial (any) device and you want to know it's name ( for ex: you want to connect it via minicom ), first go to /dev using cd /dev Then list the contents of folder using ls But it will be hard to figure out the name of your device from the long list. So here is a trick for it. Disconnect the device and type this in terminal. ls > removed.txt Connect your device again and type ls >connected.txt Your device's name will be on the connected.txt file. But how to know filter it? Compare both list and the odd one will be your device. Type this. diff removed.txt connected.txt You will get the name of your device.

Serial Port Communication in Linux using Minicom

First of all install minicom using apt-get install minicom or directly download the .deb package from  https://packages.debian.org/sid/minicom  and install it using dpkg -i <package name> After install type minicom -s to setup the minicom for using your serial port. Select Serial Port Setup and type A to select serial device. It will be shown as /dev/modem replace modem with  your serial device. Press Enter twice to save. You can also setup boadrate and all those stuff in the Serial Port Setup. After that you can save your configurations. Select Save Setup as. Then type a name and press enter to save it. If you wan't to open your configuration later, type minicom <configuration name>