Gnu/Linux commands for every day

Some general Linux related apps commands for easy remember

MySQL

Check and repair Mysql databases and tables

mysqlcheck -A -p --auto-repair

Optimize tables after delete large number of records to save space in disk

mysql> use asteriskcdrdb;

mysql> OPTIMIZE TABLE cdr;

Users and privileges

CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'USERNAME'@'%' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION;

From specific IP and database

mysql> GRANT ALL PRIVILEGES ON databasename.* TO 'USERNAME'@'1.2.3.4' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION;

NETWORKING

Scan devices on network by network interface

arp-scan --interface=wlan0 --localnet
arp-scan --interface=wlan0 10.0.1.0/24