- cross-posted to:
- programmerhumor@lemmy.ml
- cross-posted to:
- programmerhumor@lemmy.ml
I write part of the command then ctrl+r. Using FZF mind you. Such a great utility.
Featherpad, copy, paste. Extra work, but you get a work log
I wish this wasn’t so painfully true.
I’ve probably done that for
lszsh tab completion also looks through history wich is pretty nice.
I knew there was an
lsIn there somewhere
ls … enter ↑ enter ↑ enter
You may consider using
watch lsI do like that, thanks a lot ulterno!
I can’t even keep apart ls and cd it seems.
Now I don’t have to type that in again. Phew!
deleted by creator
Relevant xkcd: https://xkcd.com/1168/
tar --helptar - h
Unfortunately that’s not valid.
$ tar -h tar: You must specify one of the '-Acdtrux', '--delete' or '--test-label' options Try 'tar --help' or 'tar --usage' for more information.From man-page:
-h, --dereference follow symlinks; archive and dump the files they point toDamn.
Thanks, we all died.
:)
tar -xvf <archive-name>
but only because I had to look it up twice so now my brain has committed it to memory
I don’t even know what it doesi just use unar (unarchive) nowadays, since that works with all file formats iirc
Extract a tarball with verbose output from the specified file.
And learn how to use the ‘z’ option
You don’t even need the hyphen!
Mind = blown.
tar -jcvf archive.tbz ~/stuff/*
Of course I don’t know the bomb had bzip2 on it… I wonder if we can start with ls to see if there’s anything to tar or untar
history | grep 'gre[p]' | less -SDoes fuck all when you can’t remember even a piece of the command lol
Then how well you know which command it is when scrolling. At that point it’s googleing how do I move a file or whatever your looking for.
That’s when you start spamming Page Up/Down, Home, End, and
/to search withinless. Usually seeing various commands jogs my memory, especially when they aregrepcommands searching for one I use often enough to be useful but infrequently enough to not remember off the top of my head.
This is the answer
Too many people still use Bash.
Too many distributions still ship with Bash.
In the real world, the only thing better than perfect is standardized.
Yeah, true. But, it’s easy to change.
Bash is the Internet Explorer of shells. It’s great for installing a more useful shell.
What shell do you recommend?
I like zsh, but some people say great things about fish.
My problem with those is bash is always there and just works.
Yes, just like Internet Explorer.
It’s good to know how to do things in bash, since you’re going to encounter it pretty often. But, that doesn’t mean you shouldn’t customize your shell on the machine(s) you use most often. Why stick with the default when there are better options? You’re just hobbling yourself.
That’s super unkind and incorrect. IE was a trash software that was widely available because MS was trying to extend their monopoly into new areas.
Even if it’s not your taste, bash is a mature, stable FLOSS package with wide community support. The reason it is so common is due to it’s positive attributes, not because there is a plot to make it the only choice available to you.
Bash might be better than IE. But I think we can agree that it is no longer a good shell.
Its syntax is awful, and lacks many features that other shells have.
It is only so widely used because it is a de facto standard. If bash was created today, barely no one would us it.
That’s not true. Internet Explorer was fucking useless for scripting together things, unlike bash.
Internet Explorer shell expansion always trips me up.
I like zsh on mac because pretty colors
O(n) access, very efficient.
No, I do not care to share the value of n
In
fish, you can enter part of the command, and then press up to search for it. It’s kinda awesome.That’s what I do in bash except for pressing up it’s ctrl+r. FZF does the fuzzy finding for me. It’s so convenient.
yeah I ONLY just recently switched to fish after using zsh and oh my zsh for so long - pretty much since first starting linux cause I once saw someone using it on unixporn and I thought “that’s cool”
when I switched to NixOS zsh with all the plugins was a total slog. switched to fish and it just HAS everything that zsh/oh my zsh and the various plugins had but baked in.
so yeah in Fish it’s just starting to type something and hoping it’s still in the history.
The number of people who don’t reverse-I-search is too damn high
CTRL+R for those unitiated
It was quite a while before I realised that was possible.
Then not long after starting to use it, that I got fed up and just started opening up the history file and searching in it.why not
history | grep -iand the search term?even if there are several, you can use ! and the command’s line number to run it again
historyis shell dependent.
reverse-i-search + fzf = <3
I accidentally found out one day that I could use a wildcard operator in the terminal instead of a full file or folder name due to always doing this.
cd Pho* or cd /documents/Pho*
Will for example open my “Photo Examples” folder in the working directory or based on the path
With ZSH there’s something called “path-completion” that makes that even easier.
Say you want to go to “/usr/local/share/fonts” but that’s too much to type out, you can instead type “cd /u/l/s/f” and hit tab. If every path element is unambiguous it will just expand it to “/usr/local/share/fonts”. In this case though, “/u/l/” can expand to “/usr/local” or “/usr/lib” so when you hit tab it moves the cursor to just after the “l” to indicate it needs you to distinguish between “/usr/local/” and “/usr/lib”. If you just type “o” and hit tab again, it will know that there’s only one match for “/usr/lo” and expand that to “/usr/local/” Then there’s only one match for “s” which is “share”, and only one match for “f” which is “fonts”.
That avoids the danger of executing a command with an asterisk wildcard.
works in fish shell as well.
deleted by creator
You can use
||between two commands as well. If the first command returns exit code != 0, the second command will run.I.e.
which ansible || pip install ansible.Or && for if you only want the second command to run if the first command succeeded.
This only works until you grow an addiction to making pho at home and start documenting your progress.
cd “Pho Recipes and Pictures”
cd /
sudo rm -rf *
Basically the Linux version of deleting system32 but idk I’m not a super Linux nerd yet.
The fun thing is that you can create a file named “-rf *” and hope an admin tried to delete it!
https://github.com/atuinsh/atuin is a great tool to manage and search your shell history. I especially enjoy it being able to search commands based on the working directory I was in when I ran them.
It also has more features (which I don’t use) to manage dotfiles and sync shell history across hosts/devices.
I was going to talk about it too ! Even though I’m on fish (which helps a lot with history search) atuin really changed my habits and made my life easier !

or documentation.To use ctrl-r I have to remember something about the command. To use up arrow I just have to know about how many commands ago I used it.
Not if you have fzf you don’t: https://github.com/junegunn/fzf
Like an interactive fuzzy finding history. It’s sick.
So how well you know which command it is of you won’t recognize it when you see it…


















