In ubuntu there is a directory which contains all the information of the hardware of the running system,which is /proc.
Given below are important and frequently used files you can find inside /proc directory.
/proc/cpuinfo – this file contains information about CPU such as vendor_id,cpu family,model
,model name,cpu MHz,cache size etc.
/proc/meminfo – this file contains information about memory such as MemTotal, MemFree, BuffersCached,SwapCached,Active,Inactive etc.
/proc/loadvg – this file contains cpu load average information in last 1,5,15 minutes respectively.
/proc/partitions – this file contains partition related information.
/proc/version – this file contains linux version and gcc version of the system.
This blog was opened by a team who love foss and is open for all those who love to contribute for foss development. All the foss lovers are most welcome to our blog. Take from it.Do not forget to contribute!
Wednesday, December 14, 2011
How to send an email using a python script
Hi all,
If you want to send a mail you have to follow several steps including the following.
open up the web browser.
login into your account.
click on compose mail.
compose the message specify receiver and send the mail.
But if you can send a mail through a script it will save time for you.
Here is a python code for send a mail.
import smtplib
sender= 'senders_name@gmail.com'
receiver = 'receivers_name@gmail.com'
subject='Python is a powerful scripting language'
text = 'This is an auto generated email using python!!!'
# Credentials (if needed)
username = 'senders_name'
password = 'password'
msg = """\
From: %s
To: %s
Subject: %s
%s
""" % (sender, receiver, subject, text)
# The actual mail send
server = smtplib.SMTP('smtp.gmail.com:587')
server.starttls()
server.login(username,password)
server.sendmail(sender, receiver, msg)
server.quit()
if the file name is mail.py
run this command in terminal by typing
>>python mail.py
If you want to send a mail you have to follow several steps including the following.
open up the web browser.
login into your account.
click on compose mail.
compose the message specify receiver and send the mail.
But if you can send a mail through a script it will save time for you.
Here is a python code for send a mail.
import smtplib
sender= 'senders_name@gmail.com'
receiver = 'receivers_name@gmail.com'
subject='Python is a powerful scripting language'
text = 'This is an auto generated email using python!!!'
# Credentials (if needed)
username = 'senders_name'
password = 'password'
msg = """\
From: %s
To: %s
Subject: %s
%s
""" % (sender, receiver, subject, text)
# The actual mail send
server = smtplib.SMTP('smtp.gmail.com:587')
server.starttls()
server.login(username,password)
server.sendmail(sender, receiver, msg)
server.quit()
if the file name is mail.py
run this command in terminal by typing
>>python mail.py
Monday, December 12, 2011
How to access and see web contents without a browser
Hi all,
Have you ever seen contents of web pages without a web browser? There is a method in ubuntu to read web pages in terminal.This is really easy and it is a matter of installing just a one package.
sudo apt-cache search elinks
elinks - advanced text-mode WWW browser
sudo apt-get install elinks
to visit google :
>>elinks www.google.com
Have you ever seen contents of web pages without a web browser? There is a method in ubuntu to read web pages in terminal.This is really easy and it is a matter of installing just a one package.
sudo apt-cache search elinks
elinks - advanced text-mode WWW browser
sudo apt-get install elinks
to visit google :
>>elinks www.google.com
Saturday, November 19, 2011
Lenovo Laptops with Ubuntu 11.04
Me and my team encountered with this problem when we are testing our OS on laptops. We installed it to various laptops and this Lenovo laptops make us a big headache. Because Ubuntu has many hardware compatibility problems, most of the Lenovo laptops are not supporting to this compatibilities.
We find few issues when installing and running Ubuntu on Lenovo laptops.
1.System boots to garbled display
Refer this link and you can find the solution.
https://bugs.launchpad.net/ubuntu/natty/+source/grub-gfxpayload-lists/+bug/777212
2.Splash screen is not working properly when booting up.
This isn't solved yet. The problem is Lenovo is not picking up the correct resolution when the machine boots up and it directly calls to the text splash screen as my knowledge. when machine boots it will pick the resolution correctly and it outputs the correct splash screen. Suppose to give the solved answer when we fixed this issue.
3.Lenevo L412 slow to restart and shutdown .
This is another problem that occur when we testing the os on Lenovo L412. It took more and more time to restart and shutdown. We tried to find the reason few days and we couldn't at last we found it is a problem with the third party software called Likewise that we use join the machines to the domain. There were some processes that wouldn't kill when its shutting down. So the shutting down is waiting until this process kills. Our project manager Chamindra de Silva helped us to fix this issue.
1. Observe what is the process take more time to kill.
Press ALT + CTRL + F1 on the shutting-down splash screen then it will show what are the processes are killing. For me it was Likewise. There was a process that runs with likewise that took more time to kill. So what we do was go to the likewise source where /opt/likewise. Then went through the code and force to kill all all processes rather than hanging.
We find few issues when installing and running Ubuntu on Lenovo laptops.
1.System boots to garbled display
Refer this link and you can find the solution.
https://bugs.launchpad.net/ubuntu/natty/+source/grub-gfxpayload-lists/+bug/777212
2.Splash screen is not working properly when booting up.
This isn't solved yet. The problem is Lenovo is not picking up the correct resolution when the machine boots up and it directly calls to the text splash screen as my knowledge. when machine boots it will pick the resolution correctly and it outputs the correct splash screen. Suppose to give the solved answer when we fixed this issue.
3.Lenevo L412 slow to restart and shutdown .
This is another problem that occur when we testing the os on Lenovo L412. It took more and more time to restart and shutdown. We tried to find the reason few days and we couldn't at last we found it is a problem with the third party software called Likewise that we use join the machines to the domain. There were some processes that wouldn't kill when its shutting down. So the shutting down is waiting until this process kills. Our project manager Chamindra de Silva helped us to fix this issue.
1. Observe what is the process take more time to kill.
Press ALT + CTRL + F1 on the shutting-down splash screen then it will show what are the processes are killing. For me it was Likewise. There was a process that runs with likewise that took more time to kill. So what we do was go to the likewise source where /opt/likewise. Then went through the code and force to kill all all processes rather than hanging.
Wednesday, November 2, 2011
Basic customizations in ubuntu 11.04 using bash
How to change the wallpaper:
in terminal type
gconftool-2 --type string --set /desktop/gnome/background/picture_filename "path/to/wallpaper"
How to change the login window icon:
in terminal type
sudo cp path/to/icon /usr/share/icons/LoginIcons/apps/64/
create desktop shortcuts:
in terminal type the follwing 2 commands.
cp /usr/share/applications/any_file.desktop ~/Desktop
chmod +x ~/Desktop/any_file.desktop
If you have screenlets installed how to run sreenlets in terminal.
type the following command.
ex:run calculator screenlet:
python /usr/share/screenlets/screenlets-pack-basic/Calc/CalcScreenlet.py
change start menu icon:
in terminal type:
gconftool-2 --type string --set /apps/panel/objects/object_0/custom_icon "path/to/icon"
gconftool-2 --type bool --set /apps/panel/objects/object_0/use_custom_icon "true"
in terminal type
gconftool-2 --type string --set /desktop/gnome/background/picture_filename "path/to/wallpaper"
How to change the login window icon:
in terminal type
sudo cp path/to/icon /usr/share/icons/LoginIcons/apps/64/
create desktop shortcuts:
in terminal type the follwing 2 commands.
cp /usr/share/applications/any_file.desktop ~/Desktop
chmod +x ~/Desktop/any_file.desktop
If you have screenlets installed how to run sreenlets in terminal.
type the following command.
ex:run calculator screenlet:
python /usr/share/screenlets/screenlets-pack-basic/Calc/CalcScreenlet.py
change start menu icon:
in terminal type:
gconftool-2 --type string --set /apps/panel/objects/object_0/custom_icon "path/to/icon"
gconftool-2 --type bool --set /apps/panel/objects/object_0/use_custom_icon "true"
Menu editing in ubuntu 11.04
I assume you know that you can edit menus by right clicking main menu bar.You can edit your menu system as you want using that way very easily.But do you know that where these configurations are saved in your machine. Knowing these locations are really helpful when you want edit the menu system by script or if you want to make the exact menu system in another machine.
So here are the locations you should know.
applications.menu file location: ~/.config/menus/
.directory files location: ~/.local/share/desktop-directories/
.desktop files location: ~/.local/share/applications/
if you want to create the same menu system in another machine it is a matter of copying all those files into relevant locations of that machine.
Also remember to execute the following comamnd after file copying.
sudo killall gnome-panel
So here are the locations you should know.
applications.menu file location: ~/.config/menus/
.directory files location: ~/.local/share/desktop-directories/
.desktop files location: ~/.local/share/applications/
if you want to create the same menu system in another machine it is a matter of copying all those files into relevant locations of that machine.
Also remember to execute the following comamnd after file copying.
sudo killall gnome-panel
How to set visible your domain account in login window ubuntu 11.04
THIS IS APPLICABLE TO UBUNTU 11.04
Normally when you are in a network you can log into basically 2 types of accounts which are local accounts and domain accounts. If you want to log into your domain account you have to click the 'other' category in the login window and enter your username.But this may be a bit annoying and there is a way to set visible your domain account name in your login window and even hide any local accounts.
This is the way.
step 1:
log in to your domain account.Find the uid of you by typing id command in terminal.
example:
>id
uid=123456789(DOMAIN\username) gid=0(root) groups=0(root)
Here the UID is 123456789.
step 2:
add the following line to /etc/passwd file.repalce UID with the number you have found in the previous step.
DOMAIN\username:x:UID:0:Name_To_Be_Shown,,,:/home/local/DOMAIN/username:/bin/bash
step 3:(optional)
Hide local accounts from the login window.
edit /etc/gdm/custom.conf as follows.
[daemon]
TimedLoginEnable=false
AutomaticLoginEnable=false
TimedLogin=user
AutomaticLogin=user
TimedLoginDelay=30
DefaultSession=gnome-2d
[greeter]
#IncludeAll=false
Exclude=ALL THE LOCAL ACCOUNT NAMES WHICH SHOULD BE HIDDEN SEPARETED BY COMMAS.
Log out from the current session and see your domain account appearing in the login window.ENJOY!!!
Normally when you are in a network you can log into basically 2 types of accounts which are local accounts and domain accounts. If you want to log into your domain account you have to click the 'other' category in the login window and enter your username.But this may be a bit annoying and there is a way to set visible your domain account name in your login window and even hide any local accounts.
This is the way.
step 1:
log in to your domain account.Find the uid of you by typing id command in terminal.
example:
>id
uid=123456789(DOMAIN\username) gid=0(root) groups=0(root)
Here the UID is 123456789.
step 2:
add the following line to /etc/passwd file.repalce UID with the number you have found in the previous step.
DOMAIN\username:x:UID:0:Name_To_Be_Shown,,,:/home/local/DOMAIN/username:/bin/bash
step 3:(optional)
Hide local accounts from the login window.
edit /etc/gdm/custom.conf as follows.
[daemon]
TimedLoginEnable=false
AutomaticLoginEnable=false
TimedLogin=user
AutomaticLogin=user
TimedLoginDelay=30
DefaultSession=gnome-2d
[greeter]
#IncludeAll=false
Exclude=ALL THE LOCAL ACCOUNT NAMES WHICH SHOULD BE HIDDEN SEPARETED BY COMMAS.
Log out from the current session and see your domain account appearing in the login window.ENJOY!!!
Monday, October 24, 2011
How to get files from your crashed hard disk.
Step 1
boot the machine using live cd.
Step 2
press ctrl+alt+F2.Now You are in non gui mode
Step 3
Type fdisk -l
Now you can see what are available partitions in hard disk.
lets assume you need to mount /dev/sda1
Step 4
make directroy to mount the harddisk partition
mkdir /test
Step 5
mount hard disk typing below command
mount /dev/sda1 /test
Step 6
now go to /test directory and you can do any file operation in that partition.
Type ls
cheers
kwak
boot the machine using live cd.
Step 2
press ctrl+alt+F2.Now You are in non gui mode
Step 3
Type fdisk -l
Now you can see what are available partitions in hard disk.
lets assume you need to mount /dev/sda1
Step 4
make directroy to mount the harddisk partition
mkdir /test
Step 5
mount hard disk typing below command
mount /dev/sda1 /test
Step 6
now go to /test directory and you can do any file operation in that partition.
Type ls
cheers
kwak
Monday, September 5, 2011
How to setup an apt-cacher in ubuntu 11.04?
Following is the scenario which we had to come up with an apt-cacher set up.
There are several machines Ubutnu 11.04 installed and each time one user needs a software installed he runs
sudo apt-get instal command and this is done by each user in each machine which would eats up the bandwidth.
Instead of that caching the installed software can have a dramatic impact on the use of bandwidth.Apt-cacher is a tool
which would act as middle man between the public repository and the LAN clients, sharing any common downloads internally.
i.e. whenever a user requests for a new installation or an update for the first time, the tool would download them from the public repository and store it and pass it back to that user. The package is then made available to any future requests from the internal network.When another user requests for the same installation instead of going to the public repository again it woul pass from what is already installed.
Setting up the apt-cacher is quite simple and is described below.
First we need apt-cacher and some tools installed.
Do a sudo aptitude install apt-cacher
sudo aptitude install apache2
To activate the service edit /etc/default/apt-cacher file and change the AUTOSTART value to "1".
You can also limit access to the cache within the /etc/apt-cacher/apt-cacher.conf file. Update the value for allowed_hosts to match the individual hosts or subnets that you want to allow.
To start the caching system type in cmdline, sudo /etc/init.d/apt-cacher restart.
Now you have the apt-cacher up and running.The final step is to set up the client.
Following is the scenario which we had to come up with an apt-cacher set up.
There are several machines Ubutnu 11.04 installed and each time one user needs a software installed he runs
sudo apt-get instal command and this is done by each user in each machine which would eats up the bandwidth.
Instead of that caching the installed software can have a dramatic impact on the use of bandwidth.Apt-cacher is a tool
which would act as middle man between the public repository and the LAN clients, sharing any common downloads internally.
i.e. whenever a user requests for a new installation or an update for the first time, the tool would download them from the public repository and store it and pass it back to that user. The package is then made available to any future requests from the internal network.When another user requests for the same installation instead of going to the public repository again it woul pass from what is already installed.
Setting up the apt-cacher is quite simple and is described below.
First we need apt-cacher and some tools installed.
Do a sudo aptitude install apt-cacher
sudo aptitude install apache2
To activate the service edit /etc/default/apt-cacher file and change the AUTOSTART value to "1".
You can also limit access to the cache within the /etc/apt-cacher/apt-cacher.conf file. Update the value for allowed_hosts to match the individual hosts or subnets that you want to allow.
To start the caching system type in cmdline, sudo /etc/init.d/apt-cacher restart.
Now you have the apt-cacher up and running.The final step is to set up the client.
Add a proxy setting to the /etc/apt/apt.conf.d/ directory. To do this is create a new file called 90-apt-proxy.conf and entering the line. Following would open up the file in gedit.
sudo gedit /etc/apt/apt.conf.d/90-apt-proxy.conf
Enter the following line to that file.
Acquire::http::Proxy "http://cache-ip:3142";
Replace "cache-ip " with the IP address or URL of the machine you installed apt-cacher in.
There is no limit of the no of machines you can point to the apt-cacher.
Before ending the post I must say thank you to this web post. It was very hard to find the exact information while we were working on this and hope this post would help those are in the same scenario.
Have a great day!: )
Monday, August 29, 2011
Integer and string Comparison in bash
Integer Comparison
There are 2 ways of comparing integers.
let's consider a and b as integer variables.
if [ "$a" -eq "$b" ] -checks weather $a equals to $b
if [ "$a" -ne "$b" ] -checks weather $a not equals to $b
if [ "$a" -gt "$b" ] or if(("$a" > "$b")) -checks weather $a is greater than $b
if [ "$a" -ge "$b" ] or if(("$a" >= "$b")) -checks weather $a is greater than or equal to $b
if [ "$a" -lt "$b" ] or if(("$a" < "$b")) -checks weather $a is less than $b
if [ "$a" -le "$b" ] or if(("$a" <= "$b")) -checks weather $a is less than or equal to $b
String Comparison
let's consider a and b as string variables.
if [ "$a" = "$b" ] -checks weather two strings are equal
if [ "$a" != "$b" ] -checks weather two strings are different
Useful built-in variables in bash
In bash scripting there are extremely useful build-in variables which we must know.
Given below are some of them.
$#-Number of arguments passed to the script.
$?-Exit status of the last command executed.
$!-Pid of the last command executed.
$$-Pid of the script.
Given below are some of them.
$#-Number of arguments passed to the script.
$?-Exit status of the last command executed.
$!-Pid of the last command executed.
$$-Pid of the script.
How to play sound files in bash
Playing sound files in bash is pretty simple.
All you have do is get install mplayer and execute the command.
sudo apt-get install mplayer
mplayer /path/to/sound/file
All you have do is get install mplayer and execute the command.
sudo apt-get install mplayer
mplayer /path/to/sound/file
Tuesday, August 23, 2011
How to add new menu to the applications menu in ubuntu
how to add new menu to the applications menu in ubuntu
most of us know that we can add new menu to applications menu by right clicking main menu bar and selecting edit menus.Then a window appears with existing menus and you can add any number of menus and items into them. This is a super simple approach which everyone can follow without much trouble.
But what if you need to edit menus programmatically.Do you know how to do it???
This is the guide for you if you need something like that.
first you need to identify the file which specifies the applications menu in ubuntu.It is applications.menu file located in /etc/xdg/menus/ directory.
locate it and examine bit carefully the tag structure in there.If you are familiar with HTML code tags you will understand it easily.
Follow these steps:
1.Open up a terminal and type sudo nautilus,give password,it will give you a file browser with root privilages. We need root privilages since we are going to edit applications.menu file.
2.open applications.menu file in your favourite text editor.You will see there are tag blocks for development,education,science etc. So what we should do is create our own code block which generates our custom menu. Example code block is given below.
< menu >
< name > MyMenuName < /name >
< directory> myMenu.directory < /directory>
< include>
< and>
< category> custom < /category>
< /and>
< /include>
< /menu>
3.place the above code block in between two existing code blocks. for example in between education and science.
Here is a brief description of what the above code really means:
< name> MyMenuName < name>
This tag defines the name of the menu which is self explanatory.But remember it is not the menu visible name in case we specify a name in myMenu.directory file.if we don't give a name in myMenu.directory file it is the menu visible name.The .directory file is explained in the next step.
<directory> myMenu.directory></directory>
There is a .directory file for each of the menus. So we should create a .directory file for our menu and it's name should be given here.
<include>
<and><
<category>custom></category>
/and>
</include>
This part is really important to understand since this determines which are the applications categorized under this menu.><category>custom></category> line indicates that all the applications which has category of "custom" are put in to this menu.
4.Next step is to create a .directory file for our menu.
example myMenu.directory file
[Desktop Entry]
Name=My apps
Comment=my Applications
Icon=/path/to/icon
Type=Directory
X-Ubuntu-Gettext-Domain=gnome-menus
Name specifies the visible name for our menu.And under icon give the path to the icon.
5.place this myMenu.directory file under /usr/share/desktop-directories.
now you are almost done.
6.The new menu will not visible straight-away since there are no items to display. So you can one of the things to get visible your new menu.
i.create your own debian package with category custom and get install it. After the installation new menu will appear with the new application under it.
If you need help in creating debian packages see the article "How to create debian packages".
ii.changecustom to office .then you will see your new menu but with all the office type applications under it.
Here office is used just as an example.
most of us know that we can add new menu to applications menu by right clicking main menu bar and selecting edit menus.Then a window appears with existing menus and you can add any number of menus and items into them. This is a super simple approach which everyone can follow without much trouble.
But what if you need to edit menus programmatically.Do you know how to do it???
This is the guide for you if you need something like that.
first you need to identify the file which specifies the applications menu in ubuntu.It is applications.menu file located in /etc/xdg/menus/ directory.
locate it and examine bit carefully the tag structure in there.If you are familiar with HTML code tags you will understand it easily.
Follow these steps:
1.Open up a terminal and type sudo nautilus,give password,it will give you a file browser with root privilages. We need root privilages since we are going to edit applications.menu file.
2.open applications.menu file in your favourite text editor.You will see there are tag blocks for development,education,science etc. So what we should do is create our own code block which generates our custom menu. Example code block is given below.
< menu >
< name > MyMenuName < /name >
< directory> myMenu.directory < /directory>
< include>
< and>
< category> custom < /category>
< /and>
< /include>
< /menu>
3.place the above code block in between two existing code blocks. for example in between education and science.
Here is a brief description of what the above code really means:
< name> MyMenuName < name>
This tag defines the name of the menu which is self explanatory.But remember it is not the menu visible name in case we specify a name in myMenu.directory file.if we don't give a name in myMenu.directory file it is the menu visible name.The .directory file is explained in the next step.
<directory> myMenu.directory></directory>
There is a .directory file for each of the menus. So we should create a .directory file for our menu and it's name should be given here.
<include>
<and><
<category>custom></category>
/and>
</include>
This part is really important to understand since this determines which are the applications categorized under this menu.><category>custom></category> line indicates that all the applications which has category of "custom" are put in to this menu.
4.Next step is to create a .directory file for our menu.
example myMenu.directory file
[Desktop Entry]
Name=My apps
Comment=my Applications
Icon=/path/to/icon
Type=Directory
X-Ubuntu-Gettext-Domain=gnome-menus
Name specifies the visible name for our menu.And under icon give the path to the icon.
5.place this myMenu.directory file under /usr/share/desktop-directories.
now you are almost done.
6.The new menu will not visible straight-away since there are no items to display. So you can one of the things to get visible your new menu.
i.create your own debian package with category custom and get install it. After the installation new menu will appear with the new application under it.
If you need help in creating debian packages see the article "How to create debian packages".
ii.change
Here office is used just as an example.
Tuesday, August 9, 2011
how to make a text file from terminel easily
how to make a text file from terminal easily
you have to do just only two small steps
step 1
open the terminal and go to location which you want to create a text file
step2
Type the command as below
cat > file.txt
now enter anything which should include inside of the file.txt
now press ctrl+d to save that file.
ok you are done.
cheers.......kwak
you have to do just only two small steps
step 1
open the terminal and go to location which you want to create a text file
step2
Type the command as below
cat > file.txt
now enter anything which should include inside of the file.txt
now press ctrl+d to save that file.
ok you are done.
cheers.......kwak
Sunday, July 31, 2011
How to make a simple easter egg in ubuntu
How To Make A Simple Easter Egg in Ubuntu
Do you know "apt-get moo" ubuntu easter egg
If not
1)Go to terminal
2)Type "apt-get moo"
Now you can see
************************************
rukshan@rukshan:~$ apt-get moo
(__)
(oo)
/------\/
/ | ||
* /\---/\
~~ ~~
...."Have you mooed today?"...
************************************
Lets learn how make that type simple easter egg
Step1
Make small shell file which echo something like above.(lets take easter.sh)
#!/bin/bash
echo "---------********-----------"
echo "------------*****-------------"
echo "---------------*-----------------"
Step2
*Then Make a executable form that shell file.(easter.sh)
*If You do not know How to make a executable from shell file.refer below link
http://vatfossworld.blogspot.com/2011/07/how-to-make-executable-file-from-shell.html
Step3
*Rename that executable file as you need.(any name which like.as a example i
renamed it as "vos")
*Then Copy it to /bin Folder
Step4
*ok you are already done.
*Now go to terminal type your executable file name(in my case i just typed "vos")
now you can see
---------********-----------
------------*****-------------
---------------*-----------------
This is your easter egg .Enjoy Your Own Easter Egg
CHEERS.....KWAK
Do you know "apt-get moo" ubuntu easter egg
If not
1)Go to terminal
2)Type "apt-get moo"
Now you can see
************************************
rukshan@rukshan:~$ apt-get moo
(__)
(oo)
/------\/
/ | ||
* /\---/\
~~ ~~
...."Have you mooed today?"...
************************************
Lets learn how make that type simple easter egg
Step1
Make small shell file which echo something like above.(lets take easter.sh)
#!/bin/bash
echo "---------********-----------"
echo "------------*****-------------"
echo "---------------*-----------------"
Step2
*Then Make a executable form that shell file.(easter.sh)
*If You do not know How to make a executable from shell file.refer below link
http://vatfossworld.blogspot.com/2011/07/how-to-make-executable-file-from-shell.html
Step3
*Rename that executable file as you need.(any name which like.as a example i
renamed it as "vos")
*Then Copy it to /bin Folder
Step4
*ok you are already done.
*Now go to terminal type your executable file name(in my case i just typed "vos")
now you can see
---------********-----------
------------*****-------------
---------------*-----------------
This is your easter egg .Enjoy Your Own Easter Egg
CHEERS.....KWAK
How to enable your touch pad
I came across this problem when im working Ubuntu with my laptop. I noticed my touch pad is not working and i couldn't do any thing using my mouse. So I restart my machine and check but i couldn't find a way to re-enable the Synaptic Touchpad of my HP Pavilion Dv5. When im restaring my computer my i noticed my mouse works fine on the login screen, i was happy but after logged in again it doesn't work.
This can be happened when you suspend your computer with the disabled mouse pad(with the physical button ).
You can do this by using Gconf-editor GUI by Desktop -> Gnome -> peripherals -> touchpad then doing the Touch pad enable true
This is how you can do it by using terminal.
Command Line(Terminal) The Easy way
This can be happened when you suspend your computer with the disabled mouse pad(with the physical button ).
You can do this by using Gconf-editor GUI by Desktop -> Gnome -> peripherals -> touchpad then doing the Touch pad enable true
This is how you can do it by using terminal.
Command Line(Terminal) The Easy way
gconftool-2 --set --type boolean /desktop/gnome/peripherals/touchpad/touchpad_enabled
Type this command and just press enter your mouse will work properly.
Friday, July 29, 2011
How to remove installed software packages in ubuntu
In normal case, if you want to remove a good quality software package you can remove it easily using,
1. synaptic package manager(GUI method) or
2. in terminal type sudo apt-get --purge remove yourpackagename
This should remove the package from the system.
wrost case:
But there are some cases, you try to install some bad quality software packages, after that the synaptic package manager crashes and you cant open up it.
And also you can't use terminal to remove it.
The real headache is you may not be able to install or remove any software package using software center or terminal.
if you are in this kind of situation the following command is the solution.
sudo dpkg --remove --force-remove-reinstreq yourpackagename
1. synaptic package manager(GUI method) or
2. in terminal type sudo apt-get --purge remove yourpackagename
This should remove the package from the system.
wrost case:
But there are some cases, you try to install some bad quality software packages, after that the synaptic package manager crashes and you cant open up it.
And also you can't use terminal to remove it.
The real headache is you may not be able to install or remove any software package using software center or terminal.
if you are in this kind of situation the following command is the solution.
sudo dpkg --remove --force-remove-reinstreq yourpackagename
if you want to list all the packages in your system and make sure weather the package has removed properly, use the following command.
dpkg --list
note:
I personally had to face that problem from which i had to face many difficulties.
I personally had to face that problem from which i had to face many difficulties.
How to find out grub version of your machine
Open the terminal and type
$grub-install -v
This will print something like below.
grub-install (GRUB) 1.99~rc1-13ubuntu3
$grub-install -v
This will print something like below.
grub-install (GRUB) 1.99~rc1-13ubuntu3
In the example, it is showing that GRUB2 is installed in your machine.
Don’t misunderstand “1” in the version number, as legacy GRUB will display as 0.97 (or earlier) :)
Thursday, July 28, 2011
How to create dialog boxes in shell scripting using zenity tool
zenity is a simple gui creation tool which comes default in ubuntu 11.04.you can make use of this tool to create nice dialog boxes in your shell scripts.
example explaination:
To ask a question from user add the following lines to where it should prompt.
zenity --question --text "Are you sure you want to continue ?"
echo $?
$? variable will contain the output of the GUI.
if user clicks yes $? variable will contain 0
if user clicks no $? variable will contain 1
according to the content of the $? you can do whatever you wish.
These are some other dialog boxes you can use.
1.To give warnings to the user
zenity --warning --text "This will kill, are you sure?";echo $?
2.To create a radio list
ans=$(zenity --list --text "How good are you in java?" --radiolist --column "Pick" --column "Opinion" TRUE expert FALSE Average FALSE "moderate" FALSE "newbe"); echo $ans
this will print the option user selected.
3. To create a check list
ans=$(zenity --list --text "What do you want?" --checklist --column "Pick" --column "options" TRUE "rice" TRUE "egg" FALSE "fish" FALSE "chicken" --separator=":"); echo $ans
this will print: rice:egg
4.To get a date from user
szDate=$(zenity --calendar --text "Pick a day" --title "Medical Leave" --day 30 --month 7 --year 2011); echo $szDate
this will print date as follows:
07/30/11
5.To get text input from user
szAnswer=$(zenity --entry --text "what is your name?" --entry-text ""); echo $szAnswer
this will print the user input.
6.To give the error message
zenity --error --text "Installation failed! "
7.To give information to the user
zenity --info --text "this is a blog you can get more geek stuff"
you can find out more zenity dialog boxes through internet.
Enjoy using zenity dialog boxes!!!!
example explaination:
To ask a question from user add the following lines to where it should prompt.
zenity --question --text "Are you sure you want to continue ?"
echo $?
$? variable will contain the output of the GUI.
if user clicks yes $? variable will contain 0
if user clicks no $? variable will contain 1
according to the content of the $? you can do whatever you wish.
These are some other dialog boxes you can use.
1.To give warnings to the user
zenity --warning --text "This will kill, are you sure?";echo $?
2.To create a radio list
ans=$(zenity --list --text "How good are you in java?" --radiolist --column "Pick" --column "Opinion" TRUE expert FALSE Average FALSE "moderate" FALSE "newbe"); echo $ans
this will print the option user selected.
3. To create a check list
ans=$(zenity --list --text "What do you want?" --checklist --column "Pick" --column "options" TRUE "rice" TRUE "egg" FALSE "fish" FALSE "chicken" --separator=":"); echo $ans
this will print: rice:egg
4.To get a date from user
szDate=$(zenity --calendar --text "Pick a day" --title "Medical Leave" --day 30 --month 7 --year 2011); echo $szDate
this will print date as follows:
07/30/11
5.To get text input from user
szAnswer=$(zenity --entry --text "what is your name?" --entry-text ""); echo $szAnswer
this will print the user input.
6.To give the error message
zenity --error --text "Installation failed! "
7.To give information to the user
zenity --info --text "this is a blog you can get more geek stuff"
you can find out more zenity dialog boxes through internet.
Enjoy using zenity dialog boxes!!!!
How to change splash screen in Ubuntu Natty
Do not like the purple coloured screen and the ubuntu name that appears when the machine boots up to Ubuntu ?
1.Then below is a simple way of changing it as you wish.I would like to offer total credit to following guide.
http://jechem.blogspot.com/2010/10/how-to-change-splash-screen-in-ubuntu.html
- First create a directory named customsplash in /lib/plymouth/themes/
For that type in the terminal,
sudo mkdir /lib/plymouth/themes/customsplash
Then you need to create customsplash.script.To do that just type following and it would open a gedit window for you.
sudo gedit /lib/plymouth/themes/simple/simple.script
Then copy and paste Following
customsplash_image = Image("customsplash.png");
screen_ratio = Window.GetHeight() / Window.GetWidth();
customsplash_image_ratio = customsplash_image.GetHeight() / customsplash_image.GetWidth();
if (screen_ratio < customsplash_image_ratio)
{
scale_factor = Window.GetHeight() / customsplash_image.GetHeight();
}
else
{
scale_factor = Window.GetWidth() / customsplash_image.GetWidth();
}
scaled_customsplash_image = customsplash_image.Scale(customsplash_image.GetWidth() * scale_factor,
customsplash_image.GetHeight() * scale_factor);
customsplash_sprite = Sprite(scaled_customsplash_image);
customsplash_sprite.SetX(Window.GetWidth() / 2 - scaled_customsplash_image.GetWidth () / 2);
customsplash_sprite.SetY(Window.GetHeight() / 2 - scaled_customsplash_image.GetHeight() / 2);
customsplash_sprite.SetZ(-10000);
customsplash_image = Image("customsplash.png");
screen_ratio = Window.GetHeight() / Window.GetWidth();
customsplash_image_ratio = customsplash_image.GetHeight() / customsplash_image.GetWidth();
if (screen_ratio < customsplash_image_ratio)
{
scale_factor = Window.GetHeight() / customsplash_image.GetHeight();
}
else
{
scale_factor = Window.GetWidth() / customsplash_image.GetWidth();
}
scaled_customsplash_image = customsplash_image.Scale(customsplash_image.GetWidth() * scale_factor,
customsplash_image.GetHeight() * scale_factor);
customsplash_sprite = Sprite(scaled_customsplash_image);
customsplash_sprite.SetX(Window.GetWidth() / 2 - scaled_customsplash_image.GetWidth () / 2);
customsplash_sprite.SetY(Window.GetHeight() / 2 - scaled_customsplash_image.GetHeight() / 2);
customsplash_sprite.SetZ(-10000);
Save the file and exit.
Next type in terminal:
sudo gedit /lib/plymouth/themes/customsplash/customsplash.plymouth
Then copy and paste this:
[Plymouth Theme]
Name=simple
Description=Personalized theme
ModuleName=script
ModuleName=script
[script]
ImageDir=/lib/plymouth/themes/simple
ScriptFile=/lib/plymouth/themes/simple/simple.script
Save and exit.
Next type in terminal:
sudo gedit /lib/plymouth/themes/customsplash/customsplash.plymouth
Then copy and paste this:
[Plymouth Theme]
Name=customsplash
Description=Personalized theme
ModuleName=script
[script]
ImageDir=/lib/plymouth/themes/customsplash
ScriptFile=/lib/plymouth/themes/customsplash/customsplash.script
Save and exit.
Then, in terminal type:
sudo nautilus
Type your password.
Navigate to File System>lib>plymouth>themes>customsplash
Copy and paste the picture you want to be on the splash screen. Rename that picture to customsplash.png.
Now You need to update your current plymouth theme.
sudo update-alternatives --install /lib/plymouth/themes/default.plymouth default.plymouth /lib/plymouth/themes/customsplash/customsplash.plymouth 100
sudo update-alternatives --config default.plymouth
choose customsplash.plymouth.
Still in terminal type:
sudo update-initramfs -u
Reboot and you will see your new splash screen.
You can perform this update via splash screen manager.To install this type in terminal.
sudo apt-get install splashscreenmanager
Then you can select the folder where your customised theme is in after running splash screen manager application.
Reboot and you will see your new splash screen.
2.Another way of changing the splash screen is just to do a little tweak in the file system.
You can find your default plymouth theme details inside /lib/plymouth/themes/ubuntulogo folder.Do a 'sudo nautilus ' in the terminal so that you can edit it's contents.Open them in gimp image editor and edit them according to your wish.
Changing ubuntulogo.png would change the splashscreen image and also you can edit the progress dot.
Remember to update your current plymouth theme as described above after applying above changes.
Have your own splash and enjoy.
Guess what?Once we used one of friend's splash screen to greet him on his birthday.He was quite happy to see 'Happy Birthday' on his splash screen instead of the usual screen.:)
May be that is one of the advantages of knowing such tweaks.Suprise your friends:)
How to make executable file from a shell script file
To create a executable from a shell script file you should have shell compiler installed in your machine.
first of all download it from the following link.
http://www.datsi.fi.upm.es/~frosal/
you should get the following archive.
shc-3.8.7.tgz
then install it as follows,
To create a executable,
first of all download it from the following link.
http://www.datsi.fi.upm.es/~frosal/
you should get the following archive.
shc-3.8.7.tgz
then install it as follows,
1.extract the shc-3.8.7.tgz archive
2.open up a terminal and type
$sudo mkdir -p /usr/local/man/man1
this will require your password.
3.In terminal go to the extracted location (inside shc-3.8.7 directory) and type,
$sudo make install
this should insatall shc in your machine.
To make sure shell compiler is properly installed,type the following
$shc
this should print something like this,
shc parse(-f): No source file specified
shc Usage: shc [-e date] [-m addr] [-i iopt] [-x cmnd] [-l lopt] [-rvDTCAh] -f script
To create a executable,
How to open up file browser with root permission
open up a terminal and type
sudo nautilus or
gksu nautilus
sudo nautilus or
gksu nautilus
How to create debian packages
Using a debian package is one of the best methods for installing, upgrading, and removing software.
Before you creating a debian package you should know exactly where should go each files/folders in your software when installing.
Refer the following folder structure to decide which file to go which folder.
usr/share/ - main program binaries, packages, manuals, resource files.
/usr/bin - symbolic links to the main program binaries or you can have main program binaries.
/etc/- program configuration files.
/etc/skel - default configurations files to be installed for every new user.
Also ,Before doing all below, you should have installed the tools you need for creating deb packages.
To install all the packages needed for creating a .deb package, run the following command:
sudo apt-get install build-essential autoconf automake autotools-dev dh-make debhelper devscripts fakeroot xutils lintian pbuilder
/usr/bin - symbolic links to the main program binaries or you can have main program binaries.
/etc/- program configuration files.
/etc/skel - default configurations files to be installed for every new user.
Also ,Before doing all below, you should have installed the tools you need for creating deb packages.
To install all the packages needed for creating a .deb package, run the following command:
sudo apt-get install build-essential autoconf automake autotools-dev dh-make debhelper devscripts fakeroot xutils lintian pbuilder
Here are the steps to follow to create a simple debian package.
1.Decide which file to go which folder for each of the file in your software.
2.Create a folder like ExampleDebianPackage_1.0.0
3.Inside that folder create folders like,
usr/share
usr/bin
etc/
etc/skel
and place your files inside those folders as appropriately.
4.then create another folder called DEBIAN inside ExampleDebianPackage_1.0.0
5.inside DEBIAN folder create a text file called "control" which is the most import file in debian packaging.
example control file:
Package: RoleSwitcher Version: 1.0.0 Priority: optional Architecture: allDepends: screenletsInstalled-Size: 1024Maintainer: sampath bandara amarasinghe Description: Describe what can do your software primarily. in addition to these fields there are some other fields.like this create your own control file.
now you are ready to create the debian package.
6.open up a terminal and go to the ExampleDebianPackage_1.0.0 folder location and type
dpkg -b ExampleDebianPackage_1.0.0
this will create a debian package for you,
If you really want to change your ubuntu Start Button...
When it comes to Ubuntu it gave lots of facilities to customize your own machine than other operating systems. So its time to make the best out of it, sometimes you will amaze if I say its giving the opportunity to change your start button. If you need to make your start button as you wish it only have follow some few easy steps.
The first step is creating your own image to replace with the Ubuntu default start button. Considering image type the image should be in .SVG format. Because the start button support SVG and it is a vector type image so it is scalable without having jaggies. You can create the image easily using Gimp(because Gimp Supports SVG). If you going to create this image using windows I think it will impossible to even open a SVG. So try to create your beautiful image using Gmip :). When you done with your creative artwork you should re size the images as it need. Considering the file structure of ubuntu icons it has few images sizes, like 16 * 16 , 22*22, 24 *24, 32*32. So we should create these size of images. But im not forcing you to create all of the sizes because it resize when we give any size, for now lets make a 24*24 .SVG image and save it start-here.SVG
Now you should find where these icons are laying on your system. Its easy you can find it at /root/usr/share/icons. When considering the icons it comes along with the theme. A theme can compatible with one or more icon themes. When you stepped into icons directory you can see many icon themes with various names eg:- Humanity, Dust Sand, Humanity Dark, Gnome etc. Next you should find what theme you going to use and its default icon theme. You can find it by
1. Right clicking on your desktop and go to Change Desktop Background
2. Select the theme that you need to custermize and click on custermize button
3. Then you can make sure what is the default icon theme.
By knowing the default icon theme
1.Open usr/share/icon folder with sudo (try "sudo nautilus" on terminal, this will open a GUI with root permission)
2.Than open the icon theme that you need to change.( eg. Humanity)
3.Inside humanity go to places directory(this will shows some folders with numbers, those are the folders that contains images with the relevant size).
4.Now go to each folder and search for Start-here.svg and if it is there replace the image that you have created before.
Now it show time...... Change the theme and see the new image is applied. If it is have fun with your own start button.
There are many many more things that you can do using this icon folder. Because you can replace any of the icons according to your choice. So you can say bye bye.. to any icon and you can welcome any icon that you love. Try something new and have fun with Ubuntu :) .
How to give root permission privilages to a user
There are lots of applications and commands in ubuntu which need root passwords to be executed. you can avoid giving that password always, by following steps(editing /etc/sudoers.tmp).
in terminal type
1. sudo visudo
this will open up a file in terminal
2. Locate the following line
%sudo ALL=(ALL:ALL) ALL
3. Add the following line after above line
username ALL=NOPASSWD: ALL
4. Ctrl+x
it will ask to save
5. Give yes
You are done!!!
Then it will never ask you root passwords any more for applications which needs root password. :)
How to make a startup script in ubuntu
Create a Startup Script in Ubuntu
Step 1
Make a script as you need .(example vtest.sh)
Step 2
Copy that file(vtest.sh) to /etc/init.d directory.
Step 3
run follwing command to make the permission of the file.
sudo chmod +x /etc/init.d/vtest.sh
Step 4
run follwing command to add script to startup
sudo update-rc.d vtest.sh defaults
OK you are done :-).Now restart the machine & It ll run the script at startup.
When you want to remove it from Startup
run following command
update-rc.d -f vtest.sh remove
Step 1
Make a script as you need .(example vtest.sh)
Step 2
Copy that file(vtest.sh) to /etc/init.d directory.
Step 3
run follwing command to make the permission of the file.
sudo chmod +x /etc/init.d/vtest.sh
Step 4
run follwing command to add script to startup
sudo update-rc.d vtest.sh defaults
OK you are done :-).Now restart the machine & It ll run the script at startup.
When you want to remove it from Startup
run following command
update-rc.d -f vtest.sh remove
How to pass root password for your applications.
While working on developing our applications, gksudo
How to edit your menu list in ubuntu
Most of us would love to see our own customized menu list in ubuntu,To have icons we would like for our programms,to have a menu including our programms with icons we would prefer.If you want to do this this post is for you.
1.You want to change the default icon that comes with the application.
The icons are located at /usr/share/applications folder.Look for the application for which you would like to change the icon.To apply the changes you would have to perform it as super user.Remember to do a 'sudo nautilus' on your terminal and goto above folder.
Right click on the icon on you want to change and select 'properties'.There you'll see the icon image and click on it and select the one you need.V would prefer selecting a .svg file since it is scalable.
2.You want to add a menu icon for your own script.
Tuesday, July 26, 2011
How to disable USB in an Ubuntu(Linux) machine
Considering an organization data should be very secured and protected. So USB is very vulnerable physical issue with computer data. If we could block the USB access from the users we can protect data by the people that needed. We came up this were when we creating Virtusa LiveConnect(a customized Ubuntu OS). There was a requirement form my manger to disable USB from the OS, that going to deploy in the kiosk machines and in the a meeting rooms. According to the policies of the Company the USB ports should be closed to the users. So when I got this requirement I Google on it and found some valuable resources.
----This is where you should go for disable USB----
http://www.cyberciti.biz/faq/linux-disable-modprobe-loading-of-usb-storage-driver/
According to the link there are many methods that we can do this thing. But tried with the modprobe.conf file.
Actually I did was i created a file called modprobe.conf file inside the etc directory( root/etc ). Because modprobe file used for automatic kernel module loading and can be configured to not load the USB storge. Then i write this script on it and save the file as sudo.
install usb_storage logger "formatted message"
This works for me and another amazing thing happened that was I was afraid that this will disable my USB dongle but it wouldn't because it only disable USB storages. So if you are willing to disable your USB storage, try this. On the other hand you can protect your own Ubuntu machine from unknown USB storages.
----This is where you should go for disable USB----
http://www.cyberciti.biz/faq/linux-disable-modprobe-loading-of-usb-storage-driver/
According to the link there are many methods that we can do this thing. But tried with the modprobe.conf file.
Actually I did was i created a file called modprobe.conf file inside the etc directory( root/etc ). Because modprobe file used for automatic kernel module loading and can be configured to not load the USB storge. Then i write this script on it and save the file as sudo.
This works for me and another amazing thing happened that was I was afraid that this will disable my USB dongle but it wouldn't because it only disable USB storages. So if you are willing to disable your USB storage, try this. On the other hand you can protect your own Ubuntu machine from unknown USB storages.
Wednesday, July 20, 2011
V
"Welcome aboard!" ,Said the FOSS world to us while we were working on an open source project . We are a team inspired by the help out there in the FOSS world and willing to contribute.
Subscribe to:
Posts (Atom)
