Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Cyborg)
  • No Skin
Collapse
Brand Logo

CIRCLE WITH A DOT

  1. Home
  2. Uncategorized
  3. New post: shell tricks that aren't exactly secret, but aren't always taught either.

New post: shell tricks that aren't exactly secret, but aren't always taught either.

Scheduled Pinned Locked Moved Uncategorized
unixbashshellsysadminfreebsd
5 Posts 4 Posters 0 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • larvitz@burningboard.netL This user is from outside of this forum
    larvitz@burningboard.netL This user is from outside of this forum
    larvitz@burningboard.net
    wrote last edited by
    #1

    New post: shell tricks that aren't exactly secret, but aren't always taught either.

    Split into two sections: what works on any POSIX sh (FreeBSD, OpenBSD, Alpine...) and what's Bash/Zsh-specific. Because not everyone is on Linux with bash as their login shell.

    Things like CTRL+W, $_, pushd/popd, fc, set -euo pipefail caveats, and more.

    Link Preview Image
    Shell Tricks That Actually Make Life Easier (And Save Your Sanity)

    Watch someone backspace 40 characters instead of pressing CTRL+W, and you’ll understand why this list exists. A collection of shell tricks-grouped by what wo...

    favicon

    Larvitz Blog (blog.hofstede.it)

    #unix #bash #shell #sysadmin #freebsd #linux #cli

    H lutzhuehnken@mastodon.socialL joel@gts.tumfatig.netJ 3 Replies Last reply
    0
    • larvitz@burningboard.netL larvitz@burningboard.net

      New post: shell tricks that aren't exactly secret, but aren't always taught either.

      Split into two sections: what works on any POSIX sh (FreeBSD, OpenBSD, Alpine...) and what's Bash/Zsh-specific. Because not everyone is on Linux with bash as their login shell.

      Things like CTRL+W, $_, pushd/popd, fc, set -euo pipefail caveats, and more.

      Link Preview Image
      Shell Tricks That Actually Make Life Easier (And Save Your Sanity)

      Watch someone backspace 40 characters instead of pressing CTRL+W, and you’ll understand why this list exists. A collection of shell tricks-grouped by what wo...

      favicon

      Larvitz Blog (blog.hofstede.it)

      #unix #bash #shell #sysadmin #freebsd #linux #cli

      H This user is from outside of this forum
      H This user is from outside of this forum
      havarpan@mastodon.bsd.cafe
      wrote last edited by
      #2

      @Larvitz I recently learned a funny trick from Kirils Solovjovs in a bash workshop. He had in his path a script called `\#` that he used to comment out pipe elements like `mycmd1 | \# mycmd2 | mycmd3`. This was how the script was written:

      ```
      #!/bin/sh
      cat
      ```

      1 Reply Last reply
      0
      • larvitz@burningboard.netL larvitz@burningboard.net

        New post: shell tricks that aren't exactly secret, but aren't always taught either.

        Split into two sections: what works on any POSIX sh (FreeBSD, OpenBSD, Alpine...) and what's Bash/Zsh-specific. Because not everyone is on Linux with bash as their login shell.

        Things like CTRL+W, $_, pushd/popd, fc, set -euo pipefail caveats, and more.

        Link Preview Image
        Shell Tricks That Actually Make Life Easier (And Save Your Sanity)

        Watch someone backspace 40 characters instead of pressing CTRL+W, and you’ll understand why this list exists. A collection of shell tricks-grouped by what wo...

        favicon

        Larvitz Blog (blog.hofstede.it)

        #unix #bash #shell #sysadmin #freebsd #linux #cli

        lutzhuehnken@mastodon.socialL This user is from outside of this forum
        lutzhuehnken@mastodon.socialL This user is from outside of this forum
        lutzhuehnken@mastodon.social
        wrote last edited by
        #3

        @Larvitz I often use "Meta+." (in your config: ALT+. I guess) to get the last argument of the last executed command.

        1 Reply Last reply
        0
        • larvitz@burningboard.netL larvitz@burningboard.net

          New post: shell tricks that aren't exactly secret, but aren't always taught either.

          Split into two sections: what works on any POSIX sh (FreeBSD, OpenBSD, Alpine...) and what's Bash/Zsh-specific. Because not everyone is on Linux with bash as their login shell.

          Things like CTRL+W, $_, pushd/popd, fc, set -euo pipefail caveats, and more.

          Link Preview Image
          Shell Tricks That Actually Make Life Easier (And Save Your Sanity)

          Watch someone backspace 40 characters instead of pressing CTRL+W, and you’ll understand why this list exists. A collection of shell tricks-grouped by what wo...

          favicon

          Larvitz Blog (blog.hofstede.it)

          #unix #bash #shell #sysadmin #freebsd #linux #cli

          joel@gts.tumfatig.netJ This user is from outside of this forum
          joel@gts.tumfatig.netJ This user is from outside of this forum
          joel@gts.tumfatig.net
          wrote last edited by
          #4

          @Larvitz side note, I don’t think OpenBSD has POSIX sh. Quoting the man page

          This version of sh is actually ksh in disguise. As such, it also supports the features described in ksh(1). This manual page describes only the parts relevant to a POSIX compliant sh.

          Just saying as I got caught thinking my scripts were POSIX compliant on OpenBSD and failed when running them using FreeBSD sh 🤦‍♂️

          larvitz@burningboard.netL 1 Reply Last reply
          0
          • joel@gts.tumfatig.netJ joel@gts.tumfatig.net

            @Larvitz side note, I don’t think OpenBSD has POSIX sh. Quoting the man page

            This version of sh is actually ksh in disguise. As such, it also supports the features described in ksh(1). This manual page describes only the parts relevant to a POSIX compliant sh.

            Just saying as I got caught thinking my scripts were POSIX compliant on OpenBSD and failed when running them using FreeBSD sh 🤦‍♂️

            larvitz@burningboard.netL This user is from outside of this forum
            larvitz@burningboard.netL This user is from outside of this forum
            larvitz@burningboard.net
            wrote last edited by
            #5

            @joel thanks for the hint. I actually wasn’t aware of that! Always thought it’s defaulting to a korn shell.

            1 Reply Last reply
            1
            0
            • R relay@relay.mycrowd.ca shared this topic
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups