8 ms·
The Linux Command Line
- Overtonwindow 4y agoRelated: "In the Beginning... Was the Command Line" https://web.stanford.edu/class/cs81n/command.txt https://web.stanford.edu/class/cs81n/command.txt
- amalgamated_inc 4y agoSo great! Maybe his best work. I re-read it every year or so. In fact, I'll re-read it right now.
- saeranv 4y agoThis is what made me interested in using Linux for the first time!
- whitepoplar 4y agoI found this book to be excellent when I read it, as are most of No Starch's books.
- channel_t 4y agoI consider this book pretty much required reading for junior devs and others in engineering who don't have a decent handle on basic Unix skills for whatever reason--which seems to be a more common occurrence these days than earlier in my career.
- xcambar 4y agoBecause developer tools are increasingly polished and easily accessible without in-depth knowledge of the arcanes of the command line. And that's great to welcome more people in our field. The downside is that once they're welcome, the climb of the learning curve is barely started.
- mkesper 4y agoI was astonished last week again how bad GUIs for git are. Take VSCode: It encourages you to enter just the title of the commit message. That's the boring part for people used to describe WHY that change was made in the long message.
- tweetle_beetle 4y agoIt arguably follows the underlying git design more closely than many git clients. Git has no concept of commit titles and commit descriptions - it's all just a message, so in VS Code you write it all in the same box with newlines [1]. It's definitely not obvious if you're used to having separate fields, but it's a bit unfair to complain about all GUI clients because an opinionated text input box is missing from a single feature from one of them surely? [1] https://stackoverflow.com/a/51316392 https://stackoverflow.com/a/51316392
- kevin_thibedeau 4y agoThose polished tools hide a lot of the underpinnings so that nothing is understood. We get header-only C libraries (not C++) because people don't understand build tooling and want something that works on easy mode.
- xcambar 4y agoWhat's so wrong about easy mode? For me, it's hard to make good software today because the bar is actually higher, in the sense that it must be usable by a much wider audience and I can't be lazy about usability or even worse, let it unnecessarily complicated because "people should know about it or learn".
- kevin_thibedeau 4y agoNeed to migrate your IDE project to a CI system? How do you do that if you only know how to click through a wizard? Everything has to be spoon fed and if it isn't they are paralyzed.
- velavar 4y agoDo you think that this is because they don't really need to anymore with all the nice GUI/tools around? Is there an advantage to bring able to do something on a command line vs other ways? Asking because I'm at a bit of a crossroads - I have a good handle on about 5% of the command line knowledge which gets me through 80% of the stuff I need to do. I'm wondering if learning to use more commands is worth the effort when I can already get the task done without using the command line?
- deleted 4y ago[deleted]
- somrand0 4y agodepends on how close you wanna get to the servers, and then the hardware? I suppose it's a super rare occurrence now, but back when I was starting on this, I would mess up my X server and was forced to fix it from the command line.
- dinkumthinkum 4y agoI think a lot of very junior developers now really just don’t know very much about computers and electronics beyond social media.
- gofreddygo 4y agomore commands are a side effect of more capability. If you get a sense of things you can do with (|, & , >) and a dozen or so commands like sort | uniq | cut | paste | join | head | tail | sed | awk | wc | tr | fmt | col | nl | pr | find | grep | tar | export The value you get in return is intense for the effort invested. Plus, in the 10 years i've been maintaining code, bash scripts are the minority that still work as they used to with almost no change needed. That single handedly is worth my money.
- foobarian 4y agoThese days I would include jq in that list as well, near the front in fact
- chasil 4y agoIt is a very kind gesture to make this book freely-available. It does have a small problem in the number of "bashisms" that it quietly promotes. The entire Debian/Ubuntu family has chosen the Almquist shell because of speed and standards compliance, and many things in this book will not work there. It would be helpful to have a book that is clear that the POSIX.2 shell is not Bash.
- BossingAround 4y ago> The entire Debian/Ubuntu family has chosen the Almquist shell because of speed and standards compliance, and many things in this book will not work there. So Debian/Ubuntu ship completely without Bash? According to [1], it's Bash, but it might be outdated. [1] https://wiki.debian.org/Bash https://wiki.debian.org/Bash
- chasil 4y agoBash is shipped in Debian/Ubuntu, but as /bin/bash, not as /bin/sh. What is shipped as /bin/sh is described here: http://gondor.apana.org.au/~herbert/dash/ http://gondor.apana.org.au/~herbert/dash/ From the EPEL RPM: "DASH is a POSIX-compliant implementation of /bin/sh that aims to be as small as possible. It does this without sacrificing speed where possible. In fact, it is significantly faster than bash (the GNU Bourne-Again SHell) for most tasks."
- John23832 4y agoHm but the default shell is still bash. It would make sense that "bashisms" don't work on "sh". You should use bash or bash derivatives (zsh) for bashisms. I think the bigger stumbling block is that people often can't differentiate bashisms from basic shell scripting.
- gdavisson 4y agobash is the default interactive shell for users, but dash is the default shell for scripts with a #!/bin/sh shebang (or no shebang, unless they're run from bash), system() calls, etc. This means bashisms will work sometimes, which can be worse than not working at all. I agree about the importance of differentiating bashisms from basic scripting, but I think the root cause of that is documentation (including this book) that don't make the distinction.
- jalino23 4y agothis true. getting started in the industry has a lot of assumptions about command line knowledge, every other tutorial or book kinda assumes it. it wasn't until 3 years later that I realized that I should have learned it sooner.
- heresie-dabord 4y agoThe GNU and/or GNU-Linux terminal is the killer app. * M-Windows WSL2 * Cygwin * Mac OS X * ChromeOS Crostini (Debian Linux VM) * Linux (of course)
- bottlepalm 4y agoI'd be cool to type something like `// spin up a lamp stack docker image`, and have below it the ghosted auto-completed command powered by chat gpt or something. I'd go so far as to say all command line apps should have an -explain suffix, that doesn't actually run the command it just parses it and outputs how it understands it in plain text. Combined with the above to help avoid AI mistakes.
- nonrandomstring 4y ago> should have an -explain suffix Adding -h or --help generally does something useful
- bottlepalm 4y agoThat gives you a list of all the commands, no something short and sweet about exactly what the command you have written will do. If --explain is part of the argument parser then it would be relatively easy to implement.
- nonrandomstring 4y agoSome programs kinda do that, but you're hitting on an old problem that Unix/Linux has a few ways of doing similar things all of which can miss the mark. commands info, man and apropos are fairly close to your goal, but: - info only covers bash/core-utils - not everything installs something into the apropos file (and many package managers seem awful at remembering to delete entries on uninstall) - man pages have many standards and good practices, but some are still terrible or nonexistent So a --help switch is the lowest common denominator. And has the advantage of living in the executable as an argument parsing outcome. But that means it suffers locale parochialism. I think people may be afraid adding yet another switch like --explain would only make things messier. So far I think the best is usually the first stanza of a well written man page.
- jimmaswell 4y agoI bet you could open a bash file with copilot enabled and do that right now.
- amelius 4y agoI still get "Argument list too long" on a machine with 64GB of memory. This is not acceptable in this day and age.
- dinkumthinkum 4y agoMost command line programs are open source so you can do something about that if it really makes sense.
- jeffbee 4y agoYou can't fix this in the tool you are trying to invoke because the tool never runs. The error E2BIG is returned from the syscall `execve` because it fails to run the program. If you just want to work around this on some architectures you can simply raise the stack limit which defaults to 8MiB. If you want to do this in a portable way, learn to use `xargs` or `find`.
- amelius 4y ago> If you want to do this in a portable way, learn to use `xargs` or `find`. xargs and find are a hack here, because it will start the target program multiple times. They only work if CMD FILE1 FILE2 has the same meaning as CMD FILE1; CMD FILE2. The fix with the stack limit is also a hack. What other system requires you to specify a hard limit, these days?
- genericacct 4y ago-N 1 will invoke the command with only one arg at a time
- forinti 4y agoIt might protect you from shooting yourself in the foot.
- amelius 4y ago
- Icathian 4y agoThis was the book that kick-started me along to becoming a software engineer. Fantastic book and I can't recommend it enough.
- mjh2539 4y agoSame here. I got it after writing some macros to automate parts of my first job after college. The rest is history!
- kaycebasques 4y agoHow Linux Works (also published by No Starch) covers a lot of useful commands too: https://nostarch.com/howlinuxworks3 https://nostarch.com/howlinuxworks3
- aquova 4y agoI just got this book for Christmas, it's a really excellent guide into the internals of a Linux system.
- jeroenjanssens 4y agoRelated: Data Science at the Command Line https://datascienceatthecommandline.com/ https://datascienceatthecommandline.com/ Disclaimer: I wrote it. Plugging it here because (a) it's related, (b) it's free to read online, and (c) would not have existed without HN.
- vram22 4y agoIt's a good book. I had done a review of it as a blog post under the O'Reilly Bloggers program which existed some years ago. But it and other such book reviews disappeared after a reorg of the site. So only a stub remains: https://www.oreilly.com/pub/blogger/vasudevram https://www.oreilly.com/pub/blogger/vasudevram
- vram22 4y agoForgot to say that I had given it a rating of 4 out of 5.
- argonaut07 4y agoHow would you unit test/mock your scripts, following the guidelines of this book?
- ketanmaheshwari 4y agoI made these slides on Linux Terminal Tools that might also be handy alongside the book: https://github.com/ketancmaheshwari/lisa19/blob/master/LPT_LISA.pdf https://github.com/ketancmaheshwari/lisa19/blob/master/LPT_L...
- quijoteuniv 4y agoWant to change the world? Write books like these!
- asicsp 4y agoI've written a few free ebooks on CLI tools: * "GNU grep and ripgrep" (https://learnbyexample.github.io/learn_gnugrep_ripgrep/ https://learnbyexample.github.io/learn_gnugrep_ripgrep/) * "GNU sed" (https://learnbyexample.github.io/learn_gnused/ https://learnbyexample.github.io/learn_gnused/) * "GNU awk" (https://learnbyexample.github.io/learn_gnuawk/ https://learnbyexample.github.io/learn_gnuawk/) * "Perl one-liners cookbook" (https://learnbyexample.github.io/learn_perl_oneliners/ https://learnbyexample.github.io/learn_perl_oneliners/) * "Command line text processing with GNU Coreutils" (https://learnbyexample.github.io/cli_text_processing_coreutils/ https://learnbyexample.github.io/cli_text_processing_coreuti...) * "Computing from the Command Line" (https://learnbyexample.github.io/cli-computing/ https://learnbyexample.github.io/cli-computing/)
- entropicgravity 4y agoDo everyone a favour and write your linux scripts in python.