15/07/2020
[bash] Extract all distinct lines from file
[bash] Extract characters before marker from all lines in a file with sed
29/04/2020
[Docker] Move docker directory to different location on NTFS filesystem
This can be easily changed with the daemon.json configuration file.
First stop the docker service and make sure it is completely stopped.
You can now edit or create the configuration file under /etc/docker folder. In there, you can specify a new location for the docker files with the graph attribute:
{
"graph": "/path/to/new/docker_folder"
}
You can then copy ALL the content to the new location or let docker recreate everything from scratch there.
WARNING: if the new location is on a different filesystem you might need to change the storage driver AND existing data might become inaccessible (it will remain on the filesystem though)
To set a new storage driver, set the storage-driver attribute as well (example for NTFS):
{
"graph": "/path/to/new/docker_folder", "storage-driver": "vfs"
}
28/04/2020
[GNOME] Create application shortcut that can be added to favorites
You can add a shortcut for any application by creating a file APPLICATION_NAME.desktop under /usr/share/applications and adding this content:
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Type=Application
Terminal=false
Categories=OPTIONAL_CATEGORY_LIST
GenericName=APPLICATION_NAME
Comment=OPTIONAL_COMMENT
Name=APPLICATION_NAME
Path=FULL_PATH_TO_APPLICATION_FOLDER
Exec=FULL_PATH_TO_APPLICATION_EXECUTABLE
Icon=OPTIONAL_FULL_PATH_TO_ICON
StartupWMClass=APPLICATION_WM_CLASS
[Linux] Find WM_CLASS value for an application
Long story short, they are two strings that are used to associate application windows to a specific application, they can be set by the application (WMClass) or the user (WMInstance).
They are very useful especially for those applications that are customizations or based on existing tools, which alone would have a different value (eg Java or Eclipse based apps).
Finding the value for a window is as simple as opening a terminal and running:
xprop
Then clicking on the desired window
25/04/2020
[Linux] Custom keyboard layout QWERTZ to QWERTY
Remapping keys is as simple as editing a text file. You will find all available layouts under /usr/share/X11/xkb/symbols, you can use them as basis for a new layout or directly edit them.
Pick the layout you want to change (maybe make a backup first), then invert the VALUES ONLY of the two lines containing the lower and uppercase z and y, then save.
You will need to restart X server and the changes will be in effect.
15/08/2018
[Ubuntu] Revert kernel back to older version
I always keep only 2 kernel versions after every update, so that I can boot back if something goes wrong. This usually helps, except today I decided to upgrade my Ubuntu from 16.04 to 18.04 since I like spending my nights fixing stuff after unnecessary upgrades, but hey, the future is there.
So I first fully updated my current installation (1st kernel bump), then migrated to the new one (2nd kernel bump) and it turns out I got two 4.15 kernels, with only different minor version.
Double interesting, my wireless card:
02:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8821AE 802.11ac PCIe Wireless Network Adapter
apparently has issues (read: bug) with kernel 4.15 preventing it from working at all (not even connected to the router), and even more interesting, on one version it can actually only connect to websites under google.com domain..
Anyway, quick fix was to revert back my kernel, here is how for future me to remember:
- go to http://kernel.ubuntu.com/~kernel-ppa/mainline/ and download in the same folder: linux-headers-VERSION-generic-XXX_SYSTEM.deb, linux-headers-VERSION_all.deb, linux-image-VERSION-generic-XXX_SYSTEM.deb for your system, eg I have 64 bit system and got amd64 files
- install them by going into the folder where you downloaded them, make sure there are only those three .deb files and run: sudo dpkg -i *.deb
- restart the system, then press SHIFT at boot to enter the GRUB choices, then check from the top line (number 0) to the line of your kernel version. If your installation has the "Advanced" menu entry and does not display all kernels, go there and do the same counting. We need this to set a default GRUB entry to always boot in this kernel
- edit /etc/default/grub and change the value of GRUB_DEFAULT to the number you counted OR to (exactly as shown) "1>N" if you have the "Advanced" menu option. This means you want to boot into the Nth entry (starting from 0) under the "Advanced" menu. Also set GRUB_TIMEOUT to some value in seconds that's more than 1, to have some time to block the boot process in case of mistakes
- run sudo update-grub and you are set
24/05/2014
[Debian] Run Wireshark as non-root user
To enable non-root users to run a live capture too, simply dpkg-reconfigure it:
sudo apt-get install wireshark
sudo dpkg-reconfigure wireshark-common
When prompted to allow non-root user to perform restricted operations, say Yes.
Then logout and login again and you should be set. If not, add your user to the wireshark group:
sudo usermod -a -G wireshark $USER
[Debian] Test APT changes without altering the system
10/05/2014
[Debian] Set up wireless networking on a Lenovo T430 laptop
[Debian] Install MATE desktop environment
Installing it is really simple; this guide will describe how to add it to Debian Wheezy (stable release).
[Debian] Install package and its dependencies using dpkg
dpkg -i package.deb
its dependencies will not be automatically installed. To solve this, run:
apt-get -f install
after the dpkg installation
04/04/2009
Install Debian
This is the Debian Etch/Lenny/Sid installation guide I made. WARNING: Some parts of this guide are for the internet installation mode, if you don't have a lan/usb internet connection, download the full CDs - at least the first one -, since otherwise the installer won't work. Questa è la guida all'installazione di Debian Etch/Lenny/Sid che ho creato. ATTENZIONE: Alcune parti di questa guida riguardano l'installazione via internet, se non avete una connessione lan/usb, scaricate i CD - o almeno il primo -, poichè altrimenti l'installer non funzionerà .
-->IN ENGLISH:
- First, we need to download and burn an installation "businesscard" .iso image. Take it from here.
- Place it into your cd-drive and reboot your system.
- DON'T PRESS ENTER, but press F1 then F3, and type
expertguito install using the gui installer, orexpert, then press enter. - Follow all the steps until you are prompted to choose between : "Stable" (Etch), "Testing" (Lenny) or "Unstable" (Sid).
- Keep going until you're asked on which type of installation you want. Choose only "Base system" - and "Laptop" if you need it -but don't select "Desktop environment" too - unless you want to have the WHOLE gnome installation (not recommended, why would this guide be here for otherwise?) -.
- When it's installed, you'll be in shell login mode. And you'll need to install the Xserver, the login manager, and the desktop - if you want them of course -.
- Login and go in root:
su - Type:
apt-get install xserver-xorg-core xorgto install the xserver and configure it when it's installed. - Now install the login manager you want:
apt-get install gdmif you want gnome (recommended) or kdm if you want kde. Install the login manager for the desktop you want. So if you want gnome install gdm, otherwise install kdm for kde. - Finally, install the desktop environment you want:
apt-get install gnome-corefor a minimal gnome installation - recommended, light but very very minimal. You'll have to install all the software you want later manually -, if you want all you'll just have to choose also "Desktop environment" at point 5, but again.. why would this guide be here for? Anyway, if you decide to install the whole gnome just type:apt-get install gnome. If you want kde replace gnome with kde in the code lines. - Now reboot your system and login. If the graphical login doesn't start, try:
dpkg-reconfigure xserver-xorg - Ok, now you're done. You'll find a base Debian system running and you can start to install the software you need
- Just one more thing: if you want to use sudo add this line in the /etc/sudoers file (from root
nano /etc/sudoers):yourusername ALL = (ALL) ALL
-->IN ITALIANO:
- Scaricate e masterizzate un'immagine .iso "businesscard" da qui.
- Inseritela nel lettore e riavviate.
- NON PREMETE INVIO, ma F1 quindi F3, e digitate
expertguiper installare usando la gui, oppureexpert,quindi premete invio - Seguite i passi finchè non vi sarà chiesto di scegliere tra: "Stable" (Etch), "Testing" (Lenny) o "Unstable" (Sid).
- Continuate finchè non vi sarà chiesto che tipo di installazione volete. Scegliete solamente "Sistema base" - e "Computer portatile" se necessario - ma non selezionate anche "Ambiente desktop" - a meno che non vogliate l'installazione COMPLETA di gnome (non consigliato, a che servirebbe questa guida altrimenti?)-.
- Quando è installato, vi ritrovere in modalità di login shell. E dovrete installare Xserver, il login manager, ed il desktop - sempre se li volete -.
- Loggate ed andate in root:
su - Digitate:
apt-get install xserver-xorg-core xorgper installare xserver e configurarlo al termine. - Adesso installate il login manager desiderato:
apt-get install gdmse volete gnome (consigliato) o kdm se volete kde. Installate il login manager per il desktop che volete, quindi gdm per gnome altrimenti kdm per kde. - Infine, installate l'ambiete desktop desiderato:
apt-get install gnome-coreper un'installazione minimale di gnome - consigliato, ma davvero minimale. Dovrete installare tutto il software che volete in seguito manualmente -, se volete tutto basta scegliere anche "Ambiente desktop" al punto 5, ma di nuovo.. cosa ci sta a fare questa guida? Comunque, se decidete di installare tutto gnome digitate:apt-get install gnome. Se volete kde sostituite gnome con kde nelle righe di codice. - Adesso riavviate e loggate. Se non dovesse partire l'ambiente grafico, digitate:
dpkg-reconfigure xserver-xorg - Ok, adesso avete finito. Avrete un sistema base Debian e potrete iniziare ad installare il software desiderato.
- Un'ultima cosa: se volete usare sudo, aggiungete queste righe in /etc/sudoers (da root
nano /etc/sudoers):vostrousername ALL = (ALL) ALL
Enable automount on Debian
To enable the auto mount feature, just type in a terminal: sudo apt-get install gnome-volume-manager pmount Expecting more steps? Sorry to inform you that it's all done. :)
Per abilitare l'auto mount, digitate in un terminale: sudo apt-get install gnome-volume-manager pmount Vi aspettavate altri passi? Spiacente di informarvi che è tutto fatto. :)