Sunday 30 October 2016

How to install CUDD Package in Linux

How to install CUDD Package in Linux

This tutorial explains how to install the CUDD package in Linux and how to correctly include the defined header files associated with the CUDD package.

DOWNLOAD EXTRACT and INSTALL

1. Download the CUDD package from the "download" link given at http://vlsi.colorado.edu/~fabio/ 
2. Copy the downloaded file to your HOME directory (optional)
3. Extract the file:
  • Open a Terminal and  in the Terminal go the directory where the file downloaded in the previous step is present (The HOME directory in this case)
  • Extract the content of the file using the command tar -xvf cudd-3.0.0.tar.gz
  • Open another Terminal in the directory "cudd-3.0.0" 
  • Type ./configure
  • When it is done type make
  • And then make check
4. Once all the above steps completes successfully, you are ready to type and run any C or C++ programs using the new header files that came with the CUDD package

IMPORTANT STEP WHILE RUNNING PROGRAM (How to include the CUDD header files)

1. Type any program in your text editor and save it as test.c (or any name) 
   
  Eg.              #include<stdio.h>
                     #include"cudd.h"
                     #include"util.h"
                         int main()
                       {printf("Its Working");
                       }
(Note that the defined header files must be enclosed within "double quotes" and not <angle brackets>

2.  Now locate the following header files and note their location:
  • cudd.h (Present in the folder "cudd". Right click and go to Properties and note its location. It will be something like "/home/jaison/cudd-3.0.0/cudd")
  • util.h (Present in the folder "util". Right click and go to Properties and note its location. It will be something like "/home/jaison/cudd-3.0.0/util")
  • config.h  (Present in the folder "cudd-3.0.0". Right click and go to Properties and note its location. It will be something like "/home/jaison/cudd-3.0.0") [This header file is also need for running the program]
3. Open a Terminal and run the program "test.c" created in the previous step using the gcc compiler and specify the location of the header files needed using the -I directive as follows:

gcc -I /home/jaison/cudd-3.0.0/cudd -I /home/jaison/cudd-3.0.0/util -I /home/jaison/cudd-3.0.0 test.c

4. Now run the output file generated as ./a.out

Please watch my Demonstration Video below for a clearer understanding.

Thank You





Wednesday 17 February 2016

How to run a basic C program in LINUX

This post show how to run a basic C program in Linux.

WRITING THE PROGRAM:
1. Open your HOME folder and create a new text file by RIGHT CLICK -> CREATE NEW DOCUMENT -> EMPTY FILE.  Name the file as "myprogram.c".
You can give any name of your choice with the ".c" extension.
                                 OR
Open TERMINAL (Ctrl+Alt+T). Open a file using your text editor command.
For UBUNTU : gedit myprogram.c
For LINUX MINT : pluma myprogram.c






2. Type the program into the file you just created.
Eg.

#include<stdio.h>
int main()
{
     printf("\n Hello Linux world");
}

3. Save the the file.
RUNNING THE PROGRAM
4. Go to the terminal and compile the program by typing "gcc" followed by the name of the program.
    Eg. gcc myprogram.c

gcc is the default compiler installed in Linux.

5. After running the above command, an executable file named "a.out" will be created in your HOME directory if your program compiles successfully without any errors. If any errors are shown, correct it in your program.

6. Run the executable file by typing "./a.out" in the Terminal. The output will be displayed.

Note: Whenever you compile any program, the name of the executable file is always "a.out" by default. if you want to specify the name of the executable file of your choice, then you can do so by typing "gcc myprogram.c -o myoutput". The name after "-o" specifies the name of your executable file. It can be any name of your choice. After doing so you can run the program as "./myoutput"   (Note that you don't have to specify the ".out" extension in this case).

For more detailed demonstration please watch my video below:

Sunday 7 February 2016

How to create a TEXT FILE using terminal and how to use the commands cp, mv & more

This post shows you how you can create text files using terminal and text editor and the uses of cp, mv and more commands.

First of all to create or edit text files you need a text editor installed in your Linux system. In Linux Mint the text editor 'pluma' and in Ubuntu the text editor 'gedit' are installed by default.

To create a text file:

1. Open the terminal by pressing Ctrl+Alt+T.
2. When the terminal shows up type the name of the text editor installed in your system followed by the name you want to give to your text file and press Enter.
Eg. FOR LINUX MINT: pluma mytext
FOR UBUNTU: gedit mytext
3. The text editior will open up and you can type your text into it and save it either by going to FILE-> SAVE or by pressing Ctrl+S.
4. Close the file (Alt+F4)

Using cp (Copy) command:

The cp command is used for copying the contents of one file to another.
  1.  Open the terminal and create two text files called mytext1 and mytext 2 in your home directory by following the above steps. Enter some data into mytext1 and mytext2.
  2.  Open a new terminal (Crtl+Alt+T) and type ls . This will list the names of the files in your home directory. Check if mytext1 and mytext2 are present in the list.
  3.  Now type cp followed by the name of the text file to be copied followed by the name of the destination text file where it has to be copied and press enter.
  4. Eg. cp mytext1 mytext2 -This will copy the contents of the file mytext1 to the file mytext2
  5.  Now check the contents of the files: TO CHECK THE CONTENTS OF A FILE:

  • (i) You can either open the file in the text editor by typing the name of the text editor followed by the file name. Eg. pluma mytext1 or gedit mytext1  OR
  • (ii) You can use the 'more' command to view the contents of the files in the terminal itself. Type more followed by the name of the file. Eg. more mytext1 -This will display the contents of mytext1 in the terminal window.  more mytext2 -This will display the contents of mytext2 in the terminal window.

 Check the contents of the files mytext1 and mytext2 by either of the two methods explained above and you will find that the contents of mytext1 is copied to mytext1 and hence both the files have the same data.

Using mv (Move) command:

The move command is used to move the contents of one file to another. Unlike the cp command mv commands overwrites the contents of the destination file.
Follow the first two steps of the above (cp) process to create two files (say newtext1 and newtext2)
  1.  Type mv followed by the name of the file to be moved followed by the name of the destination file and press Enter.      Eg. mv newtext1 newtext2
  2. Now using ls check the files present in your home directory. You can also check using the GUI as you usually do.
  3.  You will find that the file newtext1 does not exist anymore but its contents are moved to newtext2 overwriting the contents of newtext2.
  4. Use the more command to check it. Eg. more newtext2
For more detailed explanation please check out the second half of my video demonstration below:









Friday 5 February 2016

How to use the Linux terminal

The Terminal Emulator is a program that allows you to use the terminal in a graphical user interface. 
This post will show you how to open a Terminal in Linux and use some of the basic commands.

To open a terminal: 
You can open the terminal by either typing "TERMINAL" in the Linux's search box in Menu  OR You can use the shortcut key combination "Ctrl+Alt+T" which would be simpler and more handy.

In the terminal:
When you open the terminal the first line that you see which looks something like jaison@jaison - $ specifies your user name and machine name. The first name is your user name and the second name after @ is your machine name. The cursor blinking after the $ symbol shows that it is ready to accept commands.

Some basic commands:
1.  pwd      - pwd stands for print working directory. Typing pwd in the terminal will display your current directory in which the terminal is open. By default it will be your HOME directory.
Eg. /home/jaison/  -This shows that I am in my root directory (the first '/' symbolizes root directory) and in root directory I am in the 'home' directory and there inside the directory named 'jaison'.

2.  ls      -  ls stands for list. Typing ls in the terminal will display the files and folders that are present in that directory.
Eg. When you are in /home/jaison/ typing ls would display all the files and folders present in /home/jaison/

3. cd      - cd stands for change directory. The cd command enables you to change your working directory from home to any other directory and will help you navigate through directories and files.
Type 'cd' followed by the name of the directory you want to go to.
Eg. jaison@jaison - $  cd Downloads/       -This will take you to the directory 'Downloads'. After this your prompt will look like jaison@jaison ~/Downloads $. This shows that you are in the the directory called 'Downloads'. You can check it out by typing pwd and it will give you an output which looks like /home/jaison/Downloads which shows that 'Downloads'  is your current working directory.

cd ..      - cd .. (cd space followed by two dots) - This command will take you one step back. i.e It will take you to the previous directory you visited.

cd       - Simply typing cd would take you back to your home directory where ever you are.

For more detailed explanation please watch my video below:




An Introduction to Linux

If you are thinking about using Linux or perhaps already using it knowing how cool it is, this blog is for you just to let you get started and help you move on in this 'open' journey of the Open Source world.

Here is a little about Linux I got from wiki:

Linux is a Unix-like and mostly POSIX-compliant computer operating system (OS) assembled under the model of free and open-source software development and distribution. The defining component of Linux is the Linux kernel, an operating system kernel first released on 5 October 1991 by Linus Torvalds. The Free Software Foundation uses the name GNU/Linux to describe the operating system, which has led to some controversy
  Linux was originally developed as a free operating system for personal computers based on the Intel x86 architecture, but has since been ported to more computer hardware platforms than any other operating system.Thanks to its dominance on smartphonesAndroid, which is built on top of the Linux kernel, has the largest installed base of all general-purpose operating systems.Linux, in its original form, is also the leading operating system on servers and other big iron systems such as mainframe computers and virtually all fastest supercomputers, but is used on only around 1.6% of desktop computers  with Linux-based Chrome OS taking about 5% of the overall and nearly 20% of the sub-$300 notebook sales. Linux also runs on embedded systems, which are devices whose operating system is typically built into the firmware and is highly tailored to the system; this includes smartphones and tablet computers running Android and other Linux derivatives, TiVo and similar DVR devices, network routers, facility automation controls, televisions,  video game consoles, and smartwatches

   The development of Linux is one of the most prominent examples of free and open-source software collaboration. The underlying source code may be used, modified and distributed – commercially or non-commercially – by anyone under the terms of its respective licenses, such as the GNU General Public License. Typically, Linux is packaged in a form known as a Linux distribution, for both desktop and server use. Some of the popular mainstream Linux distributions are Debian, Ubuntu, Linux Mint, Fedora, openSUSE, Arch Linux and Gentoo, together with commercial Red Hat Enterprise Linux and SUSE Linux Enterprise Server distributions. Linux distributions include the Linux kernel, supporting utilities and libraries, and usually a large amount of application software to fulfill the distribution's intended use.
Distributions oriented toward desktop use typically include a windowing system, such as X11Mir or a Wayland implementation, and an accompanying desktop environment, such as GNOME or the KDE Software Compilation; some distributions may also include a less resource-intensive desktop, such as LXDE or Xfce. Distributions intended to run on servers may omit all graphical environments from the standard install, and instead include other software to set up and operate a solution stack such as LAMP. Because Linux is freely redistributable, anyone may create a distribution for any intended use.

For more detailed information please check out  LINUX Wiki