Linux Snippets

This is a collection of linux tips/commands I found useful during my linux journey. I try out different linux distro every now and then so this post contains a mix of different distro as well.

Currently I am running Manjaro Linux.

Mounting NTFS file system after a fresh installation.

yum --enablerepo=extras install epel-release
yum install ntfs-3g fuse

About mounting and fstab

A complete guide to fstab for automounting.


Setup multimedia on CentOS 7


When a repository is causing problem, head to

/etc/yum.repos.d/

And open up the repos that’s causing problem and set

enabled=1

to

enabled=0

Find dependencies for a particular package

yum deplist <package name>

Example:

yum deplist vlc

Find out where a package comes from

yum provides <packgage name>

Dependencies for Handbrake


Easiest way I found to install nvidia driver on Cent OS 7

rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm
yum install nvidia-detect
yum install $(nvidia-detect)

Install Skype on Cent OS 7

Guide on centos wiki here states the easiest method is to use the nux-desktop repository, but at the time of writing this even though I have nux-repo yum can’t seem to find skype package, so here goes
get https://repo.skype.com/latest/skypeforlinux-64.rpm
sudo yum localinstall skypeforlinux-64.rpm

Wacom multiple monitor mapping with xsetwacom (Wacom settings not found in KDE Plasma)

https://github.com/linuxwacom/xf86-input-wacom/wiki/Dual-and-Multi-Monitor-Set-Up-II

When device doesn’t shows up on KDE Connect (You can run the following commands each time, or use the append argument to add it to it permanently)

iptables -I INPUT -p tcp --dport 1714:1764 -j ACCEPT iptables -I INPUT -p udp --dport 1714:1764 -j ACCEPT

Maya fonts error

sudo yum install xorg-x11-fonts*

Combine pdf file with command line, details here

sudo yum install pdftk
pdftk file1.pdf file2.pdf file3.pdf output outputName.pdf

Open a .jar file with java.

java -jar file.jar

Find and delete duplicate files

https://www.tecmint.com/fdupes-find-and-delete-duplicate-files-in-linux/

Tell yum to treat a manually installed package as installed, solution found hereTwo possible solutions.

1) You will need to download the package that you want to install and install them via the rpm command using the –nodeps option. To download the rpms, you should first ensure that you have the “yum-utils” package installed because it contains the “yumdownloader” command. Let’s say the package name is “something-xyz”. Here are the commands to download and install that package:
# Download the package
yumdownloader something-xyz

# Test whether emacs is the only dependency.
rpm -Uvh --test something-xyz.rpm

# If emacs is the only dependency, then install the package
rpm -Uvh --nodeps something-xyz.rpm

If there are other dependencies, than you can try to install via yum if they are not dependent on emacs. Otherwise, you will need to do the same process as above to install them.

2) If all of this does not work with your hand installation of emacs, then the last resort would be to install the emacs version that yum by default wants to install, but invoke your own version of emacs instead of the one yum installs.


According to this post here, changing/adding environment paths in CentOS 7 by adding .sh file in /etc/profile.d, below is sample of adding pycharm/bin

In CentOS

# echo 'pathmunge /opt/pycharm-edu-2018.2/bin/' > /etc/profile.d/pycharm.sh

In Ubuntu

# echo 'PATH="/opt/pycharm-edu-2018.2/bin/:$PATH"' > /etc/profile.d/pycharm.sh

Next,

# chmod +x /etc/profile.d/pycharm.sh
# . /etc/profile

Customizing extra buttons on my mouse, reference askubuntu, stackexchange and ArchWiki

Install the required packages as shown below. In my case xev was already installed.

sudo yum install xev xbindkeys xdotool

Create a default xbindkeys configuration file

xbindkeys -d > ~/.xbindkeysrc

To find out mouse button name, run xev in terminal, it’ll open a blank window for you to move or click your mouse in. But note that it will also print mouse movement, so to isolate mouse clicks only run this instead

xev -event mouse | grep Button --before-context=1 --after-context=2

Open ~/.xbindkeysrc with your preferred text editor, and this is where you map specific functions to your mouse button with the button names you gathered from previous step. For my purpose I was mapping button 8 and 9 to volume control, which resulted in the code below in my ~/.xbindkeysrc

"xdotool key XF86AudioLowerVolume"
    b:8
"xdotool key XF86AudioRaiseVolume"
    b:9

However I realized it doesn’t do the action repeatedly when the key is held down. So with help from this post, here’s the modified xbindkeysrc

"xdotool keydown XF86AudioLowerVolume"
    b:8

"xdotool keyup XF86AudioLowerVolume"
    b:8 + Release

"xdotool keydown XF86AudioRaiseVolume"
    b:9

"xdotool keyup XF86AudioRaiseVolume"
    b:9 + Release

Command to open default terminal program

x-terminal-emulator

works for most Debian distros…While trying to find something that works across distros I found this amazing yet ridiculous solution.

Check out my post here for information regarding adapting this into python.


Dolphin Plugin: Copy as path

This plugin adds an option in dolphin right click menu to Copy Path


Removing uninstalled application from Krunner/Plasma Search

Simply navigate to

/usr/share/applications

And start running commands to delete the shortcuts you no longer need


Working with Windows Dynamic Disk

Folloing guide from Arch, install ldmtool, or on Manjaro is called libldm in Octopi. Then pretty much follow every step from the Arch guide link above.

Leave a Reply

Your email address will not be published. Required fields are marked *