Sunday, December 18, 2011

Change User/Group Attributes to a File

It's very simple.

For User:
chown username filename
chown username directoryname

Recursively:
chown -R username directoryname

For Group:
chgrp groupname filename
chgrp groupname directoryname

Recursively:
chgrp -R groupname directoryname

-----
Change groupname and username at the same time.
chown username:groupname filename
Change username and groupname at the same time recursively.
chown -R username:groupname directoryname

Source: http://www.mysysad.com/2006/09/change-group-attributes-to-file.html

Monday, October 31, 2011

Restore Panels In Ubuntu Back To Their Default Settings

Messed up your panels in Gnome? Maybe your new to Ubuntu and accidentally deleted items or the panel itself and now you can't figure out how to get it back.

Once the Terminal window opens, enter the following command at the prompt:

gconftool-2 --shutdown

(Note: There should be no spaces between the two dashes before shutdown.)

EDIT – there is another method instead of shutting down gconfd. Instead use the following command.

gconftool --recursive-unset /apps/panel

(Remember: There should be no spaces between the two dashes before shutdown.)

Then enter the next command:

rm -rf ~/.gconf/apps/panel

And enter one more command:

pkill gnome-panel


Both top and bottom panels will appear (if missing) with their default settings. Now you can customize them to your preference and get on with using Ubuntu.

NOTE: This method will work in Gutsy Gibbon (7.10) and Hardy Heron (8.04) version of Ubuntu.

Wednesday, October 19, 2011

Skype video with Ubuntu

How to launch Skype + V4L2 directly from Gnome menus so that the webcam works:
Menu System --> Preferences --> Main Menu
In the window select Internet, then Skype
Click on [Properties] button
In Command enter:
bash -c 'export LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so; skype'

http://ubuntuforums.org/showthread.php?t=966882&page=3

https://wiki.ubuntu.com/SkypeWebCams

Tuesday, September 13, 2011

Listening to online radio stations under Linux

Method 1
Tuning into your favourite online radio stations without needing to open a dedicated music application is a breeze using RadioTray. The application runs directly from your system panel with a menu-only interface – thus making it very straightforward to use. Just don’t expect a fully featured bells-and-whistle jukebox for all RadioTray wants to do is give you access to your favourite radio stations with as few clicks as possible – a goal to which it admirably lives up to. Download RadioTray  

Method 2
I feel like a kid in a candy shop. I installed streamtuner today. Streamtuner makes thousands (no exaggeration) of internet music stations available to you. This includes all shoutcast and live365 stations. You also need to have xmms or beep-media-player or somesuch player that can play playlists. So: $sudo apt-get install streamtuner xmms and you are set! Now you can search or browse through the thousands of streams and pick the one you want to hear.

More>>
http://www.omgubuntu.co.uk/2010/06/listen-to-radio-stations-in-ubuntu-using-radiotray/ 
http://embraceubuntu.com/2006/04/05/listen-to-and-record-internet-music-radio-stations/ 
http://www.webupd8.org/2010/07/listen-to-internet-radio-in-ubuntu.html
http://www.liberiangeek.net/2010/06/listen-to-internet-radiomusic-in-ubuntu-10-04-lucid-lynx/ 
http://www.brighthub.com/hubfolio/matthew-casperson/articles/73046.aspx  

Radio Stations in Sri Lanka
http://en.wikipedia.org/wiki/List_of_radio_networks_in_Sri_Lanka
http://www.asiawaves.net/sri-lanka-radio.htm 
http://radiostationworld.com/locations/sri_lanka/radio_websites.asp

Saturday, September 10, 2011

How to change computer name in Ubuntu

Computer name is normally given during the OS installing phases. But you could easily change the computer name with a simple GUI tool which is there in Ubuntu by default.There is a command line tool as well if you are so particular.GUI tool is simple and easy to use.Here is a step by step guide on how to change the computer name.

Using GUI

Go to System -> Administration -> Networking

Network settings

General Tab -> Host Settings -> Hostname: Specify the computer name

save changes and restart your computer.

Using command line

Goto terminal and type the following

sudo gedit /etc/hostname

Change your hostname Also take a look at /etc/hosts. And change your old name to your new one too.

Source : http://ubuntumanual.org/posts/143/how-to-change-computer-name-in-ubuntu

How to reset Mysql password

ERROR 1045: Access denied for user: 'root@localhost' (Using
password: NO)

or

ERROR 1045: Access denied for user: 'root@localhost' (Using
password: YES)


To resolve this problem ,a fast and always working way is the "Password Resetting" .

How can I reset my MySQL password?

Following this procedure, you will disable access control on the MySQL server. All connexions will have a root access. It is a good thing to unplug your server from the network or at least disable remote access.

To reset your mysqld password just follow these instructions :

Stop the mysql demon process using this command :

sudo /etc/init.d/mysql stop

Start the mysqld demon process using the --skip-grant-tables option with this command

sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking &

Because you are not checking user privs at this point, it's safest to disable networking. In Dapper, /usr/bin/mysgld... did not work. However, mysqld --skip-grant-tables did.

start the mysql client process using this command

mysql -u root

from the mysql prompt execute this command to be able to change any password



FLUSH PRIVILEGES;

Then reset/update your password

SET PASSWORD FOR root@'localhost' = PASSWORD('password');

If you have a mysql root account that can connect from everywhere, you should also do:

UPDATE mysql.user SET Password=PASSWORD('newpwd') WHERE User='root';





Alternate Method:

USE mysql
UPDATE user SET Password = PASSWORD('newpwd')
WHERE Host = 'localhost' AND User = 'root';

And if you have a root account that can access from everywhere:

USE mysql
UPDATE user SET Password = PASSWORD('newpwd')
WHERE Host = '%' AND User = 'root';

For either method, once have received a message indicating a successful query (one or more rows affected), flush privileges:


FLUSH PRIVILEGES;

Then stop the mysqld process and relaunch it with the classical way:

sudo /etc/init.d/mysql stop
sudo /etc/init.d/mysql start


source https://help.ubuntu.com/community/MysqlPasswordReset

Tuesday, July 19, 2011

Install Linux Canon Printer Driver in Ubuntu

https://help.ubuntu.com/community/CanonCaptDrv190


Canon provide Debian Packages to install the driver under ubuntu for download. Offical supported is only the previous version 10.04 of ubuntu. Extracting the zip file you will find under
/32-bit_Driver/Debian
the deb packages. First thing to install is cndrvcups-common_2.20-l_i386.deb with dpkg -i . The problem is that ubuntu 11.04 doesn’t contain the required gs-esp package.
Workaround is to download and install it with
dpgk -i gs-esp_9.01~dfsg~svn12047-0ubuntu1_all.deb
After that you can install the common canon driver and afterwards the ufr driver:
dpgk -i cndrvcups-common_2.20-1_i386.deb dpgk -i cndrvcups-ufr2-uk_2.20-1_i386.deb
Now you can open the driver setup application and click on the add button. Choose network printer, enter the ip of your canon printer and click on examine. Select from the list below Canon and click on next. Select “LBP6650″ and click on next. Confirm dialog with use button. Test your configuration with printing a test page.

http://ralf.schaeftlein.de/2011/06/18/canon-lbp6650-under-ubuntu-11-04/ 


Update for 12.04

http://radu.cotescu.com/how-to-install-canon-lbp-printers-in-ubuntu/

Tuesday, July 5, 2011

How to enable the root account in Ubuntu

Ubuntu is one of the few Linux distributions out there that will not enable the root account.In case you want to enable root login on your Ubuntu system this post will show you how you can do that.

As you have noticed during the Ubuntu installation there was no question about the root password,as you might have been used to see during other Linux distributioninstallation process. This is why the root account is inactive andcan’t be used (no password configured) until we will setup a properpassword for it. To do this, we simply need to run:

sudo passwd root

This will ask for a new root password and once you confirm it, you can start using the root account to login.

In case you will want tdisable back the root account, just lock the root account by running:

sudo passwd -l root

Are you aware of any other Linux distribution that doesn’t enablethe root account at installation time? I am just curious because Ibelieve that this is a great idea… but I haven’t seen it implemented inother distributions.

http://www.neowin.net/forum/topic/524651-how-to-enable-the-root-account-in-ubuntu/

Re-Add The Weather Indicator To Ubuntu 11.04

Installation

Want to install this indicator applet? Time to add a PPA! Run the following code in the Terminal:
sudo add-apt-repository ppa:weather-indicator-team/ppa
sudo apt-get update
sudo apt-get install indicator-weather

http://www.makeuseof.com/tag/readd-weather-ubuntu-1104s-panel-linux/

Monday, July 4, 2011

Howto mount partition onto ubuntu Linux

Q. How do I mount NTFS or FAT paritions under ubuntu Linux?

A. You can mount NTFS or FAT windows partition with mount command.

=> Click on Applications
=> Select Accessories
=> Select Terminal
=> Now terminal window will be on screen.

First you need to create directory where you can attach windows partition using mount command (for example /media/c for C:):# sudo mkdir -p /media/cNow find out list of partition (click on System > Administration > Disks ) or use following command:# sudo fdisk -l

Output:

Device Boot Start End Blocks Id System
/dev/hdb1 * 1 2432 19535008+ 86 NTFS
/dev/hdb2 2433 2554 979965 82 Linux swap / Solaris
/dev/hdb3 2555 6202 29302560 83 Linux

As you see /dev/hdb1 is NTFS partition. Now type following command:# sudo mount -t ntfs -o nls=utf8,umask=0222 /dev/hdb1 /media/cTo unmount Windows NTFS partition type command:# sudo umount /media/cTo mount FAT partition type command:# sudo mkdir -p /media/d
# sudo mount -t vfat -o iocharset=utf8,umask=000 /dev/hda1 /media/d

To unmount Windows FAT (mounted at /media/d) partition type command:# sudo umount /media/d

Where,

-t : Specify file system type (such as NTFS or FAT)
umask=VALUE: Set the umask (the bitmask of the permissions that are not present). The default is the umask of the current process. The value is given in octal.
iocharset=VALUE: Character set to use for converting between 8 bit characters and 16 bit Unicode characters. The default is iso8859-1. Long filenames are stored on disk in Unicode format.

http://www.cyberciti.biz/faq/mounting-windows-partition-onto-ubuntu-linux/

Howto mount windows partition onto ubuntu Linux
http://www.psychocats.net/ubuntu/mountlinux

Install sun java on ubuntu

Java Downloads for Linux



JAVA Installation



Friday, June 17, 2011

Extract a gzip compressed tar archive in Linux

The version of tar in most Linux distributions supports gzip compression. This means that a gzipped tar file can be extracted in one simple command.


To extract the archive filename.tar.gz into the current directory:

tar xzf filename.tar.gz

If this fails, the version of tar may not support gzip compression. In this case, you can use the traditional two-stage command:
gzip -dc filename.tar.gz | tar xf -

http://www.tech-recipes.com/rx/138/extract-a-gzip-compressed-tar-archive-in-linux/

Thursday, April 21, 2011

Kill process in Linux

Q. How do I kill process in Linux?
A. Linux and all other UNIX like oses comes with kill command. The command kill sends the specified signal (such as kill process) to the specified process or process group. If no signal is specified, the TERM signal is sent.

Kill process using kill command under Linux/UNIX

kill command works under both Linux and UNIX/BSD like operating systems.

Step #1: First, you need to find out process PID (process id)

Use ps command or pidof command to find out process ID (PID). Syntax:
ps aux | grep processname
pidof processname

For example if process name is lighttpd, you can use any one of the following command to obtain process ID:
# ps aux | grep lighttpdOutput:
lighttpd  3486  0.0  0.1   4248  1432 ?        S    Jul31   0:00 /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf
lighttpd  3492  0.0  0.5  13752  3936 ?        Ss   Jul31   0:00 /usr/bin/php5-cg
OR use pidof command which is use to find the process ID of a running program:
# pidof lighttpdOutput:
3486

Step #2: kill process using PID (process id)

Above command tell you PID (3486) of lighttpd process. Now kill process using this PID:
# kill 3486
OR
# kill -9 3486
Where,
  • -9 is special Kill signal, which will kill the process.

killall command examples

DO NOT USE killall command on UNIX system (Linux only command). You can also use killall command. The killall command kill processes by name (no need to find PID):
# killall -9 lighttpd
Kill Firefox process:
# killall -9 firefox-bin
As I said earlier killall on UNIX system does something else. It kills all process and not just specific process. Do not use killall on UNIX system (use kill -9).

http://www.cyberciti.biz/faq/kill-process-in-linux-or-terminate-a-process-in-unix-or-linux-systems/

Show All Running Processes in Linux

How do I see all running process in Linux?

You need to use the ps command. It provide information about the currently running processes, including their process identification numbers (PIDs). Both Linux and UNIX support ps command to display information about all running process. ps command gives a snapshot of the current processes. If you want a repetitive update of this status, use top command.

ps command

Type the following ps command to display all running process:
# ps aux | less
Where,
  • -A: select all processes
  • a: select all processes on a terminal, including those of other users
  • x: select processes without controlling ttys

Task: see every process on the system

# ps -A
# ps -e

Task: See every process except those running as root

# ps -U root -u root -N

Task: See process run by user vivek

# ps -u vivek

Task: top command

The top program provides a dynamic real-time view of a running system. Type the top at command prompt:
# top

Task: display a tree of processes

pstree shows running processes as a tree. The tree is rooted at either pid or init if pid is omitted. If a user name is specified, all process trees rooted at processes owned by that user are shown.
$ pstree

Task: Print a process tree using ps

# ps -ejH
# ps axjf

Task: Get info about threads

Type the following command:
# ps -eLf
# ps axms

Task: Get security info

Type the following command:
# ps -eo euser,ruser,suser,fuser,f,comm,label
# ps axZ
# ps -eM

Task: Save Process Snapshot to a file

Type the following command:
# top -b -n1 > /tmp/process.log
Or you can email result to yourself:
# top -b -n1 | mail -s 'Process snapshot' you@example.com

Task: Lookup process

Use pgrep command. pgrep looks through the currently running processes and lists the process IDs which matches the selection criteria to screen. For example display firefox process id:
$ pgrep firefox
Following command will list the process called sshd which is owned by root user.
$ pgrep -u root sshd

Say hello to htop and atop

htop is interactive process viewer just like top, but allows to scroll the list vertically and horizontally to see all processes and their full command lines. Tasks related to processes (killing, renicing) can be done without entering their PIDs. To install htop type command:
# apt-get install htop
or
# yum install htop
Now type the htop command at the shell prompt:
# htop

atop program

The program atop is an interactive monitor to view the load on a Linux system. It shows the occupation of the most critical hardware resources (from a performance point of view) on system level, i.e. cpu, memory, disk and network. It also shows which processes are responsible for the indicated load with respect to cpu- and memory load on process level; disk- and network load is only shown per process if a kernel patch has been installed. Type the following command to start atop:
# atop


http://www.cyberciti.biz/faq/show-all-running-processes-in-linux/

Thursday, March 3, 2011

installing IntelliJ IDEA on ubuntu

To Install IntelliJ IDEA 8.1 on ubuntu

Following are the steps :

1.first you need install java for you need to run below command on terminal.

admin@smartproteam~$ sudo apt-get install sun-java6-jdk

2.Now you need to download IntelliJ IDEA from below source

click here to download

3.Unpack the idea-8.1.3.tar.gz with tar xfz

admin@smartproteam~$ tax xfz idea-8.1.3.tar.gz

after extracting rename the file to idea-8 to make it simple

4.now copy idea-8 file to /usr/lib/

admin@smartproteam~$ sudo idea-8 -R /usr/lib

Now you need to configure the JDK_HOME and path for IDEA

5first you need to edit /etc/environment by running below command

admin@smartproteam~$ sudo gedit /etc/environment

add below lines to /etc/environment

export JDK_HOME=”/usr/lib/jvm/java-6-sun/”

add /usr/lib/idea-8/bin to this path

PATH=”/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/idea-8/bin”

after setting above once logout and login

6.now run below idea.sh to launch the IntelliJ IDEA like below

admin@smartproteam~$ idea.sh

now you can launch the Intellij

Source

Monday, February 28, 2011

How to Install Apache, PHP, MySQL, and PHPMyAdmin on Ubuntu

Install Apache:
sudo apt-get install apache2 apache2.2-common apache2-doc apache2-mpm-prefork apache2-utils

Install PHP:
sudo apt-get install php5 libapache2-mod-php5 php5-common php5-gd php5-mysql php5-imap php5-cli php5-cgi php-pear php-auth

Install MySQL:
sudo apt-get install mysql-server mysql-client
here you will be ask to input root password for the mysql

Install PhpMyAdmin:
sudo apt-get install phpmyadmin
here you will be asked some question to configure the phpmyadmin, just go through the wizard after it finish installed.

To set up under Apache all you need to do is include the following line in /etc/apache2/apache2.conf.

Include /etc/phpmyadmin/apache.conf
(It might be no need to add this line any more - http://manoftoday.wikidot.com/ubuntu#toc26)

Now your server is ready. Before you test please make sure to restart the server:

/etc/init.d/mysql restart
/etc/init.d/apache2 restart

then point your browser to
http://localhost/phpmyadmin

Enable mod_rewrite
sudo a2enmod rewrite

Install cURL
sudo apt-get install curl libcurl3 libcurl3-dev php5-curl

Enable modules

sudo a2enmod cache & a2enmod disk_cache & a2enmod proxy & a2enmod proxy_http & a2enmod headers & a2enmod expires


Other tools

sudo apt-get install php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl


[SOLVED] “Could not reliably determine the server’s fully qualified domain name, using … for ServerName”

You might probably faced the same following error while you were restarting the Apache server on Ubuntu.

in either httpd.conf or apache2.conf in /etc/apache2 and restart apache the notice will disappear. 

sudo gedit /etc/apache2/httpd.conf
sudo gedit /etc/apache2/apache2.conf

By default httpd.conf file will be blank. Now, simply add the following line to the file.

ServerName localhost

Save the file and exit from gEdit.

Finally restart the server.
sudo /etc/init.d/apache2 restart

(http://russenreaktor.wordpress.com/2010/04/17/solved-%E2%80%9Ccould-not-reliably-determine-the-server%E2%80%99s-fully-qualified-domain-name-using-for-servername%E2%80%9D/)



More Help:
https://help.ubuntu.com/community/phpMyAdmin

https://help.ubuntu.com/community/ApacheMySQLPHP

Source:
http://www.ivankristianto.com/os/ubuntu/howto-install-apache-php-mysql-and-phpmyadmin-on-ubuntu/1027/

Friday, February 11, 2011

Set-up ClamAV on Ubuntu

sudo apt-get install clamav

sudo freshclam


which will install the ClamAV antivirus program and download its database of virus signatures. (In the future, Ubuntu will automatically run freshclam to update the database every day.)

Now let's suppose you're exporting a directory called /home/me/publicdata to your Windows users. You can scan that directory by typing

sudo clamscan -r /home/me/publicdata

and see what it reports. You can tell clamscan to remove infected files automatically (type "man clamscan" for details), but I suggest the first time out you look at the clamscan report and determine for yourself what files look suspicious.

After you've cleaned everything up, you'll probably want to run clamscan every day, or if your users are out of control, every hour. Here's a simple script that runs clamscan and mails a report to the address in NOTIFY. Replace "me@example.com" with the address to which you want reports to be sent, and "/home/me/publicdata" with the directory you want scanned (clamscan will automatically examine all the subdirectories of this directory as well):

#!/bin/sh
TARGET=/home/me/publicdata
NOTIFY=me@example.com

clamscan -r $TARGET 2>&1 | mail -s 'Clamscan report' $NOTIFY

(You may not have the "mail" program installed. Run "sudo apt-get install bsd-mailx" if it's missing.)

Use an editor to create that file in /usr/local/sbin. I recommend the nano editor because it has help menus. At the prompt in a Terminal, type

sudo nano /usr/local/sbin/virusscan.sh

then copy the code above into that file. Hold down the Ctrl key and type S; say "yes" to save the file, then hold down Ctrl and type X to exit nano.

Only two more tasks await. First, you must make the script executable by running the command:

sudo chmod u+x,go-x /usr/local/sbin/virusscan.sh

This will allow the "root" (administrative) user, and only the root user, to execute this script. Finally, to make this script run every hour, you should create a "symbolic link" to the file (rather like a Windows "shortcut") in the directory /etc/cron.hourly like this:

sudo cd /etc/cron.hourly
sudo ln -s /usr/local/sbin/virusscan.sh

This will run the script once each hour. (You can limit it to once a day by replacing "cron.hourly" with "cron.daily" above.)


Source : http://ubuntuforums.org/showthread.php?t=1580738

Clamscan Option : http://linux.die.net/man/1/clamscan

Howto Install Clam AntiVirus with GTK frontend GUI : http://www.ubuntugeek.com/howto-install-clam-antivirus-with-gtk-frontend-gui.html

Thursday, February 10, 2011

How to check port activity and manage

netstat

netstat -e -e

netstat -pant

1- Find what application/process is using the pro, type:

sudo netstat -lpn |grep :8080

and press Enter.

You will get an output similar to this one

tcp6 0 0 :::8080 :::* LISTEN 6782/java

2- I have got the process Id, which is 6782, now this is the process that is using port 8080.

3- Kill the process, type:kill 6782

kill 6782

and now port 8080 is free.

How to Login as a Root User

Type this command in Terminal

sudo passwd root

Login as a root user

sudo su

Source:
http://tutorial.downloadatoz.com/ubuntu-10-04-guide-how-to-login-as-a-root-user.html

Setup OpenSSH Server on Ubuntu

Setting up an SSH server on Ubuntu is about as simple as it gets. The server of choice is OpenSSH.

Run this command from a terminal window:

sudo apt-get install ssh

To test that it’s working, you can try to ssh into your own machine:

ssh [user]@[pc-ip]

The authenticity of host ‘localhost (127.0.0.1)’ can’t be established.
RSA key fingerprint is 98:8a:b8:b2:9e:8a:84:e0:d4:08:27:fb:74:f0:de:d4.
Are you sure you want to continue connecting (yes/no)?

Looks like it’s working! Naturally our ssh client doesn’t have the key for the server, since we just installed it. You can type yes to continue or just hit Ctrl-C to stop.

Source:
http://www.howtogeek.com/howto/ubuntu/setup-openssh-server-on-ubuntu-linux/

How to run sh files on Ubuntu

.sh file is nothing but the shell script to install given application or to perform other tasks under UNIX like operating systems. The easiest way to run .sh shell script in Linux or UNIX is to type the following commands. Open the terminal (your shell prompt) and type the command:

sh file.sh

OR

bash file.sh

.sh File As Root User

Sometime you need to install application which requires root level privalage
Some time you need root access to install application; without root, you won't have the necessary permissions to install application or make system level modifications. Root access is disabled by default on many Linux and UNIX like systems. Simply use sudo or su as follows:

sudo bash filename.sh

Type your password. Another option is to use the su command as follows to become superuser:

su -

Type root user password and finally run your script:

bash filename.sh

chmod Command: Run Shell Script In Linux

Another recommend option is to set an executable permission using the chmod command as follows:

chmod +x file.sh

Now your can run your .sh file as follows

./file.sh

Source: http://www.cyberciti.biz/faq/run-execute-sh-shell-script/

Utorrent on Ubuntu

Download Utorrent:
http://user.utorrent.com/downloads/linux

Starting utorrent server on bootup

http://pastebin.com/UE3kDg00
(between "<>" are the values to change in your case)


After, in linux distros like Ubuntu (and similar), you should do:
1) Copy the init script to "/etc/init.d/":

sudo cp /etc/init.d/utserver-daemon

2) Execute this:

sudo chmod +x /etc/init.d/utserver-daemon

2) And this:

sudo update-rc.d utserver-daemon defaults

And go on!

Execute manually the script with:

sh -x /etc/init.d/utserver-daemon {start|stop|restart}


To start automatically:
sudo update-rc.d utorrent defaults
To remove:
sudo update-rc.d -f utorrent remove

Useful links:
http://forum.utorrent.com/viewtopic.php?id=83538

http://forum.utorrent.com/viewtopic.php?id=85144

http://forum.utorrent.com/viewtopic.php?id=85144