#
# Variable file, Write all global vars in
#
.bash_login
PATH=$PATH:/Applications/MAMP/Library/bin/
alias ls="ls -G"
# Clear Historial
history -c
#
# Size of a folder
#
du -h -s --si
#
# Find
#
find . -name "sendmail.cf"
find . -type f -name "*.java" -exec grep -l sendEmailPassword {} \;
#
# Find and Replace
#
# Replace 'old.website.com' to '127.0.0.1/local.website.com' from file 'database.sql' to 'new-database.sql'
sed 's/old.website.com/127.0.0.1\/local.website.com/g' database.sql > new-database.sql
# Replace recursively
find . -type f -exec sed -i '' 's/string-to-find/string-to-replace/g' {} \;
#
# YUM - software installation tool for Red Hat and Fedora
#
# Check packages installed
yum list installed
# Check updates
yum check-update
# Install a package
yum install openssl
# Install a package from a repository
yum --enablerepo=remi install php-pear
# Search for a package
yum --enablerepo=remi search apache
# Remove a package
yum remove telnet
# Get information
yum info telnet
# List files of an installed package. You will need package yum-utils. (yum install yum-utils)
repoquery --list telnet
#
# rpm - RPM Package Manager is a package management system.
#
# Get all packages installed
rpm -qa
# Get info from a installed package
rpm -qi telnet
# Get list of files package installed
rpm -ql telnet
# Install a package
rpm -Uhv ftp://download.fedora.redhat.com/pub/archive/i386/os/Packages/fedora-release-*.noarch.rpm
# Erase a package
rpm -e telnet
#
# Debian - Ubuntu Aptitude
#
apt-cache search aMule
apt-get install aMule
apt-cache
#
# Postfix - Sendmail
#
# List queue
postqueue -p
# Send queue
postqueue -f
# OR
sendmail -q
# Delete queue
postsuper -d ALL
postsuper -d ID
#
# Compress / De
#
tar czvf backup.tgz /var/www/htdocs
tar czvf backup-small.tgz --exclude='magento/media/*' --exclude='magento/var/log/ magento/
zip -9 -r -v backup.zip /var/www/htdocs
# Split a big file
split -b 784m Huge-File.dmg small-file-
# Join
cat small-file-* > Huge-File.dmg
#
# Virtual Box
#
VBoxManage internalcommands sethduuid
#
# Mails (Mac Snow Leopard)
# See the mail queue
/usr/sbin/sendmail -bp
# Start Postfix daemon
/usr/bin/sudo /bin/launchctl load -w /Library/LaunchDaemons/com.cutedgesystems.postfix.plist
# Stop Postfix daemon
/usr/bin/sudo /bin/launchctl unload -w /Library/LaunchDaemons/com.cutedgesystems.postfix.plist
# Mail out folder
/var/spool/postfix/maildrop
#
# SFtp
#
vi ~/.ssh/config
host ec2-amazon-server-to-connect.com
IdentityFile ~/.ssh/serverkey.pem
sftp root@ec2-amazon-server-to-connect.com
#
# ps and Kill
#
# Kill all nacho's process
kill -9 `ps -u nacho -o "pid="`
# Kill all php's process
kill -9 `ps -C php -o "pid="`
#
# Test Mail Sever through telnet
#
telnet 127.0.0.1 25
EHLO 127.0.0.1
MAIL FROM:root@localhost
RCPT TO: ignacio@richardmason.net
DATA
SUBJECT: test message
Test message
.
Tags: bash, find, mail, sendmail, telnet test