Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Linux Ask!

Jan 022010
 

How to change file's modification time?

Answer:

1. To see the current file stats, use

# stats test.txt

stat test.txt
  File: `test.txt'
  Size: 25557           Blocks: 56         IO Block: 4096   regular file
Device: ca01h/51713d    Inode: 32714       Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1001/    user)   Gid: ( 1000/ user)
Access: 2010-01-02 18:53:46.000000000 +0800
Modify: 1970-01-01 17:13:08.000000000 +0800
Change: 2010-01-02 18:53:46.000000000 +0800

2. To change the file's mtime (Modification time), use

touch -m -d '1 Jan 2006 12:34' test.txt

3. To change the file's atime (Last access time), use

touch -a -d '1 Jan 2006 12:34' test.txt

Jan 022010
 

How to delete MySQL user?

Answer:

1. Enter the MySQL shell using root account

mysql -u root -p mysql

2. Execute the SQL like the followings

DROP USER user1;
FLUSH PRIVILEGES;

3. Now try to login using user1 account to check if account is removed

mysql -u user1 -p db1

Jan 022010
 

How to create a new MySQL user?

Answer:

1. Enter the MySQL shell using root account

mysql -u root -p mysql

2. Execute the SQL like the followings

GRANT ALL PRIVILEGES ON db1.* TO 'user1'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;

3. Now try to login using user1 account

mysql -u user1 -p db1

Jan 012010
 

Delete svn folders and files

Answer:

After checkout from the svn repository using the svn checkout command , if you want to remove the svn related files/folders, use the following command under the working directory

find ./ -name ".svn" | xargs rm -rf

On the other hand, you should use svn export, instead of svn checkout if you don't want the svn related files/folders at the beginning.

Jan 012010
 

Increase PHP memory limit

Answer:

If you experienced error such as "Fatal error: Allowed memory size of 16777216 bytes exhausted ", you would need to increase the memory limit of your PHP, by editing the php.ini

vi /etc/php.ini

Locate and set

memory_limit = 32M ;

Try it with the number you need.