• mine craft! mc.floofey.dog:25565

Bash Scripts and Oneliners

Currently reading:
Bash Scripts and Oneliners

b4rkod

New member
comfy friend
Joined
Apr 21, 2024
Messages
4
Reaction score
3
comfy coins
šŸ’ 6,463
Hi furries, i found the forum just today and saw that there was no bash scripts thread soo i made one.
pwdp
First one is a oneliner that prints the currently focused window's pwd. I use it to open new terminals/file managers that are in the same path as the one i am in.
pwdx $(ps --ppid $(xdotool getwindowfocus getwindowpid) -o pid=) | cut -d ":" -f2

img_uploader
The second is slightly more error prone, if you have a webserver already running, you can modify this slightly to upload images to it fast.
What it does is, it opens a terminal(only tested in st) with ranger file managers choosefile option, writes them to a file and uploads them to your server throught scp, it uses herbe to show you information and directs the links it creates to your clipboard
dependencies are ST, herbe(optional), xclip, openssh and a webserver running in a vps, openssh configured to be used with pgpkeys.
#!/bin/sh SERVER="example.net" TEMPFILE="/tmp/will_be_sent" SERVERFILE="/path/to/webserver/root" CACHEFILE="$HOME/.cache/uploaded_files.txt" TERM="st" if ! ping -c 1 $SERVER > /dev/null 2>&1 ; then herbe "No internet Connection :(" exit; fi $TERM -e ranger --choosefiles=$TEMPFILE #exit if no file is choosen FILES=$(cat $TEMPFILE) || exit while read -r F do FLINK=https://$SERVER/files/$(basename "$F") if ! grep "$FLINK" $CACHEFILE ; then scp -C "$F" root@$SERVER:$SERVERFILE/files && echo "$F" echo "$FLINK" >> "$CACHEFILE" fi echo "$FLINK" |xclip -selection "clipboard" herbe "$FLINK uploaded" done < "$TEMPFILE" rm "$TEMPFILE"

Alongside the script above, i use this to check the links i created before
tac $HOME/.cache/uploaded_files.txt | dmenu | xclip -selection "clipboard"

yt-dlp alias
I put this as a alias to install music videos as mp3's from youtube
yt-dlp -xciw -f "bestaudio/best" --audio-quality 0 --audio-format mp3 --embed-thumbnail --embed-metadata -o "%(title)s.%(ext)s"
 
/pub/ ~ public channel
Help Users
  • bananalizard @ bananalizard:
    im makin music :)
    Quote Link
  • fridge @ fridge:
    good day to all ;)
    Quote Link
  • FaustineSpirit @ FaustineSpirit:
    @rivChorus@ I also missed archive.org šŸ˜…
    • Like
    Reactions: rivChorus
    Quote Link
  • rivChorus @ rivChorus:
    do you also feel now that in one day something can go out forever?
    Quote Link
  • Adel @ Adel:
    archive.org is too good to us
    Quote Link
  • rivChorus @ rivChorus:
    yeah
    Quote Link
  • B Chat Bot:
    Guest btr has joined the room.
  • B (Guest) btr:
    hi chat
    Quote Link
  • rivChorus @ rivChorus:
    hello
    Quote Link
  • hijodeputa @ hijodeputa:
    i love this site i stole all the blinkies in this iste and put them in my spacehey
    Quote Link
  • Quote Link
  • hijodeputa Chat Bot:
    hijodeputa has joined the room.
  • FaustineSpirit @ FaustineSpirit:
    rivChorus said:
    do you also feel now that in one day something can go out forever?
    It's a nasty feeling šŸ˜…
    Quote Link
  • FaustineSpirit @ FaustineSpirit:
    Adel said:
    archive.org is too good to us
    Quote Link
  • FaustineSpirit @ FaustineSpirit:
    I agree completely, this is a real mint of treasures šŸ˜†
    Quote Link
  • towmotor @ towmotor:
    I have started archiving websites I frequently visit that I think are on the verge of disappearing... didn't think it would happen this fast, but here we are
    • Love
    Reactions: faen and snekmuffin
    Quote Link
  • faen @ faen:
    bless you towmotor
    Quote Link
  • S Chat Bot:
    Guest styllgoth has joined the room.
  • S (Guest) styllgoth:
    yo, i just stumbled upon this forum with a friend and im very happy
    Quote Link
  • S (Guest) styllgoth:
    thanks for keeping the internet alive
    Quote Link
  • Quote Link
  • AntonNavir @ AntonNavir:
    what is love šŸŽ¶
    Quote Link
  • rivChorus @ rivChorus:
    baby dont hurt me
    Quote Link
  • F Chat Bot:
    Guest FUCK TRANNIES has joined the room.
  • F (Guest) FUCK TRANNIES:
    FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES
    Quote Link
      F (Guest) FUCK TRANNIES: FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK TRANNIES FUCK...
      Back
      Top