User Tools

Site Tools


docs:tips_n_tricks:bash.html

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
docs:tips_n_tricks:bash.html [09.03.2024 01:56 CET] – [Dont keep edits in history (as zsh does)] peterdocs:tips_n_tricks:bash.html [07.04.2024 15:23 CEST] (current) – [Undo edits in history] peter
Line 10: Line 10:
   * [[https://unix.stackexchange.com/a/131712|Unix Stackexcange - Is there any way to undo a bash history modification?]]   * [[https://unix.stackexchange.com/a/131712|Unix Stackexcange - Is there any way to undo a bash history modification?]]
  
-===== Undo edits in history ===== +===== History operations ===== 
-  +==== Save history without exiting bash ==== 
-"It's even more complicated. Bash seems to restore the originally executed commandif you go back to its modified version using up, erase that one completely (C-u)press enter, and then again go back in the history. Don't ask me why. – Uwe May 8, 2013 at 12:02"+  history -A 
 +==== Show history with full timestamps ==== 
 +  HISTTIMEFORMAT='%Y-%m-%d %H:%M:%S ' history 
 +==== Undo edits in history ==== 
 + 
 +|M-r (or ESC,r) |Restore last version
 +|//erase line and press ENTER//|:::
 +|C-x,C-u        |Undo last key| 
 +|C-_            |:::| 
 +|C-/            |:::|
  
 __References__: __References__:
 +  * [[https://stackoverflow.com/a/38961073|Prevent accidental history editing in bash]]
 +  * [[https://superuser.com/a/592958|How can I reset an edited history line in Bash?]]
   * A comment to [[https://superuser.com/a/592925|Superuser - How can I reset an edited history line in Bash?]]   * A comment to [[https://superuser.com/a/592925|Superuser - How can I reset an edited history line in Bash?]]
  
 +===== Bash Prompt =====
 +
 +*  http://ceving.blogspot.com/2015/10/limit-length-of-path-in-bash-prompt.html
docs/tips_n_tricks/bash.html.1709945800.txt.gz · Last modified: 09.03.2024 01:56 CET by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki