Setting up a Headless Raspberry Pi with Raspbian Lite

Raspberry Pi 3b+

Funny thing as I started writing this article. I just was not feeling up to the task and did not want to grab an extra monitor and keyboard from the attic and asked myself if there was a way to setup Raspbian on a Pi without having a monitor and keyboard attached? Well actually there is, and it is not difficult at all.

1) Download Raspbian Lite Image

Go to Raspbian and download the lite image.

2) Burn your Image to your SD Card

I have been using Etcher and have been pretty happy with it so far. Another option is Win 32 Disk Imager.


3) Eject and SSH

Now eject your card after it is done and reinsert it. Once your new drive letter is showing, navigate to it. We are going to place a file in the root of the drive called ssh, lower case. You need to have your ‘show file extension’ option on in Windows. The file will have no content, zero bytes.

Raspbian Directory

4) Boot Raspberry Pi and Locate it

Now put your SD card into your Pi, plug in your ethernet and let it boot. Since it has to resize the root partition it will take a minute or two. While this is happening, take a problem like Zenmap or Nmap and locate your Raspberry Pi. When using Zenmap you probably want to use the quick scan or better, so you will get the mac address without having to dig for it.

I have a lot of Raspberry Pi’s scattered across my networks but the one with an address of is our target. From here we can simply putty to our new Raspberry Pi. Your default credentials will be…

Login: pi
Password: raspberry
Raspberry Pi Login

5) Setting Static IP address, Finishing Setup

My first step is to normally change my password, like so.


Next we will set a static ip address to make the Pi a little easier to find. Run your vi command and edit /etc/dhcpcd.conf and make the following changes to fit your environment.


option rapid_commit

option interface_mtu

require dhcp_server_identifier

slaac private

interface eth0

static ip_address=
static routers=
static domain_name_servers=

Now either restart network services or reboot and you should be able to ssh back into your box at the new IP address.

Continue Reading

How to Find the Largest Files and Folders in Linux

If you work with Linux long enough you will probably run out of space on a box somewhere. More often than not it always seems to happen on a production machine and you have a very upset customer. No worry though, the problem is trivial to fix with the right set of commands. There are also multiple ways to do the task, thanks to Linux.

On all of these commands I will work with the var directory, that seems to be the most common one I am working with.

1) DU

DU stands for drive usage. Of course it only makes sense to sort by size. We will take only the top 10 listings for a better visual. As you will notice this is recursive and shows the usage in a more hierarchical format.

2598612 /var
2486740 /var/lib
2350520 /var/lib/mysql
118580  /var/lib/mysql/MyVideos107
103380  /var/lib/apt
103324  /var/lib/apt/lists
88112   /var/cache
65864   /var/cache/apt
49984   /var/lib/mysql/MyVideos99
44620   /var/lib/mysql/MyVideos93

2) Find

I really like this result better because you can actually see which file is taking up the most space, but it really depends on what you are after. Most of the time this is my goto command.

1.9G    /var/lib/mysql/ibdata1
48M     /var/lib/mysql/ib_logfile1
48M     /var/lib/mysql/ib_logfile0
38M     /var/lib/apt/lists/
33M     /var/lib/apt/lists/
26M     /var/lib/apt/lists/
26M     /var/cache/apt/srcpkgcache.bin
26M     /var/cache/apt/pkgcache.bin
24M     /var/lib/mysql/MyMusic56/path.ibd
20M     /var/lib/mysql/MyVideos107/movie.ibd


I feel I just have to say something about NCDU. Sure you have to install it and it may not be available for all Linux environments, but it is pretty awesome and worth mentioning.

For a Debian or Ubuntu system installation


For YUM based installations, there is a thread here on how to install

Usage is very easy to remember

ncdu 1.12 ~ Use the arrow keys to navigate, press ? for help
--- /var -----------------------------------------------------------------------
    2.4 GiB [##########] /lib
   86.1 MiB [          ] /cache
   17.2 MiB [          ] /log
    3.4 MiB [          ] /webmin
    1.7 MiB [          ] /backups
  596.0 KiB [          ] /tmp
  268.0 KiB [          ] /mail
   36.0 KiB [          ] /spool
   20.0 KiB [          ] /www
e   4.0 KiB [          ] /opt
e   4.0 KiB [          ] /local
@   0.0   B [          ]  lock
@   0.0   B [          ]  run

What I really like about NCDU is the arrow key navigation. You can easily go up and down directories to really narrow down on where the disk usage is. The only draw back is if you can use it for your Linux flavor.

So we have went over three different ways to find drive usage. If you can think of any other ways worthy of mention leave a comment below.

Continue Reading