Skip to content

Instantly share code, notes, and snippets.

IP Bastola ipbastola

View GitHub Profile
@ipbastola
ipbastola / jq to filter by value.md
Last active Apr 21, 2019
JQ to filter JSON by value
View jq to filter by value.md

JQ to filter JSON by value

Syntax: cat <filename> | jq -c '.[] | select( .<key> | contains("<value>"))'

Example: To get json record having _id equal 611

cat my.json | jq -c '.[] | select( ._id | contains(611))'

Remember: if JSON value has no double quotes (eg. for numeric) to do not supply in filter i.e. in contains(611)

@ipbastola
ipbastola / free-system-space.md
Last active Sep 29, 2016
Free System space from massive log files
View free-system-space.md

Free System Space from Massive Logs

  1. Remove compressed log files from /var/log
$ sudo find /var/log -type f -name "*.gz" -delete
  1. Truncate Log files
$ cd /var/log
@ipbastola
ipbastola / clean-up-boot-partition-ubuntu.md
Last active Apr 21, 2019
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64
View clean-up-boot-partition-ubuntu.md

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r 
@ipbastola
ipbastola / cifs-mount.md
Created Jul 21, 2016
How to mount CIFS into Ubuntu 14.04-x64 LTS
View cifs-mount.md

CIFS Mount on Ubuntu 14.04

1. Install packages

$ sudo apt-get install cifs-utils

2. Create a Mount point Directory

$ sudo mkdir /mnt/CIFSMOUNT
You can’t perform that action at this time.