Blogs

Some frequently used MySQL commands for reference...

# Create User
CREATE USER user [IDENTIFIED BY [PASSWORD] 'password'];

# Create Database
$ mysqladmin -u <username> -p create <nameOfDatabase>

# Drop/Delete Database
$ mysqladmin -u <username> -p drop <nameOfDatabase>

# Check Process List
$ mysqladmin -u root -p proc

# Check Status at 5 seconds interval
$ mysqladmin -u root -p -i 5 status

# Dump Database
$ mysqldump --opt -u <username> -h <hostname> <nameOfDatabase> -p > /path/to/file    

$ mysqldump --opt -u <username> -h <hostname> --all-databases -p > /path/to/file 

# Import Database
$ mysql -h <host> -u <username> <nameOfDatabase> -p < /path/to/file

GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON <dbname>.* TO <dbuser@localhost> [IDENTIFIED BY '<password>'];

REVOKE ALL ON <dbname> FROM <dbuser@localhost>;

CREATE DATABASE <dbname>;

DROP DATABASE <dbname>;

DROP TABLE <tablename1[, table2, table3...]>;

# To activate new permissions
FLUSH PRIVILEGES; 

USE <nameOfDatabase>;

SHOW DATABASES;

# show tables begining with the prefix
SHOW TABLES LIKE 'prefix%'; 

SELECT * FROM <nameOfTable>;

DESCRIBE <nameOfTable>;

INSERT INTO <table> <username, password, name1, name2, ...> VALUES ('user', password('pass'), 'value1', 'value2' ...);

CREATE TABLE <newtable> AS SELECT DISTINCT <field> FROM <oldtable>;

INSERT INTO <database.table> SELECT * FROM <database.table> WHERE <field> = <value>;

ALTER TABLE <tableOldName> RENAME <tableNewName>;

UPDATE <tableName> SET <field1> = <newValue> [WHERE <field2> = <currentValue>];

Technical Reference eLibrary

Came across this great technical reference elibrary while doing some code searches on google.

Please share your findings...

How do I find the dynamically allocated IP address on a remote bridge ->Linux

I'm sure it's obvious to someone.

How to determine the application listening to a particular port

For example, I run nmap and find that port 712 is open:

712/tcp    open        unknown

But it's easily identified:

# fuser 712/tcp
712/tcp:  2098

# ps -fp 2098
     UID    PID    PPID  C    STIME TTY    TIME   CMD
    root   22098   8999  0    Aug18 ?      22:33  /usr/etc/customd

# man -k customd
custom (1M)           - Custom daemon

Download images from Sony Cyber-shot DSC-F88 to Fedora Linux

Here is a tip/hint that could hopefully help others having some difficulty with cameras that support "PTP".

PTP is the acronym for the "Picture Transfer Protocol". That protocol has a strong standards basis, in ISO and in terms of the USB Still Imaging class specification. Many upcoming digital cameras should support it.

The vision is that there will be enough new PTP-enabled cameras that it'll be much easier for you to just use them. You won't need to install new software and deal with its quirks each time you borrow or buy a new camera. Instead, you will be able to acquire images (and other media objects), reprocess them, (cropping, turning them right side up, signing them, applying steganograpy or other image transforms, etc.) and share them (printing, web publishing, etc) using whatever tools you prefer.

Enough with the PTP jabber... and here is how:

1. Install gPhoto, a free ready to use set of digital camera software applications.
2. Plug in your camera which supports PTP via USB.
3. Change to PTP mode instead of normal usb data transfer.
4. Run the command, `gphoto2 --get-all-files` to download your images.
5. It's as easy as that !!

Installing Firefox Web Browser and some Essential Plugins for Linux...

Here are some notes on installing Firefox and plugins for Flash, Java and Mplayerplug-in:

Installing Firefox:

  1. Download the latest Firefox installer via http://www.mozilla.org/products/firefox/
  2. untar the archive, `tar -xvzf firefox-x.x.x-x-linux-gtk2+xft-installer.tar.gz`
  3. `cd firefox-installer`
  4. Login as root before doing the install, `su`
  5. Run the installer, `./firefox-installer`
  6. Change the destination install directory to be "/usr/lib/firefox"
  7. Create a Launcher on your desktop after installation.

Note: All of the .so plugin files go to the "/usr/lib/firefox/plugins" folder...

Top 10 ways to crash PHP

Programming errors are of many kinds but the consequences can range from harmless to downright dangerous.
Top 10 ways to crash PHP
is an interesting article that deals with such a topic for PHP.

Knock Knock Knocking on Heavens Port !!

Port knocking is a method of establishing a connection to a networked computer that has no open ports.

Before a connection is established, ports are opened using a port knock sequence, which is a series of connection attempts to closed ports. A remote host generates and sends an authentic knock sequence in order to manipulate the server's firewall rules to open one or more specific ports. These manipulations are mediated by a port knock daemon, running on the server, which monitors the firewall log file for connection attempts which can be translated into authentic knock sequences.

Once the desired ports are opened, the remote host can establish a connection and begin a session. Another knock sequence may used to trigger the closing of the port.

Read more about it at PortKnocking.org and give it a whirl.

UN-deleting files in Linux

I decided to investigate how easy it was to recover deleted files in Linux and came to the conclusion that using secure file deletion utilities is a must for safely deleting data. When files are removed in linux they are only un-linked but their inodes (addresses in the disk where the file is actually present) is not removed. This concept will be quite handy while recovering deleted files. Now i won't discuss specialized software but rather stick to utilities commonly present in linux distros. In this case it's the "debugfs" utility. Run "debugfs /dev/hda13" and then at the "debugfs" prompt use the command "lsdel"

HostingHacks.net: Tools to build a linux web hosting service

Interested in building a linux web hosting service? HostingHacks.net has some excellent documentation and an easy to follow step by step process to do so. Currently only Redhat and Fedora write-ups is available, but others are to follow...

Syndicate content
Comment