Check installed packages

Todos los paquetes con su descripcion y estado actual dpkg -l Buscar los paquetes que empiezan por g, y mostrar su estado dpkg -l | grep '^....g' aptitude search '~i(~n gr)' Mostrar todos los paquetes que empiezan por gr dpkg -l | awk '{print $2}' | grep ^gr List all packages ordered by installed size The easiest way (without installing extra packages) is: dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n which displays packages in size order, largest package last. ...

July 24, 2020 · Alberto Casado

Remove older kernel versions

These were taken from this source. My one-liner to remove old kernels (this also frees up disk space) dpkg --list | grep linux-image | awk '{ print $2 }' | sort -V | sed -n '/'`uname -r`'/q;p' | xargs sudo apt-get -y purge Explanation (remember, | uses the output of the previous command as the input to the next) dpkg –list lists all installed packages grep linux-image looks for the installed linux images awk '{ print $2 }' just outputs the 2nd column (which is the package name) sort -V puts the items in order by version number sed -n '/'`uname -r`'/q;p prints the lines before the current kernel xargs sudo apt-get -y purge purges the found kernels Unwinding the sed invocation: ...

July 24, 2020 · Alberto Casado

Check directory size

Check size of a directory and subdirectories (and files with -a): du -ha ~ du -hd 1 --time --exclude=./.* -d N, --max-depth=N: shows size to level N See partitions sizes df -h

July 23, 2020 · Alberto Casado

Find duplicated files

Find duplicate files in a directory tree (recursively) Based on md5sum differences find . -type f -exec md5sum {} + | sed 's!.*/\(.*\)\.[^.]*$!\1|&!' | awk -F\| '{i=indices[$1]++;found[$1,i]=$2}END{for(bname in indices){if(indices[bname]>1){for(i=0;i<indices[bname];i++){print found[bname,i]}}}}' Based on filename differences find . -type f -print | sed 's!.*/\(.*\)\.[^.]*$!\1|&!' | awk -F\| '{i=indices[$1]++;found[$1,i]=$2}END{for(bname in indices){if(indices[bname]>1){for(i=0;i<indices[bname];i++){print found[bname,i]}}}}' Using fdupes fdupes -dSr dir

July 23, 2020 · Alberto Casado

Change gtk2 themes

First get the theme from e.g. https://www.gnome-look.org/p/1079661/ Then extract it to ~/.themes with tar xvf dnl/62940-CatBlack.tar.gz -C .themes and finally select the theme in ~/.gtkrc-2.0: gtk-theme-name="CatBlack"

April 16, 2020 · Alberto Casado

rsync to Raspberry Pi with LibreElec

The command to be used is rsync -Phivaz --rsync-path=.kodi/addons/virtual.network-tools/bin/rsync --stats /orig/dir/ /remote/dir/ after having installed the rsync addon from virtual network-tools in the LibreElec repos.

April 14, 2020 · Alberto Casado

Bluetooth setup

pacmd list-sinks pacmd set-card-profile bluez_card.FC_A8_9A_58_FF_1D a2dp_sink

April 12, 2020 · Alberto Casado

fstab

To include a mount point in fstab: sudo blkid Get the UUID related to your partition. Change the /etc/fstab file adding this line: UUID="deviceUUID" /mnt/devName ntfs users,defaults 0 0 Create a directory owned by the user who will mount it: sudo mkdir /mnt/devName sudo chown user /mnt/devName sudo chmod +rw /mnt/devName Example: # <file system> <mount point> <type> <options> <dump> <pass> # / was on /dev/sda1 during installation UUID=574d9999-a5ee-4ee6-a7f0-dc7a71342655 / ext4 relatime,errors=remount-ro 0 1 /dev/mapper/trisquel--vg-home /home xfs relatime 0 2 /dev/mapper/trisquel--vg-swap_1 none swap sw 0 0 UUID=84B66EADB66EA002 /media/tosh ntfs defaults,noauto,nofail,user 0 2 UUID=5e042100-2bb6-4c47-8ee3-d124719355d3 /media/integral ext4 defaults,noauto,nofail,user 0 2 NTFS Permissions for ntfs and vfat file systems must be set with the dmask, fmask and umask options. dmask controls permissions for directories, fmask controls permissions for files, and umask controls both. Since these options set masks, they should be the complement of the permissions you want. For example, rwx for the owner and rx for others is 022 rather than 755. ...

April 12, 2020 · Alberto Casado

Set brightness

It can be done by writing to the backlight file: sudo su; echo 900 > /sys/class/backlight/intel_backlight/brightness Also, with xrandr: brightness () { primary=$(xrandr | grep 'primary' | cut -d ' ' -f 1) xrandr --output $primary --brightness $1 }

April 12, 2020 · Alberto Casado

GNU magic keys

If GNU system is not responding (for whatever reason which could be analysed through the system logs), there are different combinations of keys which allow taking control of the system back. It is the magic keys, a combination of keys which are usually activated in all distributions. The system petition function is usually assigned to the Print Screen key. Alt+PrintScreen+: r: it takes control of the keyboard in an X system. Many times it is the X system itself which causes the system freeze. After Alt+PrintScreen+r, the combination Ctrl+Alt+Backspace can be tried to log out of X. s: writes data to the hard disk cache. e: sends the SIGTERM signal to all processes but init. i: sends the SIGKILL signal to all processes but init. u: remounts the whole filesystem in read-only mode, to ensure a safe reboot. b: reboots the system. These are the classical well-known combinations, but there are other magic combinations which can be useful in other situations: ...

March 15, 2020 · Alberto Casado