Skip to content

Instantly share code, notes, and snippets.

@psygo
Created September 16, 2020 18:12
Show Gist options
  • Save psygo/1cafa5a64debfeeaa74194905c598f2b to your computer and use it in GitHub Desktop.
Save psygo/1cafa5a64debfeeaa74194905c598f2b to your computer and use it in GitHub Desktop.
Linux Heroic Commands

Linux Heroic Commands

From a tutorial somewhere...

  1. sudo !! : re-executing the last command as sudo.
  2. Ctrl + X + E in the terminal to open an editor.
  3. Create a super fast RAM disk (hard drive on the RAM):
    mkdir -p /mnt/ram
    mount -t tmpfs /mnt/ram -o size=8192M
    Can get 5-200 times the HD speed.
  4. In order to not put a command in the history, you can add a leading space to the comand (e.g. ls -l).
  5. If you wish to fix a really long command, you can open an editor with the last command with fc.
  6. Quickly create folders with permutations:
    mkdir -p folder/{sub1,sub2}/{sub1,sub2,sub3} # or
    mkdir -p folder/{1..100}/{1..100} # creates 10,000 folders
    The -p is essential because it creates the parent folder if it doesn't exist when trying to create the child ones.
  7. Intercept stdout and log to file (tee):
    cat file | tee -a log | cat > /dev/null
  8. Exit a terminal but leave all processes running:
    disown -a && exit # -a is for all the processes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment