System memory

Copied from the now diseased Dinix web forum:

How can I tell what is using up all of my server’s memory?
Linux actually uses two different forms of disk caching, referred to as ‘cached’ and ‘buff’ in top. The amount of free memory displayed by the program top is misleading, since the Linux operating system will use most of the available memory for disk caching.

When you launch new processes, Linux will automatically shrink the cache to free up needed memory. If more memory is needed
after Linux has shrunk the disk cache, Linux will swap out currently unused portions of memory to disk.

Swapping out parts of a process’ memory is the reason for the difference between the SIZE and RSS columns for some
processes listed in top. The SIZE column is the amount of memory allocated to the process that can reside in physical memory
or on the swap partition. The RSS column shows how much of a process’ memory resides in physical memory. (The SIZE column
may actually show less memory than the process has requested, since Linux will wait to assign a unit of memory to the process
until the process has accessed memory inside that unit by reading or writing to it.)

Linux will move data from the swap partition back into physical memory once a process requires that piece of data. This is why
the data may remain on the swap partition even though enough physical memory has been freed to contain all the processes.

If you want to know how much physical memory your programs our actually using, you can subtract the ‘cached’ and ‘buff’
fields in top from the used memory field. Conversely, you can add the ‘cached’ and ‘buff’ fields to the free memo

MySQL most used commands

Started with system database of mysql

$ mysql -uroot -ppassword mysql

Create a database:

mysql> CREATE database mydb
mysql> drop database mydb;
mysql> show databases;

Corresponding Unix system command

$ mysqladmin drop mydb
$ mysqlshow

To add password

$ mysqladmin password xxxx

To export database

$ mysqldump -u myuser -pmypass mydb > exl.sql

To add a user to a database:

mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP on mydb.* to 'myuser'@'localhost' IDENTIFIED BY 'mypassword';

or

mysql> INSERT INTO user (Host,User,Password) VALUES('localhost','dummy','mypassword');

To add a user that can access from other client machines, use % as the host

mysql> GRANT SELECT on db1.* to 'myuser'@'%' IDENTIFIED BY 'mypassword';

To change password, use

mysql> update user set password=PASSWORD(“NEW-PASSWORD”) where User=’myuser’;

To change permissions, use

mysql> GRANT USAGE ON *.* TO 'dummy'@'localhost';
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP on mydb.* to myuser;

or

mysql> GRANT ALL on mydb.* to myuser
mysql> FLUSH PRIVILEGES;

— special for loading file

mysql> GRANT FILE on *.* to myuser
mysql> LOAD DATA INFILE '/mypath/myfile' INTO TABLE mytable FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n';

To check the error such as the infamous “ERROR 1005 (HY000)”, use

mysql> SHOW ENGINE INNODB STATUS

Default starting Federa session

To make KDE the dominant Desktop Environment instead of GNOME

edit /etc/inittab
at the bottom you’ll find a line that reads x:5:respawn and so on
it’ll probably point at prefdm
make it point at /usr/bin/kdm instead

Another solution:

Edit /etc/sysconfig/desktop to contain

DESKTOP=KDE
DISPLAYMANAGER=KDE

This will make KDE the default desktop and kdm the default login manager.