Useful for checking if there are differences between last and penultimate command.
* Add comment with # in your command * Later you can search that command on that comment with CTRL+R In the title command, you could search it later by invoking the command search tool by first typing CTRL+R and then typing "revert" Show Sample Output
Uses history to get the last n+1 commands (since this command will appear as the most recent), then strips out the line number and this command using sed, and appends the commands to a file.
This alias is meant to append n (here is n=10) most recently used cd commands to the bottom of history file. This way you can easily change to one of previous visited directories simply by hitting 1-10 times arrow up key. Hint: You can make more aliases implying the same rule for any set of frequently used long and complex commands like: mkisof, rdesktop, gpg...
Put a space in front of your command on the command line and it will not be logged as part of your command line history. Show Sample Output
This command disable sending of start/stop characters.
It's useful when you want to use incremental reverse history search forward shortcut (Ctrl+s).
To enable again, type:
stty -ixoff
Only from a remote machine: Only access to the server will be logged, but not the command. The same way, you can run any command without loggin it to history. ssh user@localhost will be registered in the history as well, and it's not usable.
Top 30 History Command line with histogram display Show Sample Output
worse alternative to ctrl+r: grep the history removing duplicates without sorting (case insensitive search). Show Sample Output
If you use HISTTIMEFORMAT environment e.g. timestamping typed commands, $(echo "1 2 $HISTTIMEFORMAT" | wc -w) gives the number of columns that containing non-command parts per lines. It should universify this command. Show Sample Output
I rarely need this, but I have a hard time remembering the command when I need it. Admit it. This has happened to you. Yes this is bad, and you better clean up now. Borrowed from http://thoughtsbyclayg.blogspot.com/2008/02/how-to-delete-last-command-from-bash.html Show Sample Output
This is similar to using `!!` or In bash 4.1 it seems you can bind directly to a shell command, but I'm not running that version. Show Sample Output
You can find a command's history event number via the `history` command.
You can also put the history event number in your prompt: \! for bash, or %h for zsh.
Finally, I would like to point out that by "number", I mean POSITIVE INTEGER. Not, say, a letter, such as 'm'. Examples:
!1
or
!975
Show Sample Output
Takes effect immediately.
!$ will be expanded to the last argument on the previous command. There are also positionnal parameters like !:1, !:2...
If you are installing some new package. You can first go through the step by step install and then take the commands that you ran from history to create shell script which can used to install the package on other machines say test or production.
Sometimes easier to just hit these keys to access previous / next commands in history instead of moving your hands all the way to the cursor keys
hide your ass, buddy.
this one works on user crontab
just an alternative to setting the size, this allows you to scroll up and see your previous commands in a given session but when you logout the history is not saved. That's the only advantage to doing it this way.. Show Sample Output
this also can find the old command you used before
alias h="history | awk '{\$1=\"\";print substr(\$0,2)}'" # h [ 07/07/2013 10:04:53 ] alias h="history | awk '{\$1=\"\";print substr(\$0,2)}'"
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for: