Discussion
Loading...

Post

Log in
  • About
  • Code of conduct
  • Privacy
  • About Bonfire
nixCraft 🐧
nixCraft 🐧
@nixCraft@mastodon.social  ·  activity timestamp 6 months ago

Here's a small tip for Unix and Linux developers and IT pros: Want to run the same command again at the terminal? In most modern shells (tcsh, zsh, bash), you can simply type "!!".

For example, say you forget to use sudo:
yum upgrade -y
pkg upgrade -y

Instead of typing the whole command again, just do this:
sudo !!

This is a lifesaver for longer commands. Give it a try!

This screenshot shows how to execute the most recent command again in your terminal, most modern shells (tcsh, zsh, and bash) support typing !! to repeat it. For example:
sudo !!
This screenshot shows how to execute the most recent command again in your terminal, most modern shells (tcsh, zsh, and bash) support typing !! to repeat it. For example: sudo !!
This screenshot shows how to execute the most recent command again in your terminal, most modern shells (tcsh, zsh, and bash) support typing !! to repeat it. For example: sudo !!
  • Copy link
  • Flag this post
  • Block
John Small
John Small
@TinySmall_@mastodon.social replied  ·  activity timestamp 6 months ago

@nixCraft I use cursor up/down and Pic Up/dwn keys and then edit the line
#bash

  • Copy link
  • Flag this comment
  • Block
Federation Bot
Federation Bot
@Federation_Bot replied  ·  activity timestamp 6 months ago

@nixCraft A great tip. Thanks! 🙂

  • Copy link
  • Flag this comment
  • Block
Ɲєιƚ Ƃιɍƌ 凤
Ɲєιƚ Ƃιɍƌ 凤
@fnxweb@mastodon.social replied  ·  activity timestamp 6 months ago

@nixCraft akin to this, my most commonly used bash shortcut is <esc>_ which grabs the last argument of the previous command. Useful for such as:

vi newscript
chmod a+x <esc>_

  • Copy link
  • Flag this comment
  • Block
Wah+
Wah+
@WahPlus@mastodon.social replied  ·  activity timestamp 6 months ago

@nixCraft Wow! How have I been using Linux for so long and never knew this?!

  • Copy link
  • Flag this comment
  • Block
your auntifa liza 🇵🇷  🦛 🦦
your auntifa liza 🇵🇷 🦛 🦦
@blogdiva@mastodon.social replied  ·  activity timestamp 6 months ago

@nixCraft 🤯🤯🤯 TIL

  • Copy link
  • Flag this comment
  • Block
ooha
ooha
@oohaSTODON@mastodon.social replied  ·  activity timestamp 6 months ago

@nixCraft awesome, thanks!

  • Copy link
  • Flag this comment
  • Block

A small Bonfire corner on the internet

This is a small personal instance of Bonfire in the Fediverse.

A small Bonfire corner on the internet: About · Code of conduct · Privacy ·
Bonfire social · 1.0.1 no JS en
Automatic federation enabled
Log in
  • Explore
  • About
  • Code of Conduct