Tell me more ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

As programmers, we all have a slew of complex shell/vim/emacs commands that we use over and over again. What's the most efficient way of storing and retrieving these one-liners, so as not to repeatedly re-invent the wheel?

I guess this question applies to recording a technique or way of accomplishing some task as well.

share|improve this question
1  
store them as macros (or bash scripts) – ratchet freak Dec 21 '11 at 16:08
@ratchetfreak: I didn't really mean the VERY SAME task such that the same exact code would work; I meant holding on to those one-liners more for the sake of remembering HOW you did it, i.e. the technique you used. Also, your suggestion is not optimal for working across several platforms and locations. But thanks, nonetheless. – Isaac Kleinman Dec 21 '11 at 16:26
Wiki? Google Doc? Just how many of them do you have? I find Google most useful at helping me with one-liners. – Job Dec 21 '11 at 17:03
2  
I use evernote for such stuff – SK-logic Dec 21 '11 at 17:04
1  
Yellow sticky notes FTW! – Mike Nakis Dec 21 '11 at 18:59

closed as not constructive by gnat, Walter, Martijn Pieters, Glenn Nelson, Mark Booth Jan 25 at 14:07

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or specific expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, see the FAQ for guidance.

4 Answers

up vote 4 down vote accepted

I used to use Snipplr for that, but Github Gist is even better and imho it's much less likely to go away.

share|improve this answer
3  
github:gist seems like just the right thing. – Isaac Kleinman Dec 21 '11 at 18:40

textfiles in dropbox

Combination of being kewl cloud service orientated yet works for an old vi unix commandline grey beard

share|improve this answer

You could store each into a separate file. Assuming that you want to locate then by functionality, you could use the functionality as part of the name.

Example (names are bad here but you can use your preferred names)

grep.currdir

grep.anydir

listfiles

listfiles-sortedbyname

listfiles.sortedbysize

listfiles.grep

copyfile.totest

copyfile.todev

copyfile.toprod

copydir.totest

copydir.toprod

compile.c

run.c

ofcourse, you can add many more depending on the nature of your work. You could then write a script that lists the above files or display their content based on the file name.

share|improve this answer

Use a service like snipplr. It has many features such as filtering and other people can benefit too.

share|improve this answer
I would worry about a service like that going away. – Mike Partridge Dec 21 '11 at 17:29
It hasn't for some years, but this is not a valid answer. It would be good to investigate how easy it is to get your data 'out'. There is a sniplr snipset for that: snipplr.com/view/3447 – dimitris mistriotis Dec 21 '11 at 17:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.