shakedown.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
A community for live music fans with roots in the jam scene. Shakedown Social is run by a team of volunteers (led by @clifff and @sethadam1) and funded by donations.

Administered by:

Server stats:

269
active users

#bash

7 posts7 participants0 posts today

Un trucchetto utile nella #shell #bash , per chi usa Linux. Magari lo conoscete già, ma potrebbe tornar comodo a chi non lo conoscesse.

Poniamo abbiate il cursore a metà di una riga di testo nella shell.

Ctrl + A - sposta il cursore a inizio riga
Ctrl + E - Sposta il cursore a fine riga

Ctrl + U - Cancella indietro dal cursore a inizio riga

Ctrl + K - Cancella in avanti dal cursore a fine riga

Le maiuscole sono una convenzione, van bene le minuscole ( thanks @oblomov
#linux #shell )

Hi everyone! I recently released 3 blog posts!
All of them are writeups on CTFs where I make some scripts and tools in bash and golang!

I'll leave you the link of the blog posts and if you have any suggestions or interact with me, don't hesitate to comment or DM me!

I hope you all can enjoy reading them!

blog.jackrendor.dev/posts/tryh

blog.jackrendor.dev/posts/tryh

blog.jackrendor.dev/posts/tryh

Jack Rendor's blog - Penetration Tester and Security Researcher · Tryhackme Security FootageWriteup on Security Footage, a room from TryHackMe where I explore the possible ways to extract files from a pcap file.

In the helpful shell functions department:

(Requires bc to be installed)

load() {
    local load=$(uptime |sed -E "s/^.*load averages?: //; s/,.*$//")
    local uname="$(uname)"
    local cpus
    if [[ $1 == -q ]]; then
        echo "$load"
    elif [[ $1 == -i ]]; then
        echo "$load + 0.5" |bc -l |cut -f1 -d.
    else
        case "$uname" in
            Linux)  cpus=$(grep -c ^processor /proc/cpuinfo);;
            *BSD)   cpus=$(sysctl hw.ncpu |tr -dc "0-9\n");;
            *)      warn "load(): assuming 1 cpu, don't know how to get the number in \"$uname\""
                    cpus=1;;
        esac
        local loadPerCPU=$(echo "scale=3; $load / $cpus" |bc -l |sed 's/^\./0./')
        echo "$load ($loadPerCPU per processor ($cpus))"
    fi
}

#Poll: Curious about people's attitudes towards shell scripting.

Two part question:

  1. Are you a DEVeloper (or working in a development-heavy role), OTHER-IT worker (such as a sysadmin, architect, anything in a non-development-heavy role), or NON-IT (accountant, doctor, whatever)
  2. Do you HATE shell scripting, are you INDIFferent towards (or ignorant of) shell scripting, or do you LOVE it?

Seit 25 Jahren arbeite ich mit Linux und ja – Windows ist nicht das OS, das ich freiwillig nutzen möchte. Aber dieses ewige OS-Bashing erinnert eher an einen Streit auf dem Pausenhof als an einen erwachsenen Diskurs. Wer Spaß an seinem System hat, soll es nutzen. Linux ist solide, manchmal sogar elegant – aber kein Heilsversprechen. Und das muss es auch nicht sein.

Die Welt dreht sich weiter – ob mit #Bash oder #PowerShell spielt längst nicht mehr die Hauptrolle.

How would you solve the following use case when #bash #scripting ?

Given a text file and need to insert a line somewhere specific.
Extra challenging: Assume some lines are identical.

This might be worth sharing with @b0rk 's audience.

I'll share a solution I just used at work in the first comment; worth adding to ones #cheatsheet!

Help me fedi!

In bash or fish shell, is there some way to automatically get somekind of periodic fetching like vscode has but in my terminal instead.

Edit: i already have shell prompt that shows the status, i just need something that updates the said status.

Halp!!

#git#linux#terminal
Replied in thread

@katyswain I din't think that #CCSS is good either, but the demands of #GPLv3 are not compatible with the (adnitteldy shitty) reality of how #IP, #Licensing and #Patents work and thus it kneecaps a lot of things.

I chose #0BSD for _OS/1337 because as with any "intellectual labour", one cannot force others to collaborate and I'd rather have people join in out of the goodness of their hearts instead of just dumping some random git commit that is useless.

ok, did you know you can just type `alias` or `export` to get a list of the things you've aliased or exported? I've written a shell script at least once a year since 2007 but just learning this.

Linux - Trucchetto shell

Poniamo che voglia leggere il contenuto di un directory il cui path è molto lungo:

$ ls /directory/dal/percorso/lungo/e/tortuoso

Se dopo aver visto il contenuto volessi andare in quella directory con cd dovrei riscrivere tutto quel percorso ?
No , l'argomento del comando precedente è rappresentabile con "$_"

Quindi basterà scrivere:

cd $_

Handy #bash #alias to get your phone's battery status from the #CommandLine if you're using #KDEConnect and it's available:

alias kcbatt='qdbus6 org.kde.kdeconnect /modules/kdeconnect/devices/$(grep -Em1 "^\[[0-9a-f_]+\]" ~/.config/kdeconnect/trusted_devices |tr -dc 0-9a-f_)/battery org.kde.kdeconnect.device.battery.charge'

(Will take the device id for the first device in your trusted_devices file. If you have more than one phone registered to #KDE Connect, then you need to add some more logic (and likely make it into a bash function or script))

[Apologies to Ernest Thayer]

en.wikipedia.orgCasey at the Bat - Wikipedia