Linux tips and tricks

Home » Linux tips and tricks

How do I change the hostname of my RPi?

You need to do 3 things:

  1. sudo nano vi /etc/hostname. You’ll find the existing hostname in this file. Update the hostname as desitred, then save and exit.
  2. sudo nano /etc/hosts. Look for any occurrence of the old hostname in here. Update them, then save and exit.
  3. sudo reboot

This technique is derived from the website of Simon the Pi Man.

Changing the root of WordPress website

When I first installed WordPress natively, my home page appeared at http://[website name]/wordpress.  I wanted it to be at http://[website name].

Here’s what I had to do to fix it:

root@n36l:/opt/wordpress-4.5.1-0/apps/wordpress# ./bnconfig --appurl /
root@n36l:/opt/wordpress-4.5.1-0/apps/wordpress# ./bnconfig --disable_banner 1
root@n36l:/opt/wordpress-4.5.1-0# /opt/wordpress-4.5.1-0/ restart apache
Syntax OK
/opt/wordpress-4.5.1-0/apache2/scripts/ : httpd stopped
Syntax OK
/opt/wordpress-4.5.1-0/apache2/scripts/ : httpd started at port 80

Restarting my native install of Bitnami WordPress

To restart the entire stack:

malcolm@n36l:~$ sudo -s
[sudo] password for malcolm:
root@n36l:~# cd /opt/wordpress-4.5.1-0/
root@n36l:/opt/wordpress-4.5.1-0# ./ restart
Syntax OK
/opt/wordpress-4.5.1-0/apache2/scripts/ : httpd stopped
/opt/wordpress-4.5.1-0/mysql/scripts/ : mysql stopped
2016-05-08T23:05:00.445332Z mysqld_safe Logging to '/opt/wordpress-4.5.1-0/mysql/data/mysqld.log'.
2016-05-08T23:05:00.530074Z mysqld_safe Starting mysqld.bin daemon with databases from /opt/wordpress-4.5.1-0/mysql/data
/opt/wordpress-4.5.1-0/mysql/scripts/ : mysql  started at port 3306
Syntax OK
/opt/wordpress-4.5.1-0/apache2/scripts/ : httpd started at port 80

Finding and searching files

To find files in the entire filesystem:

malcolm@n36l:~$ locate -i process.txt

To find text in files in the current directory recursively:

malcolm@n36l:~$ grep -Iri 'mscp'

(I = ignore binary files, r = recursive search, i = case insensitive)