• MehBlah@lemmy.world
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 day ago

        Oh sure but when I hit tab I want it to complete my programs name or path. When I double tab I want options for either of those.

  • thevoidzero@lemmy.world
    link
    fedilink
    arrow-up
    13
    ·
    1 day ago

    Whenever someone says they don’t really like terminal because they don’t like to type or remember commands. This is what I think “they didn’t use auto complete”.

    Auto complete works for file names and paths by default, but the development can write it to only complete certain extensions. Like auto complete for image program only completes image files. Then you have completion for commands, subcommands and flags.

    Auto complete is done through calling a bash script with currently typed line, and the bash script can call other commands. So developer can write a really complicated auto complete and make it available as a binary if they want, and just use that in bash. Or you can use many tools that will generate auto complete script for you based on your commandline args.

    If you write your own scripts/cli binaries I recommend learning how to write auto complete for it. Makes it incredibly easy to use the tools.

    • alias_qr_rainmaker@lemmy.worldOP
      link
      fedilink
      arrow-up
      7
      arrow-down
      2
      ·
      1 day ago

      i was in the dark for so long because i thought tab autocompletions only worked with file paths. i can’t believe that whole time i didn’t even accidentally hit tab once on a command

      • thevoidzero@lemmy.world
        link
        fedilink
        arrow-up
        5
        ·
        1 day ago

        I guess it can go unnoticed, I use Arch so maybe that’s why I got more involved. I remember searching why auto completion didn’t work, then finding out I need to install bash-completions package. After knowing that it makes one curious about how it works. Then the next stage is writing it for my own programs because it obviously won’t come with bash-completions package.

        I once wrote a shell (terminal) to watch anime, and I wrote auto completion for different commands on it, it was really nice to just type play then prefix and then tab for auto completion on anime names, and even for episodes I wrote auto completion give me last episode I watched + 1.

  • Ŝan • 𐑖ƨɤ@piefed.zip
    link
    fedilink
    English
    arrow-up
    4
    arrow-down
    10
    ·
    2 days ago

    It really depends on þe shell, þe d distribution’s default configuration, and þe commands. Shells will often load a config from /etc/profile.d or someplace like þat; if þe distro doesn’t enable features like autocomplete or history, and you haven’t enabled it in $HOME, you won’t get it. Also, commands need to provide autocomplete hints for the shell; it’s not automatic.

    • alias_qr_rainmaker@lemmy.worldOP
      link
      fedilink
      arrow-up
      4
      arrow-down
      2
      ·
      1 day ago

      Ég þekki ekki efri stigin í spákonunni minni. Ég held mig bara við heimaskrána. Pabbi minn segir mér að efri stigin séu land hinna ódauðu.

    • alias_qr_rainmaker@lemmy.worldOP
      link
      fedilink
      arrow-up
      4
      arrow-down
      3
      ·
      2 days ago

      2018? i was 2017. that was the year i went to a coding bootcamp, so they had us all on macs. I know y’all despise mac users with a passion, but we learned how to use the bash terminal. I didn’t know cd was a bash exclusive thing until recently. Most of the time I use zsh, and I’d always type cd when actually you can just type the path of the directory and hit enter

      • fartsparkles@lemmy.world
        link
        fedilink
        arrow-up
        5
        ·
        2 days ago

        I’d rather a Mac than a Windows box. At least you get a proper shell (zsh or bash - zsh is the default now I think), python installed by default, can install package managers (macports, brew), can get coreutils, etc and most FOSS software from the Linux world runs since macs are UNIX at heart.

        I’m pretty sure cd isn’t even coreutils but implemented by shells as a wrapper for chdir/fchdir which is part of the kernel. Which has always bugged me since you can’t reliably pipe or redirect to cd since shells do things differently; it doesn’t handle stdin or the last component of a command runs in a subshell so doesn’t affect your current shell, blah blah.

        • alias_qr_rainmaker@lemmy.worldOP
          link
          fedilink
          arrow-up
          1
          arrow-down
          2
          ·
          1 day ago

          i fucking love wrappers, i wanna be the best wrapper alive. my schizo theory is that we’re in a simulation and the entire english language is just wrappers for insanely nested ruby function calls

      • trxxruraxvr@lemmy.world
        link
        fedilink
        arrow-up
        6
        ·
        edit-2
        2 days ago

        cd is not bash exclusive, it’s the standard POSIX way to change directories. Zsh is the outlier here, being more use friendly than most shells.

        • alias_qr_rainmaker@lemmy.worldOP
          link
          fedilink
          arrow-up
          4
          arrow-down
          2
          ·
          2 days ago

          i got used to bash back in 2017 when i went to a bootcamp. but i’m a mac user so i mostly do zsh. you’re not gonna believe how long i went until i discovered that you can cd into a directory just by typing the directory

          it was a week ago

    • trxxruraxvr@lemmy.world
      link
      fedilink
      arrow-up
      13
      ·
      2 days ago

      It depends on the shell you’re using, if it’s enabled and if you have completions for that particular command installed. For bash you might have to install a bash-completion package, depending on your Linux distro. Zsh is similar but had more powerful and user friendly completion options. Fish is even better and comes with completion for a lot of standard commands pre-installed.

  • stupidcasey@lemmy.world
    link
    fedilink
    arrow-up
    4
    arrow-down
    2
    ·
    1 day ago

    Y’all need to install Arch, you learn all the basics pretty much instantly… That or drown when you can’t install the boot loader.

  • FishFace@piefed.social
    link
    fedilink
    English
    arrow-up
    102
    ·
    2 days ago

    These auto-completions are dependent on having the corresponding completions information installed and enabled. Which it is with most modern distros, but more bare-bones setups won’t have it.

      • ulterno@programming.dev
        link
        fedilink
        English
        arrow-up
        12
        arrow-down
        1
        ·
        edit-2
        1 day ago

        In case of Arch, for bash, you have the bash-completions package, apart from which some program packages install their own bash completions.
        Then there is also zsh-completions for zsh.

        I remember having to install them separately, but maybe you know some package group that did it for you.

  • trxxruraxvr@lemmy.world
    link
    fedilink
    arrow-up
    48
    arrow-down
    1
    ·
    2 days ago

    Anyone who is learning new stuff in this thread should really try fish, it makes using the command line so much nicer.

  • cally [he/they]@pawb.social
    link
    fedilink
    arrow-up
    14
    ·
    1 day ago

    I usually use --help as it also gives descriptions for the command, though some programs may only accept -h or no argument to show the help menu.

  • pedz@lemmy.ca
    link
    fedilink
    arrow-up
    7
    ·
    1 day ago

    For a moment I thought that ‘commandName -’ was some PowerShell stuff.

      • pedz@lemmy.ca
        link
        fedilink
        arrow-up
        3
        ·
        1 day ago

        It can’t hurt to know this but to me PS is not intuitive, looks like SomeLongString-ActingLikeA-Command, and I avoid it as much as using Windows in the first place, unless absolutely necessary.

      • ReginaPhalange@lemmy.world
        link
        fedilink
        arrow-up
        6
        ·
        1 day ago

        A TLDR alternative to man pages
        While a man page is for every possible flag available for a command,
        A tldr is for the most common tasks a command can do.

        tldr fc
        
        fc
        
          Open the most recent command for editing and then run it.
          More information: https://www.gnu.org/software/bash/manual/bash.html#index-fc.
        
          - Open the last command in the default system editor and run it after editing:
            fc
        
          - Specify an editor to open with:
            fc -e 'emacs'
        
          - List recent commands from history:
            fc -l
        
          - List recent commands in reverse order:
            fc -l -r
        
          - Edit and run a command from history:
            fc number
        
          - Edit commands in a given interval and run them:
            fc '416' '420'
        
          - Display help:
            fc --help