Wednesday, May 12, 2021

Free up space in ubuntu server

 Clean old kernels

  • Check for kernet is use : uname –r
  • Check for old kernels : dpkg --get-selections | grep linux-image
  • Remove unused kernels : dpkg --get-selections | grep linux-image
Clean APT (Pulled from https://askubuntu.com/questions/5980/how-do-i-free-up-disk-space)
  • To delete downloaded packages (.deb) already installed (and no longer needed)
    • sudo apt-get clean
  • To remove all stored archives in your cache for packages that can not be downloaded anymore (thus packages that are no longer in the repository or that have a newer version in the repository).
    • sudo apt-get autoclean
  • To remove unnecessary packages (After uninstalling an app there could be packages you don't need anymore)
    • sudo apt-get autoremove
Finally, Check Disk Space
  • df -h /

Thursday, August 6, 2020

view largest installed debian packages on unix

More details on this link https://www.commandlinefu.com/commands/view/3842/list-your-largest-installed-packages-on-debianubuntu

dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 10

Tuesday, March 24, 2020

pull multiple files from android via adb

Got answer from https://stackoverflow.com/questions/11074671/adb-pull-multiple-files

adb shell 'ls /sdcard/DCIM/Camera/20200327*.mp4' | tr -d '\r' | xargs -n1 adb pull

Monday, November 20, 2017

get the size of folder contents

du -sh 

Output

15M big_folder
0 dead.letter
4.0K some_file
4.0K some_other_file

Wednesday, November 15, 2017

challenges with grails unique: true

Grails does not evaluate a unique constraint at GORM level but at the database level

    static constraints = {
        property unique: true
    }

This means that you would not get a grails.validation.ValidationException but a org.springframework.dao.DataIntegrityViolationException.

This means that

domainInstance.validate()

would not capture a duplicate "property"

Wednesday, August 16, 2017

Sometimes cron runs twice

I suspected cron was running twice. I confirmed by checking the system logs

grep CRON /var/log/syslog

Then I killed cron and restarted it

sudo /etc/init.d/cron stop
sudo /etc/init.d/cron start