Friday, August 17, 2018

Better Battery management in Laptop



For better battery management in Laptops, use TLP.

yum install tlp -y


To start:
systemctl start tlp

To check status:
systemctl status tlp


Configuration here:
/etc/default/tlp


Ref: https://linrunner.de/en/tlp/docs/tlp-linux-advanced-power-management.html



Wednesday, August 8, 2018

git diff - some additional options



git diff with word level precision :)


// note there is a dot at the end
# git diff  --word-diff-regex=.


// git diff , avoiding lines around actual diff and showing only the diff.
# git diff -U0


more will be updated..





Tuesday, August 7, 2018

untar xz extension tar file






.tar.gz or .tgz extension -> z flag

-> tar zxvf <tar file. tgz>

-> gzip used here




.xz extension -> J flag

-> tar Jxvf <tar file . xz>

-> xz utils used here

Monday, August 6, 2018

Update a running docker container and create a new image


Sometimes during development, you may want to update few files inside docker container - and wish to create a new image out of it.

You can make use of docker commit.

first get the docker id of the images you wish to save. using docker ps

# docker ps

02738dcd4cc2


Then, make changes inside the docker container (02738dcd4cc2) .

For example,

docker exec -it 02738dcd4cc2 bash
# touch /root/testfile 
# edit some configuration


Now, exit the docker container (02738dcd4cc2) and save a new image.
# docker commit 02738dcd4cc2 <updated_docker_container_name_you_have_given>


Now, you can run this  <updated_docker_container_name_you_have_given>, to see the changes.


Use this option judiciously.

Ideally, you should always make use of Dockerfile to make changes and test :)

Wednesday, August 1, 2018

How to get package dependencies of a specific package



How to get package dependencies of a specific package ?


// so check the package exists
$ rpm -qa | grep vim-X11
vim-X11-8.0.600-1.fc24.x86_64


// Now, get all dependencies
$ rpm -q --requires  vim-X11
/bin/sh
/bin/sh
/bin/sh
gtk3
hicolor-icon-theme
libICE.so.6()(64bit)
libSM.so.6()(64bit)
libX11.so.6()(64bit)
libXt.so.6()(64bit)
libacl.so.1()(64bit)
libacl.so.1(ACL_1.0)(64bit)
libattr >= 2.4
libc.so.6()(64bit)
libc.so.6(GLIBC_2.11)(64bit)
libc.so.6(GLIBC_2.14)(64bit)
libc.so.6(GLIBC_2.15)(64bit)
libc.so.6(GLIBC_2.2.5)(64bit)
libc.so.6(GLIBC_2.3)(64bit)
libc.so.6(GLIBC_2.3.4)(64bit)
libc.so.6(GLIBC_2.4)(64bit)
libcairo.so.2()(64bit)
libdl.so.2()(64bit)
libdl.so.2(GLIBC_2.2.5)(64bit)
libgdk-3.so.0()(64bit)
libgdk_pixbuf-2.0.so.0()(64bit)
libgio-2.0.so.0()(64bit)
libglib-2.0.so.0()(64bit)
libgobject-2.0.so.0()(64bit)
libgpm.so.2()(64bit)
libgtk-3.so.0()(64bit)
libm.so.6()(64bit)
libm.so.6(GLIBC_2.2.5)(64bit)
libpango-1.0.so.0()(64bit)
libpangocairo-1.0.so.0()(64bit)
libpthread.so.0()(64bit)
libpthread.so.0(GLIBC_2.2.5)(64bit)
libselinux.so.1()(64bit)
libtinfo.so.6()(64bit)
perl(:MODULE_COMPAT_5.22.3)
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(PayloadIsXz) <= 5.2-1
rtld(GNU_HASH)
vim-common = 2:8.0.600-1.fc24