Useful Linux Stuff
Commands
Copy, instead of cp
rsync -avh sourcedir/ destinationdir/
Copies all the files in sourcedir
to destinationdir
. If you omit the "/" slash, if will copy with the folder.
Scrape a website easily
wget -mpEk "url"
Download websites ONLY with internal links and correct path.
List largest directories on system
expac "%n %m" -l'\n' -Q $(pacman -Qq) | sort -rhk 2 | less
List largest directories on system.
Windows ISO
sudo ./woeusb-5.2.4.bash --device /destination/of/windows.iso /dev/device-of-usb-nonumber --tgt-fs NTFS
Create windows ISO via WoeUSB, on Linux (for some reason).
Youtube Downloader
To use yt-dlp
, install yt-dlp from AUR or any package manager.
yt-dlp --remux-video mp4 "VID_LINK_HERE"
Will download a video (both frames and audio) in mp4 format.
yt-dlp --extract-audio --audio-format mp3 "VID_LINK_HERE"
Will download a video's audio file only. You may prosper with this useful package on many sites on the web; YouTube, Bitchute, Odysee, etc.
List all fonts on system
fc-list | grep "Iosevka"
You could combine fc-list to search for a specific font, like the Iosevka family, just like above.
Change between keyboard layouts easily
Works only on Xorg, as far as I am aware.
setxkbmap -layout hu,us,ru -option 'grp:win_space_toggle'
Allows you to change inbetween keyboard layouts, with WIN+Space
keys.
Remove all .EXTENSION files, starting from current dir (thanks Christos)
find . -type f -name '*.xml' -exec rm -f {} +
This command will remove all .xml files recursively. Thanks Christos.
Python Virtual Environment (venv)
To create a virtual environment with name .venv
:
python -m venv .venv
To activate the environment via sh/bash:
source .venv/bin/activate
Via fish shell:
source .venv/bin/activate.fish
Installing torch packages via pip
, for example:
pip install torch torchvision audio
Those packages will be installed in the .venv/lib/python3.13/site-packages
directory.
Conda Environments
Conda Version
Download the minimal installer of Conda from the official miniforge GitHub Releases page, then run the shell script.
When you'll be installing Conda from the miniforge installer, you'll be prompted to install it somewhere, usually at /home/anon/miniforge3/
. I set mine to be at .miniforge3
to make it hidden. By default, you won't have the binary files be on your PATH, so set them on your path (for Fish):
set -gx PATH $PATH /home/anon/.miniforge3/bin/
To check Conda version:
conda --version
Conda create environment in absolute path
To create a Conda project:
conda create --name newProject python=3.10
- If you use Fish shell:
conda init fish
- If you use Bash:
conda init
To "get inside", or activate the project:
conda activate newProject
To install a package:
conda install numpy
To view installed packages:
conda list
To deactive, or "detach" from an environment:
conda deactivate
To see all your environments:
conda env list
To remove an environment:
conda remove --name newProject --all
After you're done with the Conda environments, make sure to use this command if you use Fish:
conda init --reverse fish
Conda create environment in specified path
To create:
conda create -p /home/anon/Projects/newProject python=3.10
To activate:
conda activate /home/anon/projects/myenv
Tricks
Move mouse with numeric keys
setxkbmap -option keypad:pointerkeys
xkbset ma 60 10 10 5 2
Install xkbset
from AUR. Press Ctrl+LeftShift+Numlock
to enable/disable.
Wacom Tablets on Linux
To make Wacom tablets work on Arch Linux, install libwacom
and xf86-input-wacom
from AUR or any other package manager that has them.
Then, run sudo modprobe wacom
to add Wacom as a module for the current running instance. Do the respectable changes if you'd like to start Wacom on every launch of your machine.
The command below will display you all the Wacom devices.
xsetwacom list devices
In my case, it displays:
In this case, typing in these commands will ensure that the STYLUS device will run on the main monitor, on 1920x1080 resolution.
xsetwacom set 15 MapToOutput 1920x1080+1920+0
xsetwacom set 15 Area 0 0 15200 8550
xsetwacom set 15 PressureCurve 0 0 100 100
Apologies for the lack of better words.
Fish EOF
Use EOF (heredoc) inside fish shell:
echo -n "
one
two
three" > test.txt
Fixes
\LaTeX hyphenation fix
I had a problem with the Hungarian hyphenation in LaTeX. I solved it by installing the whole texlive
group from the Arch Repository (probably not a great practice, but this worked). Then, I put hungarian loadhyph-hu.tex
in all the language.dat
, language.us
files I could find (the ones in /usr/share/texmf-dist/tex/generic/config
, and /etc/texmf/tex/generic/config
). You only need to download texlive-langeuropean
and texlive-langother
for hyphenated languages to work correctly.
Arch Linux Short Freezes on Laptop
I remember having small but really frustrating freezes on my Thinkpad X260 machine. Turns out, a functionality called Panel Self-Refresh caused this.
To resolve this issue:
- You must add this snippet to your grub configuration (
sudo nano /etc/default/grub
):GRUB_CMDLINE_LINUX_DEFAULT="i915.enable_psr=0"
- Then remove old grub config :
sudo rm /boot/grub/grub.cfg
orsudo rm /boot/grub2/grub.cfg
- After that generate new :
sudo grub-mkconfig -o /boot/grub/grub.cfg
orsudo grub-mkconfig -o /boot/grub2/grub.cfg
- Reboot your system.
- (Optional) For better touchpad functionality add
psmouse.synaptics_intertouch=1
toGRUB_CMDLINE_LINUX_DEFAULT
.
Virtualbox Problems
Many such cases is that Virtualbox won't work nicely on Arch-based distros, if you don't follow the official wiki. Running sudo pacman -S virtualbox-host-modules-arch
, then sudo vboxreload
will most likely fix the issue. If the problem persists, doing a full system upgrade doesn't hurt.
NVIDIA Drivers breaking system (TAILORED TO MY NEEDS!)
If NVIDIA drivers break your display manager somehow, the solution is here to solve that problem.
First off, delete all NVIDIA drivers:
sudo pacman -R nvidia nvidia-utils nvidia-open
Blacklist Nouveau so it doesn't start automatically (you can enable nouveau by sudo modprobe nouveau
or disable with sudo modprobe -r nouveau
):
echo "blacklist nouveau" | sudo tee /etc/modprobe.d/nouveau-blacklist.conf
Then, install these drivers:
sudo pacman -S nvidia-dkms nvidia-utils lib32-nvidia-utils
If some issue arises, and it spits out messages about files existing in the filesystem, resort to this command:
sudo pacman -S nvidia-dkms nvidia-utils lib32-nvidia-utils 2>&1 | grep 'exists in filesystem' | awk '{print $2}' | xargs sudo rm