WinDirStat is a disk usage statistics viewer and cleanup tool for Microsoft Windows.
Download Link can be found here .
Deleting Folders With Long Filenames
Long Path Eraser (LPE) is a free tool that allows deleting files and folders with too long paths, that you cannot delete manually. Long Path Eraser automatically deletes the folder you selected, including all its files and subfolders, regardless of their path length (even if they are in a network folder).
Delete mail from specific sender from postfix queue
To delete all email in the queue from a specific email address run this command as root:
postqueue -p | tail -n +2 | awk 'BEGIN { RS = "" } /username@example\.com/ { print $1 }' | tr -d '*!' | postsuper -d -
Delete files from a directory modified before a certain date
Go to the directory and run the following command:
find . ! -newermt 2013-11-22 ! -type d -delete
Find all snapshots from PowerCLI
Open PowerCLI and connect to your vcenter server:
Connect-VIServer vCenterServerName
To get a list of all VM Snapshots for VMs managed by vCenter you can type the following command:
get-vm | get-snapshot | format-list
Install Zabbix on Centos 7
Zabbix requires Apache-Mysql-PHP stack to be installed in order to run. You can follow this previous post.
Let’s download and install Zabbix
rpm -ivh http://repo.zabbix.com/zabbix/2.4/rhel/7/x86_64/zabbix-release-2.4-1.el7.noarch.rpm yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent
We have to edit timezone in /etc/httpd/conf.d/zabbix
php_value date.timezone Europe/Athens service httpd restart
Create a database or Zabbix
mysql -u root -p create database zabbix character set utf8; grant all privileges on zabbix.* to 'zabbix'@'localhost' identified by 'password'; flush privileges; exit
mysql -u zabbix -p zabbix < /usr/share/doc/zabbix-server-mysql-2.4.3/create/schema.sql mysql -u zabbix -p zabbix < /usr/share/doc/zabbix-server-mysql-2.4.3/create/images.sql mysql -u zabbix -p zabbix < /usr/share/doc/zabbix-server-mysql-2.4.3/create/data.sql
Edit /etc/zabbix/zabbix_server.conf to set up zabbix database credentials
Start the zabbix-server process
service zabbix-server start systemctl enable zabbix-server.service
Finally add the necessary firewall rules for snmp and zabbix agent
firewall-cmd --permanent --add-port=161/udp firewall-cmd --permanent --add-port=10051/tcp firewall-cmd --reload
Windows agent
Download from:
http://www.zabbix.com/download.php
Unpack and copy to C:\
edit conf/zabbix_agentd.win.conf and add serverip under ‘Passive’ mode
Rename file to zabbix_agentd.conf
Run from command propmt in C:\install_dir –> zabbix_agentd.exe –install
Install LAMP and WordPress on Centos 7
Install Mysql (MariaDB) and set password
yum -y install mariadb-server mariadb systemctl start mariadb.service systemctl enable mariadb.service mysql_secure_installation
Install Apache
yum -y install httpd systemctl start httpd.service systemctl enable httpd.service
Open ports in firewall
firewall-cmd --permanent --zone=public --add-service=http firewall-cmd --permanent --zone=public --add-service=https firewall-cmd --reload
Install PHP
yum -y install php systemctl restart httpd.service yum -y install php-mysql yum -y install php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel systemctl restart httpd.service
Now we are ready to install WordPress. Let’s create a database and a user for wordpress to work with.
mysql -u root -p CREATE DATABASE wordpress; CREATE USER wordpressuser@localhost IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost IDENTIFIED BY 'password'; FLUSH PRIVILEGES; exit
Now let’s download and install WordPress
wget http://wordpress.org/latest.tar.gz tar xzvf latest.tar.gz rsync -avP ~/wordpress/ /var/www/html/ mkdir /var/www/html/wp-content/uploads chown -R apache:apache /var/www/html/*
Next we will configure WordPress
cd /var/www/html cp wp-config-sample.php wp-config.php
Now we need to modify the following parameters that hold our database information in “wp-config.php” file
vim wp-config.php // ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define('DB_NAME', 'wordpress'); /** MySQL database username */ define('DB_USER', 'wordpressuser'); /** MySQL database password */ define('DB_PASSWORD', 'password');
Now we can complete the WordPress installation through the web interface. In your web browser, navigate to your server’s domain name or public IP address and fill the required information.
Centos 7 – initial setup
Here I am assuming that we started with the minimal installation of Centos 7.
Let’s install some useful packages
yum install wget vim mc ntp net-tools
Now let’s configure the timezone and start the ntp service
timedatectl list-timezones | grep Athens
timedatectl set-timezone Europe/Athens
systemctl start ntpd.service
systemctl enable ntpd.service
Next we will change ssh default port. Edit ssh config file and uncomment Port putting your desired port number.
vim /etc/ssh/ssh_config
systemctl reload sshd.servive
Now let’s disable SElinux changing config file to SELINUX=disabled
vim /etc/sysconfig/selinux
Finally let’s configure firewall
systemctl status firewalld
Show configuration
firewall-cmd --permanent --list-all
Allow port
firewall-cmd --permanent --add-port=4311/tcp
Allow service
firewall-cmd --get-services firewall-cmd --permanent --add-service=http
Remove service or port
firewall-cmd --permanent --remove-service=http firewall-cmd --permanent --remove-port=4311/tcp
Reload and start at boot
firewall-cmd --reload systemctl enable firewalld
Working with mysql CLI
Login
mysql -u username -p
Show databases;
show databases;
Use database;
use db_name;
List tables;
show tables;
Show table fields
describe table_name;
OR
show columns from table_name;
Select fields from table
select column1,column2 from table_name;
Update record
update table_name set column='test1' where column='test2';
Delete record
delete from table_name where column='test';
Backup database (not logged in to mysql)
mysqldump -u username -ppassword db_name > db_backup_file.sql
Backup certain tables from database
mysqldump -u username -ppassword db_name table_name1 table_name2 > db_backup_file.sql
Backup more than one database
mysqldump -u username -ppassword --databases db_name1 db_name2 > db_backup_file.sql
Backup all databases
mysqldump -u username -ppassword --all-databases > db_backup_file.sql
Restore database (if database does not exist)
mysql -u username -p password db_name < db_backup_file.sql
Restore database (existing database)
mysqlimport -u username -p password db_name < db_backup_file.sql
Show Database size
SELECT table_schema "Data Base Name", sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB" FROM information_schema.TABLES GROUP BY table_schema ;
Getting things done from command prompt
Find windows install date
systeminfo | find "Original Install Date"
Find computer name
hostname
Find domain
echo %userdomain%
Restart service
net stop "Print Spooler" && net start "Print Spooler"
Manage firewall
–ON
NetSh Advfirewall set allrprofiles state on
–OFF
NetSh Advfirewall set allrprofiles state off
–Check status
Netsh Advfirewall show allprofiles
Check if Remote Desktop is enabled
nestat -an | find "3389"
Find logged in username
echo %username%
List users
net users
Details about a user
net users administrator
List network connections and ports
netsat -an
Find logged in username/domain
whoami
Show admin shares
net share