Linux.com

Community Blogs



Pinguy OS LTS Update: 10.04.2 [Ubuntu Remaster]

An update for Pinguy OS 10.04 LTS was released today: 10.04.2. For those who are not familiar with Pinguy OS: it's an Ubuntu remaster with a lot of useful default applications "built to have eye candy (Gloobus Preview, GNOME Do, Docky, Nautilus Elementary) and for every part of it to be user-friendly". It comes with a lot of applications we've featured on WebUpd8 so if you want a ready-to-use Linux distro, you should really try Pinguy OS. I like to call it "Ubuntu after a week of customization" but lately it's getting way past "a week".

Pinguy OS 10.04.2 comes with some of the features from 10.10 that were missing in 10.04 like the Sound Menu applet or the new Ubuntu Software Center. Pinguy OS also comes with a new default application: TeamViewer 6, a popular application for remote control, desktop sharing and file transfer between computers.

Full story: Pinguy OS LTS Update: 10.04.2 [Ubuntu Remaster]

Read more... Comment (0)
 

Useful Mysql Commands

To login (from unix shell) use -h only if needed.

# [mysql dir]/bin/mysql -h hostname -u root -p

Create a database on the sql server.

mysql> create database [databasename];

List all databases on the sql server.

mysql> show databases;

Switch to a database.

mysql> use [db name];

To see all the tables in the db.

mysql> show tables;

To see database's field formats.

mysql> describe [table name];

To delete a db.

mysql> drop database [database name];

To delete a table.

mysql> drop table [table name];

Show all data in a table.

mysql> SELECT * FROM [table name];

Returns the columns and column information pertaining to the designated table.

mysql> show columns from [table name];

Show certain selected rows with the value "whatever".

mysql> SELECT * FROM [table name] WHERE [field name] = "whatever";

Show all records containing the name "Bob" AND the phone number '3444444'.

mysql> SELECT * FROM [table name] WHERE name = "Bob" AND phone_number = '3444444';

Show all records not containing the name "Bob" AND the phone number '3444444' order by the phone_number field.

mysql> SELECT * FROM [table name] WHERE name != "Bob" AND phone_number = '3444444' order by phone_number;

Show all records starting with the letters 'bob' AND the phone number '3444444'.

mysql> SELECT * FROM [table name] WHERE name like "Bob%" AND phone_number = '3444444';

Show all records starting with the letters 'bob' AND the phone number '3444444' limit to records 1 through 5.

mysql> SELECT * FROM [table name] WHERE name like "Bob%" AND phone_number = '3444444' limit 1,5;

Use a regular expression to find records. Use "REGEXP BINARY" to force case-sensitivity. This finds any record beginning with a.

mysql> SELECT * FROM [table name] WHERE rec RLIKE "^a";

Show unique records.

mysql> SELECT DISTINCT [column name] FROM [table name];

Show selected records sorted in an ascending (asc) or descending (desc).

mysql> SELECT [col1],[col2] FROM [table name] ORDER BY [col2] DESC;

Return number of rows.

mysql> SELECT COUNT(*) FROM [table name];

Sum column.

mysql> SELECT SUM(*) FROM [table name];

Join tables on common columns.

mysql> select lookup.illustrationid, lookup.personid,person.birthday from lookup left join person on lookup.personid=person.personid=statement to join birthday in person table with primary illustration id;

Creating a new user. Login as root. Switch to the MySQL db. Make the user. Update privs.

# mysql -u root -p
mysql> use mysql;
mysql> INSERT INTO user (Host,User,Password) VALUES('%','username',PASSWORD('password'));
mysql> flush privileges;

Change a users password from unix shell.

# [mysql dir]/bin/mysqladmin -u username -h hostname.blah.org -p password 'new-password'

Change a users password from MySQL prompt. Login as root. Set the password. Update privs.

# mysql -u root -p
mysql> SET PASSWORD FOR 'user'@'hostname' = PASSWORD('passwordhere');
mysql> flush privileges;

Recover a MySQL root password. Stop the MySQL server process. Start again with no grant tables. Login to MySQL as root. Set new password. Exit MySQL and restart MySQL server.

# /etc/init.d/mysql stop
# mysqld_safe --skip-grant-tables &
# mysql -u root
mysql> use mysql;
mysql> update user set password=PASSWORD("newrootpassword") where User='root';
mysql> flush privileges;
mysql> quit
# /etc/init.d/mysql stop
# /etc/init.d/mysql start

Set a root password if there is on root password.

# mysqladmin -u root password newpassword

Update a root password.

# mysqladmin -u root -p oldpassword newpassword

Allow the user "bob" to connect to the server from localhost using the password "passwd". Login as root. Switch to the MySQL db. Give privs. Update privs.

# mysql -u root -p
mysql> use mysql;
mysql> grant usage on *.* to bob@localhost identified by 'passwd';
mysql> flush privileges;

Give user privilages for a db. Login as root. Switch to the MySQL db. Grant privs. Update privs.

# mysql -u root -p
mysql> use mysql;
mysql> INSERT INTO db (Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv) VALUES ('%','databasename','username','Y','Y','Y','Y','Y','N');
mysql> flush privileges;
or
mysql> grant all privileges on databasename.* to username@localhost;
mysql> flush privileges;

To update info already in a table.

mysql> UPDATE [table name] SET Select_priv = 'Y',Insert_priv = 'Y',Update_priv = 'Y' where [field name] = 'user';

Delete a row(s) from a table.

mysql> DELETE from [table name] where [field name] = 'whatever';

Update database permissions/privilages.

mysql> flush privileges;

Delete a column.

mysql> alter table [table name] drop column [column name];

Add a new column to db.

mysql> alter table [table name] add column [new column name] varchar (20);

Change column name.

mysql> alter table [table name] change [old column name] [new column name] varchar (50);

Make a unique column so you get no dupes.

mysql> alter table [table name] add unique ([column name]);

Make a column bigger.

mysql> alter table [table name] modify [column name] VARCHAR(3);

Delete unique from table.

mysql> alter table [table name] drop index [colmn name];

Load a CSV file into a table.

mysql> LOAD DATA INFILE '/tmp/filename.csv' replace INTO TABLE [table name] FIELDS TERMINATED BY ',' LINES TERMINATED BY ' ' (field1,field2,field3);

Dump all databases for backup. Backup file is sql commands to recreate all db's.

# [mysql dir]/bin/mysqldump -u root -ppassword --opt >/tmp/alldatabases.sql

Dump one database for backup.

# [mysql dir]/bin/mysqldump -u username -ppassword --databases databasename >/tmp/databasename.sql

Dump a table from a database.

# [mysql dir]/bin/mysqldump -c -u username -ppassword databasename tablename > /tmp/databasename.tablename.sql

Restore database (or database table) from backup.

# [mysql dir]/bin/mysql -u username -ppassword databasename < /tmp/databasename.sql

Create Table Example 1.

mysql> CREATE TABLE [table name] (firstname VARCHAR(20), middleinitial VARCHAR(3), lastname VARCHAR(35),suffix VARCHAR(3),officeid VARCHAR(10),userid VARCHAR(15),username VARCHAR(8),email VARCHAR(35),phone VARCHAR(25), groups VARCHAR(15),datestamp DATE,timestamp time,pgpemail VARCHAR(255));

Create Table Example 2.

mysql> create table [table name] (personid int(50) not null auto_increment primary key,firstname varchar(35),middlename varchar(50),lastnamevarchar(50) default 'bato');

 

FTP file transfer with an automated bash script

This is a really quick blog post, I don't wanna bother you with a complete article related to FTP, this morning I've had to automate a batch job, this job needs to transfer local data to a remote FTP server here's what I've done:

#!/bin/bash
HOST='your.ftp.site'
USER='remoteusername'
PASSWD='remotepasswd'

ftp -n -v $HOST << EOT
ascii
user $USER $PASSWD
prompt
cd upload
ls -la
bye
EOT

The script automatically connects to a remote server "your.ftp.site" with a defined username/password pair (remoteusername, remotepasswd) and execute some commands in the middle, in my case :

cd upload
ls -la

but of course you can customize with your own commands

This is not a tech article and not even something cool, just useful as a quick tip for a newbie, hope it helps..

 

Ben

 

Happy Programmer Day

The programmer day is celebrated on the 256th (0x100th) day of each year (September 13 during common years and on September 12 on leap years). The number 256 (28) was chosen because it is the number of distinct values that can be represented with an eight-bit byte

This particular day was proposed by Valentin Balt, an employee of Parallel Technologies web design company. As early as 2002 he tried to gather signatures for a petition to the Government of Russia to recognize the day as the official programmers' day.On July 24, 2009, the Ministry of Mass Communications of Russia issued a draft of an executive order on a new professional holiday, Programmers' Day. On September 11, 2009, President of Russia Dmitry Medvedev signed the decree.

So, this is a happy day for all the programmers, because in a non-official way, this day is celebrated around the world, so you can go and celebrate, or (the most real option) is to keep working on your desk and just change your msn title :D

Source: Wikipedia

 

Linux User Groups in Russia

Hi all!

Here I wish tell about features the LUG's in Russia. Who I talked in my first post(http://www.linux.com/community/blogs/the-first-post-333592.html) I
is a coordinator a Ekaterinburg LUG(http://www.e-lug.ru/) in Russia. Our community was created on 19 Feb. 2008 year. For that time we conducted several activities and conferences about OpenSource and his application in academic and state organizations(you can see our
reports about our fests here[in Russian]: http://bit.ly/9dKlpR).

It should be noted that our community is among the five most active in Russia, but we not have a sponsors to carry out our activities at a higher level. Yes, we arended audience in Institutes, but it is rather difficult. At the moment we are very actively looking for sponsors, but so far our attempts have not yielded tangible results. I would be glad to share experiences and learn from others about the holding of conferences and fests.

You also can contact me for this e-mail address: remalloc {at} gmail {d0T} com.

 

Plese, sorry for my bad English...

--

Best regards, Kirill Shirshov also know as remalloc

 

First post

This is the first post in this blog, to get things going. I will try to post as often as i can. I mainly post at my external blog but i will try to post the same things here so that linux.com users can follow my writings here instead of at my blog.

I am a Debian user and a C developer. I am using software like VIM/GVIM, Subversion, Geany, Anjuta, and others to do my work etc. This is what i will blog about when i have the time.

Favorite subjects would be C, NCurses, GTK+, Subversion, administration of Linux systems (Debian) and a few other things. I am also a science geek which i write about in my external blog. This i wont blog about here but i mention it because it will take a lot of my time and it will make it difficult for me to post reguarly about linux and programming.

I have been using Linux since 1997...

 

U.K. Officials Suggest To Use Linux

U.K. Officials Suggest to dump all the Microsoft software and start using Linux and Open Office. The Linux and GNU software offer a free or a very low cost alternatives to Microsoft software, so why to expend on a system which is expensive if you can have it free or at low cost. In words of Prime Minister David Cameron:

In terms of spending less, what about migrating the whole of government (the NHS, education etc.) from Microsoft products to Linux and open-source software like Openoffice.

Source: Business Week News

 

Priceless

I was at the mall today, looking at all the fancy new games (and old ones) on the Wii. I found pretty ridiculous that some 3 year old games were at the same price as some of this year's.

Back in high school and college, I used to "invest" in video games (both money and time), more than I did today. But even then, I don't remember spending that much money. I have a Xbox at home - not the 360 one, the old brick. It sits in the basement, acting as a media center these days. I recall buying old games on it at ridiculously low prices - the lowest being 2$. But from the looks of thing, I don't think I'll be doing that on the Wii - unless I end up with some mini game compilation.

It makes me think of how much it costs to like Star Trek. I remember shopping for the Voyager series - about 60$ per season. And there are 7 of them. Let me say, at that price, the lure of torrents is very strong. I can resist, but for many, resistance is futile. I mean, it takes a lot of motivation to spend that much on a TV show that started in 1995, even if I loved it.

I instead turned my eyes on music - I got the soundtracks of The Elder Scrolls III and IV (Morrowind and Oblivion for the quick ones). For about 16 bucks, I'd say it was a pretty good deal. The music is just great - if you liked the game and its music, you'll certainly love the soundtrack.

That being said, there seems to be some cool items in the linux.com store - I'll have to check that back some day. People stopping by to ask you about fresh kernels? Priceless.

 

Iphone Can Relieve Stress

[video:http://www.youtube.com/watch?v=cFZw7yihGT0&feature=player_embedded 450x300]

Speechless, all is true. I need to download that app :D

 

The Best 75 Tux Wallpapers

Well, not all in life is programming, and after have the best software of the world (yes, I'm talking about Linux), you can give a new look to your desktop with this collection of 75 of the best (in the author words) wallpapers featuring Tux, enjoy!!!

Source: Designora

 

Linux Development - (declogging the fluff)

The Background
This is my first article so be kind! I am a developer and a Linux user of over 10 years which may be surprising given my low age. One of my favourite things to do in Linux is to test out software and websites that I build because I strive to make everything as multi-platform as I can (saving on porting costs, hardware costs and software costs wherever possible).

The First Problem
One of the problems for me with Linux is that it can be hard to keep track of exactly what is installed in the system (For those of you suggesting apt, yum or alike consider there are over 25 packages just for X and well over 250 in a standard Linux install and then there are those miscellaneous dependencies we all add because programs won't function without them).

The Next Problem
My next problem is that I have multiple clients all with different needs, one person wants a .NET program (fine use MONO), the next person wants Java, the next C++, the next AIR, the problem is that the system gets clogged up with junk and I have neither the time, patience or inclination to do anything about it.

The Solution
My solution is simple I use virtual machines within VirtualBox to build and test the machines, it means that I no-longer have to reboot my entire PC if I accidentally compile and run (while(true){ continue; }) or similar. It also allows me to keep my main system as static (and therefore stable) as possible and it has a number of added advantages.

Added Benefits
If you use VirtualBox you can make all of your data transitory or "portable", you can connect it to an external E-sata hard-drive and reap much the same performance as a regular pc, you can also set up clustering within the guest by adding bridged virtual Ethernet connections to "defer" the CPU load to other computers and with VirtualBox comes one other advantage, "native mode" the application can run as if it were a native application on the host PC without any of the possible security risks (due to the VM sandboxing the App).

The End
So this is the end of my short article on de-clogging the fluff, I welcome all questions and suggestions as I'm not much of a writer and want to improve.

 
Page 4 of 15

Upcoming Linux Foundation Courses

  1. LFS230 Linux Network Management
    06 Oct » 09 Oct - Virtual
    Details
  2. LFD331 Developing Linux Device Drivers
    13 Oct » 17 Oct - Virtual
    Details
  3. LFS430 Linux Enterprise Automation
    13 Oct » 16 Oct - Virtual
    Details

View All Upcoming Courses


Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board