Home » Blog

Shell Kommandos out of Space

<time datetime='2022-06-21 00:00:00 +0000 UTC'>June 21, 2022</time>&nbsp;·&nbsp;4 min&nbsp;·&nbsp;Michael Bäcker (aka BakermanLP)

Ein paar andere Shell Kommandos

bash

Shell Kommandos out of Space

Hier kommen nun ein paar Shell Befehle, die nicht ganz so geläufig, aber nichts desto trotz einfach nur Klasse sind.

unison

Bidirektionale Synchronization

Installation

sudo apt-get install unison

Konfiguration: ~/.unison/synchome.prf

root = /home/michael/
root = ssh://home.baecker.com//home/michael/

path = Entwicklung/IC2022/
path = Entwicklung/docker/
path = org/

auto = true
backup = Name *
maxbackups = 5

Ausführen:

unison synchome

Wenn die Datei unter ~/.unison default.prf heißt, dann muss man keinen Parameter beim letzten Befehlt verwenden

pass

Installation

sudo apt-get install pass

Dokumentation: https://www.passwordstore.org/

Directories:

  • ~/.password-store
  • ~/.gunpg/
pass init "ZX2C4 Password Storage Key"

pass git init
pass www.grafwerk-shop.de

# Copy to Clipboard
pass -c www.grafwerk-shop.de

# Passwort eintragen
pass insert Business/cheese-whiz-factory

# Passwort generieren und speichern
pass generate Email/jasondonenfeld.com 15

pass rm Business/cheese-whiz-factory
pass rm Email/jasondonenfeld.com

Cargo als Alternative Installationsmethode

Dokumentation: https://github.com/rust-lang/cargo

sudo apt install cargo

cargo install viu

ln -s ~/.cargo/bin/viu ~/bin/viu

jc macht aus CLI Ausgaben JSON

https://github.com/kellyjonbrazil/jc

wget --output-document ~/Downloads/jc_1.19.0-1_amd64.deb https://github.com/kellyjonbrazil/jc/releases/download/v1.19.0/jc_1.19.0-1_amd64.deb
sudo dpkg -i ~/Downloads/jc_1.19.0-1_amd64.deb
jc
jc ifconfig
jc ifconfig green0
jc -p ifconfig green0

gron - grep für json

Installation

sudo apt-get install gron
curl https://ic-administration.web.dst.baintern.de/api/proxy/listjson
curl https://ic-administration.web.dst.baintern.de/api/proxy/listjson | gron

ripgrep

Recursiv grep in Rust

Installation

apt install ripgrep
time grep -r api ~/Entwicklung/IC2020/AdminWeb
...
real	0m0,181s
user	0m0,105s
sys	0m0,063s
time ripgrep api ~/Entwicklung/IC2020/AdminWeb
real	0m0,035s
user	0m0,009s
sys	0m0,034s

bat cat clone mit Color, git integration, show non-printable characters

a cat(1) clone with syntax highlighting and Git integration

Installation

apt install batcat
batcat ~/Entwicklung/IC2022/docker-webdevops-ubuntu/Dockerfile
batcat ~/bin/rofi-bookmarks
batcat -L

~/.bashrc

### MANPAGER
export MANPAGER="sh -c 'col -bx | batcat -l man -p'"
man cat

fuck (corrects errors in previous console commands)

Installation

sudo apt install thefuck

vim ~/.bashrc
eval $(thefuck --alias FUCK)
~ ❯ apt-get install vim
E: Sperrdatei /var/lib/dpkg/lock-frontend konnte nicht geöffnet werden. - open (13: Keine Berechtigung)
E: Erlangen der Sperre für die Dpkg-Oberfläche (/var/lib/dpkg/lock-frontend) nicht möglich; sind Sie root?
~ ❯ FUCK
sudo apt-get install vim [enter/↑/↓/ctrl+c]

starship

https://starship.rs/de-de/

Schriftart: https://www.nerdfonts.com/font-downloads https://www.programmingfonts.org/#source-code-pro

Installation

wget -O ~/Downloads/SourceCodePro.zip "https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/SourceCodePro.zip"

curl -sS https://starship.rs/install.sh | sh

rmlint

Finden und löschen von doppelten, leeren und so weiter Dateien

Installation

sudo apt install rmlint

rmlint ~/Downloads/

ncdu Disk usage analyzer with ncuses interface

Disk Usage mit dem Mehrwert

Installation

sudo apt install ncdu

ncdu

exa

LS Replacement

Installation

Download von https://github.com/ogham/exa/releases/

bash comletion Erweiterungen

Erweiterung durch einen neuen Ordner ~/.bash_completion.d/

mkdir ~/.bash_completion.d

vi ~/.bash_completion

Inhalt

for bcfile in ~/.bash_completion.d/* ; do
  [ -f "$bcfile" ] && . $bcfile
done

Alternative (untested):

mkdir -p ~/.local/share/bash-completion/completions

tldr

Man in kurz

Installation

sudo apt install tldr

tldr --update

tldr rsync

xsv "jq" für CSV Dateien

Installation

Download von https://github.com/BurntSushi/xsv/releases

Header Informationen

$ curl -LO https://burntsushi.net/stuff/worldcitiespop.csv
$ xsv headers worldcitiespop.csv
1   Country
2   City
3   AccentCity
4   Region
5   Population
6   Latitude
7   Longitude

Weitere Beispiele

xsv stats worldcitiespop.csv --everything | xsv table

xsv count worldcitiespop.csv

xsv slice worldcitiespop.csv -s 3173948 | xsv table

xsv select Country,AccentCity,Population worldcitiespop.csv \
  | xsv sample 10 \
  | xsv table

xsv search -s Population '[0-9]' worldcitiespop.csv \
  | xsv select Country,AccentCity,Population \
  | xsv sample 10 \
  | xsv table

Weitere Beispiele: https://github.com/BurntSushi/xsv

fx JSON Viewer

Installation Download von https://github.com/antonmedv/fx/releases

fx data.json

curl https://ic-administration.web.dst.baintern.de/api/proxy/listjson | fx

Ubuntu 20.04 Problem viu View Images on Terminal

Installation Download von https://github.com/atanunq/viu/releases

Homepage und Usage: https://github.com/atanunq/viu

Ubuntu 20.04 Problem viu View Images on Terminal

sudo apt install cargo

cargo install viu

falsisign (PDF to FAX Look generator)

alacritty

Installation

sudo add-apt-repository ppa:aslatter/ppa
sudo apt install alacritty
  • xterm
time cat ~/Downloads/access.log
...
real    0m0,739s
user    0m0,003s
sys     0m0,053s
  • alacritty
time cat ~/Downloads/access.log
...
real	0m0,126s
user	0m0,002s
sys	0m0,046s

rofi

Installation

apt install rofi

Beispiele:

rofi -show run
rofi -show ssh
rofi -show window
rofi -show combi

Rofi mit Skript befüllen

~/bin/icneu
~/bin/rofi-bookmarks
~/bin/rofi-configs
~/bin/rofi-manpages
~/bin/rofi-pass
    www.tomtom.com

Repository von Azlux

echo "deb http://packages.azlux.fr/debian/ buster main" | sudo tee /etc/apt/sources.list.d/azlux.list
wget -qO - https://azlux.fr/repo.gpg.key | sudo apt-key add -
sudo apt update
sudo apt install gping

Inhalt des Repository: http://packages.azlux.fr/