9 ms·
The Command Line Crash Course Controlling Your Computer From The Terminal
- 8ig8 15y agoI know the OP is not the author, Zed Shaw, but I simply wanted to say Thanks to Zed for this.
- zedshaw 15y agoYou're welcome.
- jimmyjim 15y ago> The next warning is stay off IRC or other places where "hackers" hang out. They think it's funny to hand you commands that can destroy your computer. The command rm -rf / is a classic that you must never type. Just avoid them. If you need help, make sure you get it from someone you trust not from random idiots on the internet. I don't really agree with that. I know for sure that popular channels in OFTC and Freenode are monitored by very smart and responsible people that would never let this happen. In my many years on IRC I have not seen a single novice guy looking for help actually get had by someone intentionally trying to mislead/screw over. I would instead encourage novices to read this: http://catb.org/~esr/faqs/smart-questions.html#usefora http://catb.org/~esr/faqs/smart-questions.html#usefora ('How To Ask Questions The Smart Way: Web and IRC forums directed towards newbies often give the quickest response')
- burgerbrain 15y agoI think the exact opposite advice would actually be more proper. Newbies probably don't often even know about IRC, but it can be a great way to get exposed to some really cool stuff.
- Mithrandir 15y agoI have seen on some IRCs people writing 'sudo rm -rf /*" etc. (not as advice, but as a joke,) but that person is always promptly kicked out and everyone in the channel tries to warn others. The author's view is definitely too pessimistic. Most people on IRCs like Freenode aren't evil 'hackers' out to 'hack' you (this reminds me of an episode of Numb3rs.) Other smaller IRC servers can get rowdy, but I've yet to see that on Freenode et al. I think much better advice would be to not randomly execute crap you see online without knowing what the program is and does, especially in root.
- nassosdim 15y agoA few days ago I decided to pick up a bash book from O'reilly and, truth be told, the guys in a room in Freenode knew how to help me in any question I made, no matter how silly I might felt for even asking (specifically I remember asking them about case insensitive shell expanding of wildcards which ended up being a locale issue in my installation). That doesn't mean that they're all saints, I just find it comforting that there are people out there who will gladly assist a complete stranger (in my case, me).
- dangrossman 15y agoMy first experience on IRC was looking for help with my first Linux install. Someone in the channel telnet'd into my computer and wiped my hard drive while I was chatting. I was 9 or 10 years old at the time and my root password was one of those common strings (12345, abcde, I don't remember at this point). It had taken me 3 days to learn how to download Linux, make a stack of installation floppies, find and use partitioning tools, install Linux and set up a boot loader, etc. I cried when I realized what had been done to me.
- dredmorbius 15y agoUnless someone 'fessed up to it, you really have no way of knowing who did this. It could just as easily have been a drive-by script. And regardless, it was a hard, cheap, early lesson in the importance of ensuring fundamental levels of system security. I've ... suffered worse. I strongly suspect you'll never forget this.
- dangrossman 15y agoThis being more than a decade and a half ago, I doubt it was a drive-by script. I was dialed into AOL on a 4 letter screen name. I had just informed a channel of Linux users, who knew my public IP, that I had just installed Linux for the first time. The chances it wasn't someone from that IRC channel are near zero.
- naner 15y agoThe next warning is stay off IRC or other places where "hackers" hang out. They think it's funny to hand you commands that can destroy your computer. It would be simpler just to tell the student to not run any command unless he or she can explain exactly what the program and arguments mean.
- non123 15y agoHow to ask questions the smart way? Lesson 1: Register with a female nickname: Jane123, KatyG, ... You'll see response time shorten dramatically.
- jgmmo 15y agoI got 1 upvote for anyone that can provide me a pdf of this thing.
- brewerja 15y agohttp://dl.dropbox.com/u/8605032/cli-crash-course.pdf http://dl.dropbox.com/u/8605032/cli-crash-course.pdf git clone git://gitorious.org/the-cli-crash-course/the-cli-crash-course.git Use dexy with a Tex install and it's a cinch. Only hiccup might be a few specialized Tex packages it complains about needing.
- jgmmo 15y agoI was very psyched to see this, however, I am afraid to tell you that this is missing parts of the text. It is missing the 'Do This/Source Examples' - a vital part of the text for sure. Replace with fixed copy and report back! Thank you kind sir!
- deleted 15y ago[deleted]
- brewerja 15y agoHmmm. So it is. Not sure why just yet. I'll give it a shot debugging the Tex. Maybe something in my setup.
- brewerja 15y agoUpdated to the latest version of dexy and all appears to be well. The link should now have a working copy.
- jgmmo 15y agoVery good, thank you!
- zedshaw 15y agoFeel free to read the PDF, and I'll be putting it up for free since it's a huge benefit to my students if they know the CLI. But, PLEASE, do not pass the PDF around to newbies until I say it's ready. Having old versions with potential errors floating around or that are half-done is really bad for them.
- JJMalina 15y agoI've been waiting for something like this. Thanks a lot Zed!
- sc00ter 15y agopushd / popd where have you been all my life?! How did I not know this? Thanks Zed!
- dboyd 15y agoRelated to that... the 'cd' section seems to be missing "cd -" (ATM). $ cd /some/really/long/dir $ pwd /some/really/long/dir $ cd ~ $ pwd ~ $ cd - $ pwd /some/really/long/dir I'm pretty sure "cd" and "cd -" are my most used commands. CDPATH ranks pretty important too.
- kkwok 15y agoWhat is the difference between the three?
- oscardelben 15y ago~ is your home directory. - is the last directory you ran cd from. For CDPATH see this http://www.caliban.org/bash/#bashtips http://www.caliban.org/bash/#bashtips
- seany 15y ago`please` don't use this in scripts. It makes it so hard to debug things later when the next guy comes along and has no idea where you end up after you pop. (can you tell this has been happening to me recently?!)
- joelthelion 15y agoMay I suggest [autojump](https://github.com/joelthelion/autojump/wiki https://github.com/joelthelion/autojump/wiki)?
- jseliger 15y agoI just wrote to Zed: I haven't read past section 0 yet, but I do have a suggestion for people who want to learn how to memorize things faster: use SuperMemo or a modern equivalent, like http://ankisrs.net/ http://ankisrs.net/ . Such programs use spaced repetition techniques to improve memory speed. I used Anki for improving my French and recommend it. If you'd like to learn more, see http://www.wired.com/medtech/health/magazine/16-05/ff_wozniak?currentPage=all http://www.wired.com/medtech/health/magazine/16-05/ff_woznia... . Cheers,
- mekoka 15y agoAnki and Mnemosyne (http://www.mnemosyne-proj.org/ http://www.mnemosyne-proj.org/) are both available from the Ubuntu repos.
- robert_nsu 15y agoI've been watching this for a little while. With powershell, a lot of the *nix commands have been or can be aliased to the windows commands (e.g. ls and Get-ChildItem). Judging from his notes so far, he isn't taking advantage of this, but hopefully he will.
- achompas 15y agoWas talking about going Linux soon, and this'll help me work from Terminal exclusively. Thanks!
- dekz 15y agoYou won't regret it! I'm not sure if I could ever stand windows as a main development environment again. POSIX is just a lovely environment to be in. Once you get the hang of it you'll see you become a lot more faster at mundane tasks (even scripting them). Good Luck!
- graysnorf 15y agoI second dekz's encouragement. I went from windows/eclipse to windows/eclipse + cygwin to linux/eclipse to linux/vim(et. al). It's worth it. It really is. At some point you will marvel that you ever thought it was a good idea to navigate filesystems with the mouse, or edit text in a non-modal editor.
- pault 15y agoI use a macbook as my main workstation, but all my development happens in linux VMs. It only takes a few minutes to install a headless ubuntu in VMWare, so I create a new one for every project I start. This has several advantages: - No configurations/installs from previous projects screwing things up (I know you can use tools like RVM and virtual-env, but in my experience starting from scratch is easier). - Snapshots. It's great to be able to restore from a snapshot when you bork an upgrade. - I've become very good at configuring a basic LAMP stack from memory. Screen+Vim and the ability to suspend/resume machine images makes for an extremely flexible and ubiquitous development environment. I've considered doing this with AWS but there are still odd times where I find myself without an internet connection.
- cturner 15y agoHey - I like doing this but find the power consumption of my laptop goes through the roof, and it gets uncomfortably warm. Does anyone have any tricks for beating this? I've just upgraded to latest vmware but haven't deliberately tested this yet.
- minikomi 15y agoI was recently given a small netbook and took the plunge with arch / xmonad and it has been pretty eye opening.. Going from "I need more control over screen brightness", to being able to assign keys that control the display precisely how I want has been frustrating and satisfying in just the right way. Thanks Zed for another great source!
- gbog 15y agoOn page 3, about "whoami" > type this command 20 times and say it out loud I have many years of daily command line use behind me and never needed to use this command. I don't like being taken for a child.
- VonLipwig 15y agoIf you don't like it use something else. Copy and pasting usually means you never knew what the code said anyway. Typing it once means you will remember it till the end of the day but tomorrow? The day after? Typing it 20 times and saying it out loud to yourself helps it stick. There is no need to run to Google to look up the command. You should know it after doing it this many times. Especially if in the following days you recap with some basic memory exercises. I have always thought that this is what set's Zed Shaw's books apart. They teach you a language in a way that sticks. If you don't find it useful or for your style of learning pick up a book focusing more on theory rather than doing.
- robbles 15y agoThen why work through the examples? The "learn by rote" method he's using here is designed to help people with little or no experience catch up quickly, and remember what they've learned without the many years of daily use. If you just want to learn the odd helpful new trick, and basically know what you're doing, just ignore these parts.
- gbog 15y agoThat is just one example of the tone of this book, and I just don't like it, and I don't understand why it has so many supposedly adult people accepting things like: > No, seriously, type it 20 times and say it out loud. Sssh. Just do it. I supposed it was a kind of cold joke but it appears not to be. It is just very disrespectful for the reader. Grown up human beings are not to be taken by the hand like /this/ to learn something as serious and advanced as command line.
- jshen 15y agoGrown adults are taught in a manner similar this everyday in basic training for the army. They teach far more serious topics, and it's effective. Also, smart people learn to skim and skip when needed. Writing like thus serves both cause the smarter ones skip.
- qjz 15y agoFile and directory names can contain spaces and require special treatment. This should be addressed up front, before introducing commands with side effects.
- zedshaw 15y agoOh yeah, thanks I need to put that early in the exercises.
- keithpeter 15y agoHow about including some examples of globbing all files of a given type including filenames with spaces? e.g. 1) Find all file names in a directory that contain spaces and replace spaces with _ 2) E.G save mp3 format sound out of a directory full of flv files using ffmpeg, flv files can have arbitrary file names, mp3 file names saved with no spaces That kind of activity would be interesting to younger proto-hackers I'm a teacher. A group of teenagers in a computer room (which is not your target audience) would not actually read your tutorial in an a to b fashion, but, when set a task would raid your work for the bits that help then achieve the task. I'd then follow up with a multi-choice quiz in Moodle or something similar to structure recall like your flashcards.
- rmc 15y agoExactly. As someone who's taught command line basics, this is a problem that people have a lot at first
- gcb 15y agoalways considered myself an ace of the command line... heck for some time i even used X only for webbrowser (while cursing) and used TTY1 for vim and TTY2 for a shell where i'd run version control commands and build... but yesterday, installing debian-testing on a new notebook, the radeon cards didn't worked out even with the vesa drivers and i had to use the console for a few hours... i panicked when i realized I had no idea how to bring the wifi up. ...and everytime something like this happens (previous one was some punk changing the kernel parameter "single" or "1" or "init 1" to "text")... i feel old and outdated. it hurts.
- Adaptive 15y agoI find wifi on the command is still surprisingly hard if using just primitives like iproute2. I'm trying to force myself to use just that for a bit to learn the new(ish) ip / iw commands. Really, though, wpa_supplicant seems to be the most troublesome critical wireless "primitive". Not fun command line syntax.
- tsm 15y agoI've had successful experiences with ceni--a relatively unknown interactive network manager. http://ubuntuforums.org/showthread.php?t=918442 http://ubuntuforums.org/showthread.php?t=918442
- AndresNavarro 15y agoI found about this problem when moving from gnome to a minimalistic window manager that had no task bar whatsoever. I now use cnetworkmanager which is a python cmd application that uses dbus to connect with the regular NetworkManager service in Ubuntu, but for a couple of minutes it was a weird feeling, not being able to do something this basic
- gcr 15y agoYou might consider switching to a lightweight distribution like Arch. Distributions intended to be used from the command line give you tools to make these tasks easier. https://wiki.archlinux.org/index.php/Wifi https://wiki.archlinux.org/index.php/Wifi
- xradionut 15y agoAm I just a cranky old geek or does anyone else find Zed teaching CLI skills mildly amusing? Or is there truly a large population mentally bound by the graphical interface? Know the basic commands of getting things done isn't just for the experienced admins/developers like myself who have been using keyboards and terminals since the early DOS and VMS days. Ordinary users were able to create documents, check mail and write simple Excel macros, etc. Coworkers shared tips, people had books and kept notes. None of this has ever been rocket science.
- zedshaw 15y agoYes, sadly Microsoft (and to a certain extent Apple) have done an excellent job convincing people that the CLI is both dangerous and antiquated. So when they come to my other books and I tell them to use the CLI they have major problems. I'm writing this mostly as a quick way to get them over that speed bump then on to more useful programming topics.
- eliben 15y agoZed's productivity is truly inspiring
- jisaacstone 15y agoOnce again - another resource with almost no windows support. At least he has a todo. . . Back when I just did PHP and never used a command line having a widows box was painless. Recently I have been learning UNIX at work and Python at home and have been impressed by the lack of resources/support for working with Windows. I suppose I should stop complaining and just blog what I've learned so far . . . though admittedly it isn't much.
- readme 15y agoNo problem, just install mingw. Or install msysgit and you get git-bash which comes with it. CMD.exe is a pile of garbage. I would understand if you wanted to learn about powershell, though. That's definitely on my todo list. Also, CMD.exe has copy + paste, you know? You can right click to start a mark, then left click and drag. Enter performs the copy. However, it doesn't understand newlines or line wrapping, so you end up getting artificial newlines where the end of the terminal is (which is unfortunately capped at 80 chars, so if you wanted to make it bigger, you couldn't)
- aridiculous 15y agoI like the tone of the books. It makes things interesting and you feel like stuff is getting done. Just wanted to throw that out there since most of the comments are complaining about it. I don't want you, Zed, to get the perception that everyone is sheepish about it.