Search

Search in folder for files containing words

 

grep -rnw '/ext/' -e "/t3new/"

 

Search for word in files matching a pattern

 

grep -irH upload_max_filesize `find . -name "*.ini"`
grep -irH upload_max_filesize `find . -name "*85.93.72.162*"`

Apt check for package

apt-cache search autokey

Run sth as other user

sudo runuser -u www-data composer ...

Linux check if still writing to USB Stick

This command will show you the number of "Dirty" and "Writeback" blocks in the filesystem cache:

 

watch grep -e Dirty: -e Writeback: /proc/meminfo

 

Basically, "Dirty" should approach zero as the cache is flushed to disk. It's a bit low-level and maybe not straightforward, but it's the best approximation I've found.

More here: https://unix.stackexchange.com/questions/48235/can-i-watch-the-progress-of-a-sync-operation

Network stuff

Find out ports, who listens where

sudo netstat -toolpn | grep LISTEN

 

oder

 

sudo lsof -nP -iTCP -sTCP:LISTEN

Find out System stuff

which system

cat /etc/os-release 

 

 

which Kernel version

uname -r

 

 

Check: Wayland or Xorg

echo $XDG_SESSION_TYPE

 

(change in login sreen)

GCC error: stray XXX in YYY

Hunderte von Fehleren der Art beim Kompilieren.

Zuerst

Wahrscheinlich ist ein nicht vorhandes Addon in addons.make?

Check

  • Windows/Linux-Problem: File utf-8?
  • Line-Feeds
  • OF root in config.make

Workaround

GCC-Version neu installieren und /oder auf andere Version setzen

 

sudo apt install build-essential
sudo apt install gcc-9 g++-9 gcc-10 g++-10 gcc11 g++-11

 

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 --slave /usr/bin/gcov gcov /usr/bin/gcov-10
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 --slave /usr/bin/g++ g++ /usr/bin/g++-9 --slave /usr/bin/gcov gcov /usr/bin/gcov-9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 80 --slave /usr/bin/g++ g++ /usr/bin/g++-8 --slave /usr/bin/gcov gcov /usr/bin/gcov-8

 

sudo update-alternatives --config gcc

 

 

wget mirror

wget --mirror --convert-links --adjust-extension --page-requisites --no-parent web.archive.org/web/20180720222106/http://www.zitrusgarten.com/DT/arten.php

list Machines in Network

arp -a (sudo apt install net-tools)

list dirs with size

du -m --max-depth 1 | sort -rn
du -ah /home | sort -n -r | head -n 10

 

-h, --human-readable
-m like --block-size=1M 
-a, --all write counts for all files, not just directories

SSH keygen

ssh-keygen -t rsa -b 4096
ssh-keygen -t dsa

Images auflisten

sudo fdisk -l

 

ohne loops (thanks snap!)

 

sudo fdisk -l | sed -e '/Disk \/dev\/loop/,+5d'

image erstellen mit Rückmeldung

dd if=/dev/DISK bs=4096 | pv | dd of=datei.img bs=4096

Bilder: batch-resize

find . -name "*.jpg" | xargs convert -resize 50%        (erstellt Kopien)
find . -name "*.jpg" | xargs convert -resize "1000x1000>" -quality 80 -unsharp 0x1    (erstellt Kopien)
find . \( -name "*.png" -o -name "*.PNG" \) | xargs -d '\n' convert -resize "1000x1000>" -quality 80 -unsharp 0x1    (erstellt Kopien)

(-d '\n' sorgt delimiter = new line, dann gehen auch Blanks im dateinamen)

(mogrify statt convert würde die Bilder überschreiben)

Flatpak

Path for flatpak apps

/var/lib/flatpak/app/im.dino.Dino/current

Where does a flatpak app expect data/settigs, aka '~/.local/share/'?

Within the sandbox, XDG_DATA_HOME is ~/.var/app/im.dino.Dino/data
[see also]

What's the path for Flatpak .desktop files

The .desktop file for each app is installed inside its checked out tree.

So if you install org.gnome.Builder system-wide, the desktop file is at:

 

/var/lib/flatpak/app/org.gnome.Builder/current/active/files/share/applications/org.gnome.Builder.desktop

 

However Flatpak knows a few things about desktop apps in general. One thing it knows is that an app will always have a .desktop file in its tree under share/applications/${APPID}.desktop, so it actively searches for these and "exports" them.

That means you can find the .desktop file in the exports/ directory for the app, which in the previous example is:

 

/var/lib/flatpak/app/org.gnome.Builder/current/active/export/share/applications/org.gnome.Builder.desktop

 

But then that's not very useful, Flatpak can't tell your desktop to go and search for apps in all the possible exports/ directories, one for each installed app.

So in addition, Flatpak takes everything for the per-app exports/ directories and puts it in a global exports/ directory. That means for our example you can find it at:

 

/var/lib/flatpak/exports/share/applications/org.gnome.Builder.desktop

 

Of course, all the above applies to per-user applications as well, just replace /var/lib/flatpak/ by ~/.local/share/flatpak/