News for hackers. Stuff that matters.
Re:A Terminal Case of Linux by bloopernova on Monday May 29, 2023 @05:30PM (#36118327)
After your cat command has run, type 'vim ' then hit the escape key plus the period/full stop key. That inserts the previous command's parameters/arguments at the cursor.

Obviously you don't have to use vim, any other editor or whatever can be used.

Re:A Terminal Case of Linux by quesera on Monday May 29, 2023 @05:46PM (#36118489)
> inserts the previous command's parameters/arguments at the cursor

In zsh, there are equivalent expansions:

  !!:1    previous command line, arg 1 (zero-indexed)
  !!:$    previous command line, LAST arg
  !!:1-$  previous command line, args 1-end (zero-indexed)
So, e.g.:

  cat /etc/passwd /etc/shadow /etc/group

  vi !!:1-$
(becomes)

  vi /etc/passwd /etc/shadow /etc/group
Re:A Terminal Case of Linux by bloopernova on Monday May 29, 2023 @06:10PM (#36118702)
Nice! I'll have to add those to my wall of index cards with useful commands.
Re:A Terminal Case of Linux by quesera on Monday May 29, 2023 @06:20PM (#36118776)
I use !!:$ occasionally.

If I wanted to do the cat/vim switcheroo you described, I'd more likely do:

  <UpArrow><Esc>vcwvi<Esc>:wq<Enter><Enter>
Which is a greater number of keypresses, but more flexible and requires less thought.

...as they say: Unix is user-friendly — it's just choosy about who its friends are.

Re:A Terminal Case of Linux by boring_twenties on Tuesday May 30, 2023 @03:32AM (#36122108)
Those all work in bash too, I believe they come from csh