du, df & ncdu

du

“du” – or “disk usage” is a useful Linux command especially if you want to know what is taking up space on your hard drive in command line. It is used to check the usage information of files and folders on a disk. The command has a few parameters that can be seen by running “man du” from the terminal window. Here are some example commands that I found useful:

du -h /home/folder – print sizes in human readable format (e.g., 1K 2.8G) See example below to show the difference:

pawel@pawel-ubuntu:/# du /home/folder
2052 /home/folder/secondfolder
1052684 /home/folder
pawel@pawel-ubuntu:/# du -h /home/folder
2.1M /home/folder/secondfolder
1.1G /home/folder

If you’re looking for a summary of the usage of a folder, you can perform this by running the following command:

du -sh /home/folder – display only a total for each argument. See example below:

pawel@pawel-ubuntu:/# du -sh /home/folder
1.1G    /home/folder

Notice that the 2.1Mb file did not show up in the summary, as the summary usually displays the largest blocks. If you’d like, you can change that by adding -b (for Byte blocks), -k (for Kilobyte blocks) or -m (for Megabyte blocks). Below is an example output of the summary of folder in Megabytes:

pawel@pawel-ubuntu:/# du -sm /home/folder
1029    /home/folder


df

“df” – or “disk filesystem” is a built-in utility that allows you to check disk space utilization in Linux. It displays the device name, total blocks, total disk space along with used and available space, use percentage and the mount points on the filesystem. This is particularly useful if you have different mount points especially on a shared drive or storage device. You can see many of the options for df by typing “man df” in your terminal, but I found that df -h is the most useful command for me. Below is an example output of the command:

pawel@pawel-ubuntu:/# df -h
Filesystem      Size    Used    Avail    Use%   Mounted on
udev                  3.9G        0      3.9G         0%   /dev
tmpfs              790M  9.6M  780M         2%  /run
/dev/sda1      286G    9.7G   262G         4%  /
tmpfs               3.9G    148K    3.9G          1%  /dev/shm
tmpfs              5.0M    4.0K    5.0M         1%  /run/lock
tmpfs               3.9G        0        3.9G        0%  /sys/fs/cgroup
tmpfs             790M     36K   790M        1%  /run/user/112


ncdu

“ncdu” – or “NCurses Disk Usage” is a curses-based version of the well-known ‘du’, and provides a fast way to see what directories are using your disk space. To note, this utility does not come pre-installed with Linux, so it needs to be installed. You can do so by running yum (Fedora) or apt-get (Debian/Ubuntu) command:

sudo yum install ncdu
sudo apt-get install ncdu

When you first run ncdu the utility will scan the sub-directories and count measure the space used by each sub-directory:

ncdu scanOnce the scan is complete, you will be presented with a screen that will allow you to use menus to get additional information about each sub-directory. You can learn more about this utility by pressing the “?” and using the up and down arrow keys to see all the menu options:

ncdu menuA complete manual for ncdu command can be found here: Ncdu Manual

Sunset April 2016

While driving west on I75 yesterday we decided to make a quick stop on one of the rest areas. It was so beautiful, peaceful and calm. I couldn’t believe that the waters and marshes were infested with aligators and snakes and other creepy things, but luckily the state has done its best to put up fences to prevent the wildlife from coming onto the highway and the pitstops. Chantale was scared to get out of the car, so I took my phone and took some pictures. Below is the shot from pit stop.

20160411_192640_HDR

After our stop we got back on the highway. The sun was getting lower and lower with each minute on the highway. There are not too many highways that you can experience this on, but we found ourselves driving directly toward the sun set.

20160411_193955_HDR

It looked as if we were driving directly into the sun. We felt like at the end of the road, there is a red ball that will lead us to another world. We were in the awe for a good 5 or 10 minutes. I took some additional photos.

 

 

 

20160411_194227_HDR20160411_194223_HDR20160411_sunset on i75

Weather today

Today we are in Ottawa visiting my wife’s parents. The weather network told us to expect rain and snow for today and tomorrow. However I must say that the weather network never disappoints me.  We had rain this mornin, then it was foggy, after that we had a bit of snow,  and now there are a few clouds in the sky and the sun is shining.  Today’s weather we had all seasons. Weather in Ottawa