Showing posts with label Fedora. Show all posts
Showing posts with label Fedora. Show all posts

15/07/2020

[bash] Extract all distinct lines from file

Using a combination of cut and uniq, it is possible to extract all distinct lines from a given file:

cut -d\; -f1 file.txt | uniq


It is optionally possible to sort the file as well adding sort to the command:


cut -d\; -f1 file.txt | sort | uniq

[bash] Extract characters before marker from all lines in a file with sed

Using sed, it is possible to quickly extract all characters before a given marker from all lines in a file with:

sed 's/MARKER.*//' file.txt

29/04/2020

[Docker] Move docker directory to different location on NTFS filesystem

The default location of docker files (images, volumes, networks, etc) on most distributions is /var/lib/docker

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

Some applications you install come as archives that you extract in a desired location. However, not all come with an installer that takes care of creating the proper application entries, leaving the task to the user.

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

In order to group application windows together, the WMClass and WMInstance attributes have been specified in the Inter-Client Communication Conventions Manual for X server 11.

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

We already saw how to customize a keyboard layout on Windows, now it's the turn of Linux, using XKB for Xorg.

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.

17/01/2015

[Fedora] VLC repository

In order to install VLC on Fedora, you'll need to add their repository to your sources.

Simply:

yum install --nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm

yum install vlc

If you find that you cannot play some media types, try installing these gstreamer plugins as well

yum install gstreamer-plugins-good gstreamer-plugins-bad gstreamer-plugins-ugly

[Yum] Add and manage custom repositories

In the latest Fedora versions, it is possible to add custom repositories to yum by creating a .repo file under the /etc/yum.repos.d/ folder following this structure:

[REPOSITORY_NAME]
baseurl=REPOSITORY_URL
enabled=1
gpgcheck=1
gpgkey=URL_TO_KEY

This will add and enable the repo available at REPOSITORY_URL signed by the GPG key found at URL_TO_KEY to your list.

Here's a couple of offical Fedora repos for Google Chrome and VirtualBox:

[Fedora] [Gnome] Use delete key to delete files

For some reason, on Fedora 21 - and possibly earlier versions too - you're required to Ctrl + Delete to send a file to the trash instead of the plain old single key Delete.

This behaviour can be reverted back to the good old ways by editing the accels file under /home/USER/.config/nautilus/

Find the line:

 ;(gtk_accel_path "<Actions>/DirViewActions/Trash" "<Primary>Delete")  


and edit it to:

 (gtk_accel_path "<Actions>/DirViewActions/Trash" "Delete")  


now if you log out and in again you're set.

31/07/2011

Realtek wireless on Fedora

This article applies to the 819x Realtek wireless cards series like models 8191SEvB, 8191SEvA2, 8192SE, …

Main reference site is Stanislaw Gruszka’s compact wireless website.

You can either try the -stable version or the –next. Both have different kernel requirements, the –next version, though more unstable, is compiled against the latest kernel version so you should run yum update kernel as root before installing the appropriate package for your system.

After installation you will have to reboot the system before being able to use and control your wireless card through NetworkManager.

 

ITALIANO:

 

Questo articolo si applica ai modelli di schede wireless Realtek serie 819x quali 8191SEvB, 8191SEvA2, 8192SE, …

Il sito di riferimento é compact wireless di Stanislaw Gruszka.

Potete provare sia la versione -stable che la –next. Entrambe hanno differenti requisiti di kernel, la versione –next, sebbene piú instabile, é compilata per l’ultima versione del kernel supportata dal sistema per cui é sufficiente lanciare yum update kernel da root prima di installare il pacchetto corretto per il proprio sistema.

Al termine dell’installazione sará necessario riavviare il sistema prima di poter usare e controllare la propria scheda wireless attraverso il NetworkManager.