You are here

Shell Commands

Shell command snippets

ssh [email protected]
cd /path/to/web/root/directory
drush ard --destination=sites/default/files/archive.tgz

Search backwards
ctrl^R

Move to the beginning of the line
ctrl^A

Move to the end of the line
ctrl^E

Step forward
ctrl^F

Step backward
ctrl^B

Delete word
ctrl^W

Delete line
ctrl^W

git config --global core.autocrlf true
# Remove everything from the index
$ git rm --cached -r .
# Re-add all the deleted files to the index
# You should get lots of messages like: LF will be replaced by CRLF 
$ git diff --cached --name-only -z | xargs -0 git add
# Commit
$ git commit -m "Fix CRLF"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '55d6ead61b29c7bdee5cccfb50076874187bd9f21f65d8991d46ec5cc90518f447387fb9f76ebae1fbbacf329e583e30') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php composer-setup.php --install-dir=bin
php composer-setup.php --filename=composer
php composer install
find . -type f -exec sed -i 's/foo/bar/g' {} \;
grep -r "foo" .
grep -e "mysql -u root -p -e 'drop database XYZ'" /home/*/.bash_history
grep -e "mysql -u root -p -e 'drop database XYZ'" /root/.bash_history
$ tail -f /var/log/httpd/error_log
$ grep 'login.php' /var/log/httpd/error_log
$ egrep -i "denied|error|warn" /var/log/httpd/error_log
0,30 * * * * cd /home/drupal && drush @sites core-cron -y > /dev/null   #enter crontab -e
php -r 'print_r(hash_algos())'