xfce notes plugin for often used commands. most commands i use on a daily basis are easy to remember though. like cd,mv,cp etc.
xfce notes plugin for often used commands. most commands i use on a daily basis are easy to remember though. like cd,mv,cp etc.
Whoever came up with the phrase "There is no such thing as a stupid question" obviously never had the internet.
To me, the best thing to remember is what is possible. If I know that something can be done with a command (usually because I learned a new one from somewhere), then I don't need to necessarily remember the exact syntax, unless it's very complicated. For example, I recently learned that you can do case-insensitive recursive searches with grep, and pass the output with a line number:
Code:grep -rin <query> <location>
Another good example is using bash history with a search and replace (for example if I mistyped something or need to make a small change to a long command:
I've been using that a ton for a project that I've been working on that has a lot of files that pass variables around. So, I can use that to help me remember where the calls are being made and in which line of which script.Code:!!:gs/<thing to be replaced>/<thing to replace it>/
Late on, if I forget that exact syntax, just that I know it's possible will make me do quick searches in the manpages or through Google to get the syntax correct.
For longer one-liners that approach script length, but not enough to put a whole script together, I usually keep a txt document with those and what they do for quick reference.
In short, I think just playing around a lot and trying things will lead you to find things that you didn't know you could do before. Then using this forum, the man pages, and Google to get the syntax exactly correct.
I find CLI Companion very useful "CLI Companion is a tool to store and run Terminal commands from a GUI. People unfamiliar with the Terminal will find CLI Companion a useful way to become acquainted with the Terminal and unlock its potential. Experienced users can use CLI Companion to store their extensive list of commands in a searchable list." Here: https://launchpad.net/clicompanion
cat ~/.bash_history | grep "fragment of command"
some things i make a script to run so i just type the script name to run some long command
eg:
never knew about ctrl+r before nowCode:echo -e '#!/bin/sh\ncat ~/.bash_history | grep "$1"' | sudo tee /usr/local/bin/brain-fart;sudo chmod +x /usr/local/bin/brain-fart
Last edited by pqwoerituytrueiwoq; November 5th, 2012 at 08:38 AM.
Laptop: ASUS A54C-NB91 (Storage: WD3200BEKT + MKNSSDCR60GB-DX); Desktop: Custom Build - Images included; rPi Server
Putting your Networked Printer's scanner software to shame PHP Scanner Server
I frequently edit my post when I have the last post
The "apropos" command can sometimes help. It will list all the possible man pages that apply to the object of apropos. For instance, "apropos copy" brings up not only cp and scp, but also rsync and ssh-copy-id. Each item has a brief description; you can see the full documentation with the man command.
Other than that, it's just a matter of experience. I've used the command line every day for years, so most commands are just second nature by now. If I want to do something that I cannot remember the command for, I either try apropos or do a Google search.
If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.
Blog · Linode System Administration Guides · Android Apps for Ubuntu Users
There are so many bash tricks I don't know. CTRL+R is a good one. Thanks!
I also like the case insensitive history search. I have just put this in my ~/.bashrc:
Code:hgrep() {history | grep -i $@ ;}
i didn't know that ...thanks man
Thanks all for the valuable tricks and some tips ...
A beer from me to all community cafe users
cheers..=D>
Bookmarks