Often when configuring and adjusting unix-based systems I use a lot of one-line commands that are difficult to remember. For example, to determine what version of ntp (the time server) is running, you issue the command:
ntpq -c "rv 0 version"
This is the kind of stuff I am never going to remember. Is there some way or method to store all these one-liners so I can look them easily when I need to and paste them to the command line (I use vim btw, not emacs, so an emacs-centered solution will not really help me). I was thinking there might be a way to execute the current line of text from the buffer in the shell, but could not find any such command.
One idea I have had is to put the commands in a text file then in vimrc make this line:
nnoremap <F10> :.w !bash<CR>
Now, lets say I have this line in my file:
ntpq -c "rv 0 version" # show current version of NTP which is running
Then, I put the cursor on this line and press F10 and it works (note that since the command is being sent to bash, you use bash comments (#), not vim comments). This seems like a step in the right direction. Any better ideas?