#shelltricks — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #shelltricks, aggregated by home.social.
-
@cR0w I especially like how ^old_string^new_string^ can be abbreviated to just ^old_string when you want to delete the string instead of replacing it.
For example, when I've modified nftables rules, I run this to check the ruleset:
nft -c -f /etc/sysconfig/nftables.conf
and then to apply the changes, I can enter just this:
^-c
to run the same command again but without the -c option - i.e. this:
nft -f /etc/sysconfig/nftables.conf
-
@cR0w I especially like how ^old_string^new_string^ can be abbreviated to just ^old_string when you want to delete the string instead of replacing it.
For example, when I've modified nftables rules, I run this to check the ruleset:
nft -c -f /etc/sysconfig/nftables.conf
and then to apply the changes, I can enter just this:
^-c
to run the same command again but without the -c option - i.e. this:
nft -f /etc/sysconfig/nftables.conf
-
@pa @darthnull @bruce @bob_zim @cR0w Might be worth noting it should be ctrl-r
ctrl-R (capitalized) will go one entry "closer" to the current time, while ctrl-r will cycle back through all matching commands in reverse chronological order
Great if you realize a second too late "Oh shit, I needed that"
-
@pa @darthnull @bruce @bob_zim @cR0w Might be worth noting it should be ctrl-r
ctrl-R (capitalized) will go one entry "closer" to the current time, while ctrl-r will cycle back through all matching commands in reverse chronological order
Great if you realize a second too late "Oh shit, I needed that"
-
This subject needs a hastag. #ShellTricks
-
This subject needs a hastag. #ShellTricks
-
Shell Tricks That Make Life Easier (and Save Your Sanity)
https://blog.hofstede.it/shell-tricks-that-actually-make-life-easier-and-save-your-sanity/
#HackerNews #ShellTricks #LifeHacks #Productivity #TechTips #SanitySaver
-
Shell Tricks That Make Life Easier (and Save Your Sanity)
https://blog.hofstede.it/shell-tricks-that-actually-make-life-easier-and-save-your-sanity/
#HackerNews #ShellTricks #LifeHacks #Productivity #TechTips #SanitySaver
-
redteamers take note, if your c2 can't handle moving whole directories very well.
usually works like a champ in places where they don't look at the network stack much or at all, or employs folks who openly say networking doesnt matter
-
redteamers take note, if your c2 can't handle moving whole directories very well.
usually works like a champ in places where they don't look at the network stack much or at all, or employs folks who openly say networking doesnt matter
-
Want to read in a password from stdin during a demo without exposing it? This is what I used in my latest talk: `stty -echo && read PASSWORD && stty echo`. #ShellTricks
-
Want to read in a password from stdin during a demo without exposing it? This is what I used in my latest talk: `stty -echo && read PASSWORD && stty echo`. #ShellTricks
-
Capture STDOUT, STDERR and return status in shell variables
This second answer ( the one with the banana function ) shows how to capture all three to variables in bash without needing tmp files
https://stackoverflow.com/questions/13806626/capture-both-stdout-and-stderr-in-bash
----
banana() {
echo "banana to stdout"
echo >&2 "banana to stderr"
return 42
}
--------
. <({ berr=$({ bout=$(banana); bret=$?; } 2>&1; declare -p bout bret >&2); declare -p berr; } 2>&1)
----Then check values of $bout, $berr, $bret