6 ms·
Is unix shell one of those things you just have to suffer through for 3-6 weeks before "getting it"? Kind of like learning a musical instrument? Also would any
by triangleman 11y ago
Is unix shell one of those things you just have to suffer through for 3-6 weeks before "getting it"? Kind of like learning a musical instrument?
Also would anyone recommend learning how to use Windows PowerShell and again would that have the same kind of insane learning curve?
I'm just asking to make sure I'm not crazy and that command lines do in fact have a very high learning curve. Every time I attempt it, I fail because I don't know how to use these freaking flags and switches, and it's really hard to ask the computer how to use them. And that's if you know which command to use.
- untothebreach 11y agoI hope this doesn't come across as a "RTFM" comment, because I don't intend it to be, but I have found it helpful to get into the habit of reading man files when I need to know how to use a command. The quality of the man files on your system might not be the best, so I would suggest bookmarking the man pages from the OpenBSD project[1]. It might not always be directly applicable to your system, since some commands are different between linux, osx, and *bsd, but no matter what platform you are on, the OpenBSD man pages are very high quality, and at the very least might point you in the right direction. 1: http://nixdoc.net/man-pages/OpenBSD/ http://nixdoc.net/man-pages/OpenBSD/
- niuzeta 11y agoAdding to this comment is my recommendation to bro(http://bropages.org/ http://bropages.org/) command, which is a wiki-like man pages that simply tells you what the comand does on high level, and a few practical examples. man pages are great for the folks who are used to the type of prose and those who want to get to the bottom of the command. But I've almost always found the man pages unhelpful and sometimes even distracting(check the infamous sudoers manpage, which starts off with a 'Quick guide to EBNF). So my advice to those who start on linux is, if man pages aren't good for you, then google! more often than not, the task you're trying to do is something that someone has already tried to do, and there will be an easier-to-understand description than man page.
- anthk 11y agoDo not ever try comparing "Linux" man pages with the OpenBSD ones, which are much better than even bro-pages. A badly written man page or worse, an absent one is considered a bug at OBSD.
- duaneb 11y agoI would really recommend against using the *bsd man pages if you run a gnu system; the differences will drive you madder than the similarities will help, except with common tools (e.g. bash).
- GauntletWizard 11y agoIt's very easy for RTFM to sound dismissive, but after a while of being a young hacker, I realized it had a zen like quality. The answer to life's hardest problems isn't found by asking others; It is by searching inside yourself and Google. It took me a while to understand, and I imagine others have had the same problem. Flow is important to programmers, as is self-reliance. Interrupting others for questions is generally a bad idea for both you and them. At the same time, telling others not to interrupt can be discouraging and dismissive, so it's a fine line to walk to tell people who are learning to go away. You must do so in a supportive manner, and there's no simple solution to that. Any one solution you take only lasts for a limited time before it sounds trite and dismissive.
- mstade 11y agoOn any reasonable unix, you should be able to simply type `man cmd` where `cmd` is the command you're looking to learn more about. You can try this with `man man` for instance. Learning how to operate a shell isn't very difficult, but to really become proficient takes some time. It's also important to make a difference between the shell and the operating system it runs on. Some utilities for instance, may have the same name but slightly different flags or modes of operation, which can throw you off. You'll learn these things along the way, and mostly it doesn't matter unless you find yourself having to deal with many different unix systems (such as developing general purpose shell scripts.) I'd certainly argue it's worth learning how to use a shell, if you find yourself having to drop in to one relatively often, or if you're just somewhat interested. There are plenty of resources online, but I'm partial to tldp's guides[1]. I couldn't say much about PowerShell, I know next to nothing about it. I also have the benefit of not having to touch Windows systems much, and when I do I usually drop into git bash or something similar anyway. I'd say the answer to that question might lie in what systems you usually work in, and which ones you want to work in. If you have little interest in unix based systems, then by all means go forth and Windows up, but otherwise I'd suggest learning more about unix shells and specifically: bash. Why bash? It may be the javascript of unix shells – there are certainly more (and less) capable shells out there – but it has the benefit of ubiquity. You can find bash pretty much anywhere. (And with git bash and the likes, even on Windows!) [1]: http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html
- LukeShu 11y agoOne major thing is that there is so much inconsistency. Several posters here have commented on how find is a terrible tool with weird syntax. It's not actually terrible or weird, it's just different... because it pre-dates most everything else. And it is hard to know how to ask the computer how to use the tools. Is the flag you need in `cmd -h` (traditional) or `cmd -help` (X11) or `cmd --help` (GNU) or `cmd --usage` (other GNU) or `man cmd` (UNIX; `man` is short for "manual") or `info cmd` (GNU)? mstade said that "On any reasonable unix" the solution is `man cmd`. That's in general true, but apparently GNU/Linux isn't a reasonable unix then[1] (one may even say that it's not Unix :P ). Often (mostly for GNU commands), the man page is crappy (don't ever bother with the wget man page, `wget --help` is what you want) or non-existent. But it's a good place to start, then you can try working through the options I listed above... after some point you'll gain some intuition for which are the more likely ones to yield results based on who the publisher of the software is. untothebreach's suggestion to bookmark the man pages for a system that has consistently good man pages, even if they aren't 100% compatible with the version of the command you have. He recommended OpenBSD, which is a good choice. When I was new, I leaned pretty heavily on the FreeBSD man pages https://www.freebsd.org/cgi/man.cgi https://www.freebsd.org/cgi/man.cgi . [1]: Plug: I actually wrote a blog post once on why documentation on GNU/Linux sucks. https://lukeshu.com/blog/poor-system-documentation.html https://lukeshu.com/blog/poor-system-documentation.html
- outworlder 11y ago> Also would anyone recommend learning how to use Windows PowerShell and again would that have the same kind of insane learning curve? I do have to use Powershell at work so I am familiar with it. But you can't seriously claim that Powershell is an example of good design. Its language is as inconsistent as Bash, even with the benefit of hindsight. Powershell is only helpful with the flags and switches, if you are calling other powershell scripts, or .net libraries. If you are calling standard executables, you are back to square one. Which happens to be bash's more common use case.
- useerup 11y agoPowerShell is miles ahead of bash, sh, ksh, zsh etc when it comes to consistency. For instance: * All of the cmdlets follow the same verb-noun pattern. * There are only 40 or so standardized verbs, with guidelines for what they should be used for and how to choose the nouns. * Parameter names are also standardized * Parameters are parsed by the shell - not individual commands, which means that all cmdlets take parameters the same way, no strange differences like between dd, ls, find etc. * There's a set of standard parameters supplied by the shell that is common to all cmdlets, and which has the same function on all cmdlets (-ErrorAction, -WarningAction, etc). * Cmdlets are more single-purpose than typical unix commands. Take for instance unix "find". Why can a find command delete files and why can it execute other commands?? * PowerShell supplies scripting and expressions. Meaning that there no need for tools such as jq, awk, find, xargs etc, each with their own expression syntax.
- lawpoop 11y agoThanks for the write-up, this is very informative.
- marcosdumay 11y agoIt does take some time to be comfortable at any shell. That applies to WIMP ones too, but you've probably gone trough that phase already. That said, you should get able to do the basics fast, and need time just to expand to the less common corners. Also, practice will make you comfortable, and indeed faster, but is not a requisite for using it correctly. The learning curve is steep, but there's no barrier anywhere, and no leap in understanding (if you already can code). As people will keep telling you, the manual is your friend.
- vram22 11y agoCheck out this book: The Linux Command Line. http://shop.oreilly.com/product/9781593273897.do http://shop.oreilly.com/product/9781593273897.do There's a review of it by me on that page, under the Reviews link. I think that review (which I spent some time and effort writing) will give you a fairly good overview of the topics you (or anyone) needs to learn to become good at using Linux (or other Unixes) at a user level. There are also tons of other resources for it on the net, including many at http://tldp.org http://tldp.org - The Linux Documentation Project. Some of those may feel more advanced, so you may want to start with the book above, or any other similar book, and then move on to the TLDP and other tutorials on the net.
- mzs 11y agoI used a different O'R book, Essential System Administration or something like that. It had a chapter on the shell and some useful commands to use in shell scripts. Also the SysV printed documentation had a very nice book about the other commands that you miht use like roff as a word processor.
- vram22 11y agoYes, Essential System Administration is good. I've read some of it. But I think it is more oriented for sysadmins, while the Linux Command Line book is for beginners, who may or not go on to become sysadmins. Aside: One of the good points the ESA book maks, IMO, is that when doing sysadmin tasks, try to make your changes reversible, i.e. you should be able to go back to a previous state (of a config file, or whatever). That can save you from a hell of a lot of trouble later.
- pavlov 11y agoThese days I often feel that Google + Stack Overflow are the real textual UI to a computer, and the command line is a kind of bytecode. As with any assembler, you can get pretty good at memorizing the commonly used parts, but often you'll just need to look it up. Would it be possible to make a compiler for this: a "natural language Google search query to bash script" tool to automate the process that everybody does anyway...?
- peterwwillis 11y agoNah. You can get comfortable with the Unix shell in a week. First thing's first: you have to know what's out there in order to find out how to use it. Go to a book store (they still have those right?) and pick up a 50 page Unix command line reference. Read it cover to cover. Play with each individual command in some way. Note: this should be a UNIX reference, and not Linux. You want something ancient and decrepit, because it'll be the most universal and simple set of commands to start with. Get another book, something like an Introduction to Linux System Administration. Besides telling you all about the system itself, this will task you with running commands and modifying different parts of the system; you'll be doing lots of command-line work, all following the book's instructions. Finally, attempt to write basic shell scripts and run commands with a basic user interface, like lynx or mc. This will not only teach you how the shell interprets everything you type into it, it will give you an insight into the other ways the console works with the terminal, applications, i/o, etc. It may sound like a lot for a week, but if you spend a couple hours a night on these you can't go wrong. When in doubt, buy another book.
- guelo 11y agoMany thousands of people learned it before you so it can't be that hard, and you have it way easier than most of them since you have all the world's information at your Googletips. Like everything, you poke around trying different things until something works and then you do it again. The key is to not be afraid of the damn thing or blame yourself for being too stupid. Everything is stupid we just all muddle through the best we can.
- johnchristopher 11y agoThere are many thousands neuro surgeons or physics.doctorates so there's that but learning bit by bit with google won't ever beat picking up the adequate book.
- duaneb 11y agoJust like I don't think any number of books will ever compensate for a poor ability to teach yourself.
- johnchristopher 11y agoOf course books do compensate for that. Try picking up mushrooms with self teaching and personal feedback and picking up mushrooms with a catalog of the edible and non-edible ones.
- lawpoop 11y agoNo, probably more on the scale of months. In my case it was years, but I was an intermittent and resentful user. I'd say ignore the people who recommend man pages; they're pretty much the worst form of documentation out there. The first thing they show you is a cartesian product of all switches, which can do nothing but serve to confuse you. After that, they list the switches an alphabetical order, which is useful only as a reference after you already understand the command. It's true, you can search in the man page, but you have to already know the technical term for what you searching for. Your question may be "How can I do X with Y command?" which man pages often don't help. The are only reference pages for those who already know the commands. Better ways to learn are to search the internet, specifically the awesome unix.stackexchange.com, and best yet work with someone who knows more than you who wants to help you. At my workplace, there are several Linux experts, and we regularly chat about ways to accomplish our problems in the shell. Once you learn them, you will enable yourself to do very very powerful things that would take special commands in special apps, which you have to download, install, and perhaps purchase. Such as grepping an entire codebase for a string, as a small example. Learning a unix shell is like learning a programming language that works on pipes. There is a hump to get over, and once you do, you will be able to express precisely what you want to with your computer. As far as you're concerned, it's the language of the operating system, allowing you absolute control. Because of my awesome co-workers, I now work daily, productively, in the shell. I use cygwin on windows to develop on remote and virtualized unix environments, and the experience is seamless.