how to find files newer than exact data?

 find ./ -type f -newer somfiles | xargs ls -rtlh

How to transfer data much faster than RSYNC ?

On the server (receiver)

 socat TCP-LISTEN:4444 - | tar xvf - 

On the client (sender)

 tar cvf - /mnt/somefolder | socat - TCP:a0032n1:4444    

mysqldump to another host

 mysqldump dbanme | ssh user@1.1.1.1  'cat > /tmp/dbname.sql'

Shell. negative in FIND

 find . ! -user www

How to get particular database from mysqldump which was made with –all-database option ?

Assume, you made a mysqldump which consists all databases (with –all-database option), how to restore from that mysqldump the necessary database?
Solution is really simple!

mysql --one-database db_name < alldatabases.sql

Linux. How to customize the process output

For example, I’d like to know how long the processes have been running, for that purpose you can use the STIME variable:

ps -eo pid,user,cmd,stime

Some of useful columns:
PPID — pid of parent process;
%CPU — cpu utilization in percent
%MEM — part of RAM(real memory) which consumed by the process
VSZ — Virtual size of process (kilobytes)
RSS — amount of 1K pages
STIME — the process time start
S or STAT — status of process
PRI — priority
NI — nice
TIME — how much time of cpu does the process take
CMD или COMMAND — command

How to delete many millions of files in directory

cd /mnt/folder; find . -type f -exec rm -rf {} \;
cd /mnt/test_dir/ ; ls -f . | xargs -n 100 rm

-f – do not sort of list files

The VMware doesnt work on the kernel 3.10.x What is workaround?

Workaround:

cd /tmp
curl -O http://pkgbuild.com/git/aur-mirror.git/plain/vmware-patch/vmblock-9.0.2-5.0.2-3.10.patch
curl -O http://pkgbuild.com/git/aur-mirror.git/plain/vmware-patch/vmnet-9.0.2-5.0.2-3.10.patch
cd /usr/lib/vmware/modules/source
tar -xvf vmblock.tar
tar -xvf vmnet.tar
patch -p0 -i /tmp/vmblock-9.0.2-5.0.2-3.10.patch
patch -p0 -i /tmp/vmnet-9.0.2-5.0.2-3.10.patch
tar -cf vmblock.tar vmblock-only
tar -cf vmnet.tar vmnet-only
rm -rf vmblock-only
rm -rf vmnet-only
vmware-modconfig --console --install-all

It works!

How to count the ip net

IP net calculator

HowTo analyze mysql-log by mysqlsla

There are two types of mysql log – slow log and general log, let’s try to analyze them:

Get the mysqlsla utility:

http://hackmysql.com/scripts/mysqlsla-2.03.tar.gz

Enable the general log:

mysql> set global general_log=ON;

To show where the general log is located:

show variables like '%log%';

Analyze it:

 mysqlsla --log-type general /home/mysql/server.log > /root/report

The slow log

mysqlsla --log-type slow /home/mysql/server_slow.log > /root/report