Hey, wanna know some cool stuff you can do in a Linux terminal?First, three keyboard tricks you probably already know.
- The up arrow is a “history” key. After you’ve entered some commands, you can retrieve them with the up arrow. Most terminals will store the last several hundred commands. You can, obviously, edit these (like if the first time you entered the command it did not work because you typed it wrong).
- The TAB is an auto completion key.
- Many terminals do NOT use ctrl-c for copy and ctrl-v for paste, for historical reasons. But if you go to Preferences –> Shortcuts or in some cases Key Bindings, you can easily change this.
Now for a much bigger, more powerful cool thing you can do.
- wget
- The command wget gets stuff. Type in wget and then any valid internet address, and whatever that address points to is immediately sucked into your home directory. No questions asked. There are many, many options you can run wget with but you don’t need them to get a single simple file (oh, it won’t over write a file with the same name on your computer … it will just add a dot-number to the end of the name of the newly downloaded file).Here’s an example. I’ve got a PDF file on the web at this location:gregladen.com/wordpress/wp-content/pdf/Laden_Wrangham_Roots.pdfOpen a terminal, type wget, a space, then copy and paste this filename on to the terminal line and hit enter. The PDF is 233K long. Now type “ls” to get a directory and you’ll see the file.If you do this with a standard web page you may get “index.html” or something like that. If you then open the index.html file in your web browser, you get to see what a web page looks like without a style sheet attached!
Nice post and a great headline. I think it’s true though. The command line is a lot of fun once you get to know it and after it saves your butt from a world of hurt. But it’s losing it’s dominance as the scare tactic of choice by Microsofties to “drivers”.
I use Ctrl-R often for going back in history. Type that combo, then begin typing the command you want to recall. Retype the combo to select other matches, then hit enter when you find the one you want.wget will also resume downloads with the -c switch, and download from a list of URLs in a text file with the -i filename.txt switch.
actually, at the command line, unless you specify otherwise, you get most of the features of a program called readline, and the emacs control key commands. though you can change it to use vi commands if you prefer… (a good way to start a religious war there…)type “man readline” at the prompt to find the rest of the key commands, (they’re a few pages in…)M- means the alt key. C-means the control keyC-d :delete forward characterM-d :delete forward wordC-k :delete to end of lineC-y :(yank) paste what C-k just deletedC-o :insert blank lineC-a :move cursor to beginning of lineC-e :move to the end of the lineC-p :same as up arrowM-< :go to first command in your command historyC-t :swap the letters before and after the cursorM-t :same, but with the whole wordsC-b :move one letter to the leftM-b :move one word to the leftC-f :move one letter to the rightM-f :move one word to the rightthere are lots more, these are some that I use every day... (one point to bear in mind, these control key sequences were developed when the control key was where the caps lock key is now. as a result of the moving to the lower spot that it now resides in, there is a suspicion that this may have some relation to an increase in the incidence of rsi... but there's a causation/correlation debate about that too.)
OK, I succumbed and got two XO laptops for my wife and daughter and may get another two for my son and myself. This will be the first time ever I will hold a machine with Linux on it and have no idea where to start. Is there a good place to start? A cool online tutorial? Or should I just bug you several times a day?