Useful bash aliases for VPS
Some useful bash aliases that I use on my VPS’:
www=/srv/www
conf=/etc/apache2/sites-enabled
alias ra='/etc/init.d/apache2 restart'
alias ownit='chown -R www-data:www-data .'
Create an Apache conf and directory for a new domain:
function makeconf {
primary=${1}
conffile="${conf}/${primary}.conf"
site_path="/srv/www/${primary}"
mkdir -p ${site_path}
echo "<VirtualHost *:80>" >> "${conffile}"
echo " ServerName ${primary}" >> "${conffile}"
echo " ServerAlias www.${primary}" >> "${conffile}"
shift
for i; do
cat >> "${conffile}" <<EOL
ServerAlias ${i}
ServerAlias www.${i}
EOL
done
echo " DocumentRoot ${site_path}" >> "${conffile}"
echo "</VirtualHost>" >> "${conffile}"
}
Grab the latest Wordpress tar and extract it to the current directory:
function wordpressitup {
wget --no-check-certificate https://wordpress.org/latest.tar.gz
tar xfz latest.tar.gz
cd wordpress
cp -R * ..
cd ..
rm -r wordpress
echo "Wordpress installed"
}
Some shortcuts to go to common directories:
function dwww {
cd /srv/www
}
function dcache {
cd /var/cache/mod_pagespeed/v2
}
function dconf {
cd /etc/apache2/sites-enabled/
}
See which directories and files are using up all of the space:
function fsizes {
du -h --max-depth=1 | sort -hr
df -BG
}
Related posts
- Android Auto on my HR-V's Android 4.0.4 head unit
I recently bought a 2018 Honda HR-V as our family car. It has a 7” touchscreen running Android 4.0.4, a version so old it predates Android Auto by about three years. It runs Android Auto now anyway, thanks to a small app I built over the course of a week.
- PHP2Shell and the case for building boring sites
From Wednesday 21 October to the end of the weekend, I was patching an old VPS and moving a handful of sites onto a new one. PHP2Shell finally made the decision for me. This blog carried on regardless, because it’s just files. The sites I’d built with a CMS were another story.
- Rebuilding and analysing 4 years of Wordle stats from WhatsApp chat logs
Yes, I’m still playing Wordle in 2026. According to Wordle, I’ve played 1,559 games, I win 99% of the time, my current streak is 107 days and my longest is 278. Four numbers, and they’re mostly correct. What I don’t get is anything behind them. No per-game history. No way to compare a Tuesday to a Sunday. No sense of whether I’ve actually got better at this over four years. Each day I’ve played, I’ve also shared the result to WhatsApp. Just a habit, not a data strategy, but it turns out that habit quietly built a far more detailed record than Wordle itself ever keeps. One I can finally ask my own questions of. So I looked into rebuilding my own copy of the data.
Discussion
No interactions yet
Join the conversation
Reply from your own site with a Webmention (how?).
