You are in your browser, furiously typing away your latest shell script (to send it to someone else, or to post in forums or at Slashdot). Suddenly, your memory trips you up, and you find yourself wondering "does the 'cut' command use a space or a tab as the default delimiter?". With Google at your service, there is no need to move away from your browser. If you are on firefox, just type 'man cut' in the addressbar; otherwise, google for 'man cut' and use the first result.
Google doubles up as a 'linux command helper' like this whenever we use search queries of the form 'man command'. Add one word to the query anywhere, and we get our good old Google search.
I had been using this method for quite a while. But I was not sure whether it was an intentional feature or it's just that the man pages tend to be the first results. But today, when I tried 'man cut', I landed on the man page. It is hard to imagine that a man page could overshadow common meanings of the words (man and cut). So, it does seem that google treats 'man command' searches specially...
It seems that this is not an officially announced feature - a google search for details about it returned no relevant results. Anyway, it does work. Our beloved man pages are now only a 'new tab' away!
A weblog of algorithms, analyses, adventures and anecdotes from a lover of Math and Programming.
(If your device has problems displaying this blog properly, try using http://goo.gl/MUyY)
Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts
Thursday, 19 July 2007
Friday, 6 July 2007
Linux is for everybody - just approach it the right way!
Linux is for everybody.
Yes, I just said that.
A few months ago, I would have vehemently opposed such a statement. That was when I was trying to learn the Linux GUI - because that's what many recommended on forums; a lot of posts said Linux with a GUI is very much like Windows.
It isn't.
Then, I did the Right Thing - I got hold of a Unix book (not a Linux book - because a lot of them try to 'simplify' the task at hand and suggest things that won't work in many situations).
If there's one good thing about the Unix books, it's that they don't try to teach you GUI. We all (well, at least most of us) come from Windows or Mac and are very much used to the GUI. So, when we learn Linux, we try to use the GUI the same way we've used it for so many years.
The problem is, it doesn't work that way. Linux does have a GUI, and it has improved a lot. However, unless you learn the command line, life's going to be pretty difficult for you...
Command line? That strange black entity with no fancy icons or anything?
Yep... But it isn't as unfriendly as you think. In fact, you'll get accustomed to using it in some 15 minutes. And you'll start loving it in a few days.
But... but.. doesn't that mean I have to learn some commands? (Gulp...)
Yes and no. You do have to learn a few basic commands, but they are really quite a few, and aren't all that difficult to learn. The other commands you can always look them up. We'll come to that shortly.
Before that, let's see a few things that are essential in making the command line easy:
* Tab completion: Type half of a filename, type a tab, and Linux completes the name for you. Type a few letters of the latest command you learnt, type a tab, and you get the command completed for you. This might not seem all that important, but this is what transforms a laborious job of typing out everything into a quick and easy way of doing things.
* Command history: Anytime you want to repeat a command, or do a slightly modified version of it, press the up arrow a few times. You can go through a long history of the commands you typed. This is the next important feature in using a CLI (Command Line Interface).
* apropos: This is a nifty little program that searches the help pages for a word you specify. Not sure what program to use to view pdf files? Do an 'apropos pdf', and you get a list of all programs whose descriptions contain the word pdf. This is the 'look it up' utility I talked about earlier...
With these three features at hand, you can master the world of Command Line in a few days. Want to shrink that to a few hours? Just keep watching here - we'll look at a few very important, easy-to-use commands that will make you a confident user of the command line, and will get you some awed looks from among your geek friends... :)
Yes, I just said that.
A few months ago, I would have vehemently opposed such a statement. That was when I was trying to learn the Linux GUI - because that's what many recommended on forums; a lot of posts said Linux with a GUI is very much like Windows.
It isn't.
Then, I did the Right Thing - I got hold of a Unix book (not a Linux book - because a lot of them try to 'simplify' the task at hand and suggest things that won't work in many situations).
If there's one good thing about the Unix books, it's that they don't try to teach you GUI. We all (well, at least most of us) come from Windows or Mac and are very much used to the GUI. So, when we learn Linux, we try to use the GUI the same way we've used it for so many years.
The problem is, it doesn't work that way. Linux does have a GUI, and it has improved a lot. However, unless you learn the command line, life's going to be pretty difficult for you...
Command line? That strange black entity with no fancy icons or anything?
Yep... But it isn't as unfriendly as you think. In fact, you'll get accustomed to using it in some 15 minutes. And you'll start loving it in a few days.
But... but.. doesn't that mean I have to learn some commands? (Gulp...)
Yes and no. You do have to learn a few basic commands, but they are really quite a few, and aren't all that difficult to learn. The other commands you can always look them up. We'll come to that shortly.
Before that, let's see a few things that are essential in making the command line easy:
* Tab completion: Type half of a filename, type a tab, and Linux completes the name for you. Type a few letters of the latest command you learnt, type a tab, and you get the command completed for you. This might not seem all that important, but this is what transforms a laborious job of typing out everything into a quick and easy way of doing things.
* Command history: Anytime you want to repeat a command, or do a slightly modified version of it, press the up arrow a few times. You can go through a long history of the commands you typed. This is the next important feature in using a CLI (Command Line Interface).
* apropos: This is a nifty little program that searches the help pages for a word you specify. Not sure what program to use to view pdf files? Do an 'apropos pdf', and you get a list of all programs whose descriptions contain the word pdf. This is the 'look it up' utility I talked about earlier...
With these three features at hand, you can master the world of Command Line in a few days. Want to shrink that to a few hours? Just keep watching here - we'll look at a few very important, easy-to-use commands that will make you a confident user of the command line, and will get you some awed looks from among your geek friends... :)
Subscribe to:
Posts (Atom)