Showing posts with label Linux Terminal. Show all posts
Showing posts with label Linux Terminal. Show all posts

Saturday, March 22, 2014

GETTING PROCESS INFORMATION


We all knows that in Linux operating system whatever we execute is a process. So many time we don't know how to get proper information about which process. Basically it's depend on our need that why we have to get information of process.Now if we consodering a normal system user, then we can consider that he needs atleast process id to do some basic operations on that process. For example I open a firefox browser and i want to know what it's process id, so there are two way to get process id.

Friday, June 14, 2013

GTK+ dialogs in Shell Scripting


I had written a blog previously what shell scripting programming is all about and I had also written about my project(i.e. Package Installer) created in shell scripting as back-end and zenity as front-end for GUI.

Now, in this blog I am going to focus on zenity only, as I consider that you all had read my both blogs, so no need to talk on those two topics.

What is Zenity?

Zenity was written by Glynn Foster <glynn.foster@sun.com>. Zenity is a program that will help you to create GTK+ dialogs in shell scripting, for example if you type following command on your Linux Terminal then it will open a calendar with GUI.

zenity --calender [ 1 ]

Fig : 01
As you can see you can select date as you wish and after click on OK button it will return date as (for example)“Friday 14 June 2013” on terminal or you can save this date into the variable and you can use it in your program as per your program requirement.

Zenity provides many options as you can see one above. For example when you use zenity --question command then you can see following dialog, this dialog provides you two buttons that is YES and NO. When you press any one, it will return 0, 1 or 5. It will return 0 for NO, 1 for YES or 5 if timeout has been reached. Now question is how to check the returns codes, it's actually a quite easy task, you have to use '$?' command immediately after 'zenity –-question'.
Fig : 02
 
In fact zenity provides many ways to create your own GTK+ dialogs as you want to create. Just you have to follow rules of options provided by zenity program. To read more information about zenity program you can type 'man zenity' on your Linux terminal. Zenity programs also provide sub options for particular dialogs, like you can change the text, colour, height, width etc.

Type following commands on your Linux terminal as it is, you can see this commands also by using 'man zenity'.

zenity --title="Select a file to remove" –file-selection [2]


zenity --title "Select Host" --entry --text "Select the host
you would like to flood-ping" [3]

zenity --question --title "Alert" --text "Microsoft Windows
has been found! Would you like to remove it?" [4]

zenity --list --checklist --column "Buy" --column "Item" TRUE [5]

Friday, December 28, 2012

INSTALL FONTS IN UBUNTU

In current era, Windows users are migrating from Windows os to Linux Operating System. Because everything which we had in windows, are also available in all Linux distros, with some great features. And if we don’t have sort of things available in Linux os then we can easily install it in Linux and also we can access Windows software’s through Wine.
Most probably when Windows users are migrated to Linux they have problem with fonts, which are available in Windows but not in Linux. This problem can be solved in two ways. First way is that we can directly download the required fonts and second way is that we can install those fonts through Linux Terminal.

First Way: - Download and Install Fonts. (Install Book-Antiqua font in Ubuntu 11.10)


Step 2: - Open .Zip file with Archive Manager.
 
Fig1 : Opening of .zip file
 Step 3: - Extract .Zip file as shown below. 
 
Fig2 : Extracting file
 Step 4: - Select Location to extract file.
 
Fig3: Selection of Location
 Step 5: - Extract file. (Wait until its shows extraction complete successfully)

Fig4: After Extracting a file







 Step 6: - Open Font file and Click on Install font and wait for some time, after installation of font, it will show “Installed”.

Fig5: Installing of font
 Step 7:- For checking font is installed or not open Libre Office Writer and check font in your font List.

Fig : Libre Office Writer

Second way:-

I will recommend you to install the Microsoft TrueType core fonts. To install them type the following command on a terminal:

              sudo apt-get install msttcorefonts
 
This will install fonts like Arial, Times New Roman and other Microsoft proprietary fonts. It will not however install Tahoma. Sometimes this server is really busy or down so be patient.
Also there are some Java fonts like Lucida that you can install. This requires the 1.5 JRE to be installed. To install them type the following in a terminal.

             sudo apt-get install sun-java5-fonts

All the fonts you will use in Ubuntu are stored in two places:-
1->/usr/share/fonts
2-> ~/.fonts

I recommend you install them in the First Location. Reason behind is that if you install them to your /home directory they will not be accessible from another account on the computer. So you can directly install all your fonts in above locations. I hope it will help you.
 

Friday, December 7, 2012

Automatic Voice Command Execution


Hello Readers, this is a new concept that I am going to explain you in this post. Before starting main topic I will like to clear basic concepts, because if you don’t know the basic concept then you will not understand this concept properly. And according to my knowledge still this concept is not developed, and this is only concept that I thought and if you want, you can develop it.
Now back to the basic concepts, you should know voice frequency, how to convert voice frequency into text, and programming on any Linux Operating System, and the most import Multithreading, Because if you don’t know multithreading then you can’t develop it.
As we know voice is nothing but the frequency and we can easily convert analog frequency (sin wave) into digital frequency (square wave) by using some methods and once it converted into digital frequency, we can easily convert it into text.
Fig : Automatic Voice Command Execution
Step 1 is completed, now in next step we have to check a file where all the commands are stored but it is a hard task to recognize actual command because the voice frequency which was converted into text that may be converted into wrong formats or may be spelling of commands converted in wrong way. But this problem will solve by proper converting, for this we have to check (debug) all possible conditions.
Now in 3rd and final step we have to read all commands one by one and simply execute them on terminal of Linux Operating System that you are using for operations. The last step is seen to very easy but it not, because we have to execute all commands one by one that is easy but when to execute or when to wait (if file is empty) that is so much difficult but there is a solution that is multithreading. For more information of multithreading you can refer to any book or you can search it on http://www.google.com. To execute all commands we require two or more threads, its totally depends on Programmers logic.
I am hoping that all readers will like this concept and if anyone wants any kind of help to develop this concept then you can mail me on panditdilipr@gmail.com.