Mandriva

The shell's history

The shell remembers the history of your last typed commands. It is what you see when you use the up and down keys in Bash.

There are plenty of ways to use this history! I will write some tips here that I know but don't hesitate to add more in comments.

  • the ! tip: starting a line by ! followed by the first few letters of a previous command recalls it, very useful !
  • ! followed by a number recalls this command.
  • the !? tip: is somewhat similar but doesn't only look at command starting with the following letters but containing them !
  • '#' comments the commands but still records it. (if you have something to check while typing a long command)
  • of course the history command shows you the last commands ;)
  • [ctrl-r] put you in history mode
  • if you don't like this feature, you can filter it with HISTIGNORE
example :
export HISTIGNORE="&:ls:\[bf\]g:exit"
suppresses duplicate commands, the simple invocation of 'ls' without any arguments, and the shell built-ins bg, fg, and exit:

And if you include the expression "[ t]*" in the HISTIGNORE string, you can suppress history recording at will for any given command just by starting with a space!


Comments (1)

biento | 18.11.2007 at 08:53 AM
bien vu cette utilitaire en ligne. il est placé dans mon marque-pages.

 


fr sv ca es cs en nl

RSS

Creator: WebHome on 2005/09/08 00:31
(c) Mandriva 2007
18888888