Live data from Hacker News

Ask HN: How can a intermediate-beginner learn Unix/Linux and programming?

news.ycombinator.com

1–10 of 114 posts

Ask HN: How can a intermediate-beginner learn Unix/Linux and programming?

#1
For a long time, I’ve been in an awkward position with my knowledge of computers. I know basic JavaScript (syntax and booleans and nothing more). I’ve learned the bare basics of Linux from setting up a Pi-hole. I understand the concept of secure hashes. I even know some regex.

The problem is, I know so little that I can’t actually do anything with this knowledge. I suppose I’m looking for a tutorial that will teach me to be comfortable with the command line and a Unix environment, while also teaching me to code a language. Where should I start?

Re: Ask HN: How can a intermediate-beginner learn Unix/Linux and programming?

#3
My advice is to start working on a project you care about and then learn everything required to make it happen. If you already know JavaScript, maybe build and deploy a static website. Once you've done that then perhaps make it interact with an API.

Re: Ask HN: How can a intermediate-beginner learn Unix/Linux and programming?

#5
post #4

For programming, start by having a project. Think about something you’d like to build and focus on one thing at a time. This will guide your research. For Unix, install linux on your computer and use it daily. You’ll be forced to learn.

>For Unix, install linux on your computer and use it daily. You’ll be forced to learn.

I tried this years ago and it didn't end well. With how complicated current-gen distros are, you need to understand what's going on under the hood before you can effectively mess with it. In my experience you'll just end up with one screen that's only at 720p and a crashed pulseaudio that you never fix because you just want to watch netflix right now, and for some reason that still works as long as you use bluethooth. Even though you didn't want to use your bluetooth headphones, it's easier than fixing the problem with your sound driver or whatever so you'll just end up using them anyway.

It might be easier to start with server management because you don't have to figure out much human IO stuff... Linux is really good at talking to Linux. VPSs are cheap and give you root access. Plus if you mess up, it's generally pretty easy to just format the VPS and start over. You can't easily do the same on a desktop. Also it forces you to learn about Linux and not whatever software your distro uses (for example, learning how to use apt is a lot more important than the ubuntu app store)

Re: Ask HN: How can a intermediate-beginner learn Unix/Linux and programming?

#6
a really good book is Richard Stevens Advanced Programming in the UNIX environment[1]. (sounds daunting but it's not too bad when you combine it with another introductory text on C). If you stick with C you'll eventually know UNIX/Linux a lot deeper than anyone. It takes time though so go easy on yourself.

Also check github for a bunch of repos that contain biolerplate code that is used in most deamons illustrating signal handling, forking, etc.[2]

Also I suggest taking some open source projects from Daniel Bernstein (DJB) as examples on how to write secure code. qmail, djbdns, daemontools ... there are lots of great ideas there[3]

Write a couple of simple programs that utilize your code and expand from there, learn the plumbing, e.g. write a Makefile, learn autotools/autoconf, how to write tests, how to use gdb, how to create shared libs and link a program LD_LIBRARY_PATH/ldconfig, etc ...

Most important think about something that you like to write and go from there. Back in the late 90ies I studied RFC's (MIME, SMTP, etc) and then implemented things that I could actually use myself. Here is a recent project I did some weeks ago (an extreme edge-case for security maximalists which will never be used by anyone other then myself, ... but I really enjoyed writing this and learned a bunch of new stuff while doing so)[4]

if you need ideas or help with looking at your code, don't hesitate and send me a mail.

[1] https://en.wikipedia.org/wiki/Advanced_Programming_in_the_Un...

[2] https://github.com/jirihnidek/daemon

[3] https://cr.yp.to/djb.html

[4] https://github.com/DyslexicAtheist/nfq/

Re: Ask HN: How can a intermediate-beginner learn Unix/Linux and programming?

#7
Learning to use the command line is a requirement for all serious programmers and its great you want to start.

It can be pretty overwhelming to use the terminal so you may have to some reading to get yourself really comfortable.

I usually go to books/(book pdfs) to help me start out because they have conceptual explanations about the syntax which really helps my understanding.

Maybe this one would be good? The Linux Command Line, 2nd Edition: A Complete Introduction

Once I'm comfortable based on the book, using StackOverflow and other websites becomes much, MUCH easier.

In the process, you'll learn BASH which is used for scripting.

Re: Ask HN: How can a intermediate-beginner learn Unix/Linux and programming?

#8
post #4

For programming, start by having a project. Think about something you’d like to build and focus on one thing at a time. This will guide your research. For Unix, install linux on your computer and use it daily. You’ll be forced to learn.

>For Unix, install linux on your computer and use it daily. You’ll be forced to learn. I tried this years ago and it didn't end well. With how complicated current-gen distros are, you need to understand what's going on under the hood before you can effectively mess with it. In my experience you'll just end up with one screen that's only at 720p and a crashed pulseaudio that you never fix because you just want to watc…

I don’t know how long ago you’ve tried it, but that was pretty much my experience as well. However, in my case we are talking late 90’s. Things have changed a lot since then.

Re: Ask HN: How can a intermediate-beginner learn Unix/Linux and programming?

#9
Keep hacking your raspberry pi. Customize your shell with a profile; maybe alias LS so it always uses color? Find some packages to install. Cowsay, and SL are great, udderly useless ;) programs. Check em out.

Keep projects small, just patch together open source code for fun, and read the open stuff you do use.

You could also switch the GUI environment of your raspberry pi. Install headless raspbian and install he GUI from the CLI. Just hack!

My koan is video poker, I’ve rewritten a whole game about 3 times. I also like writing prime number finders in new languages.

Re: Ask HN: How can a intermediate-beginner learn Unix/Linux and programming?

#10
Some resources I've found helpful to learn some command-line:

- https://cmdchallenge.com/. This set of increasing-in-difficulty challenges should help with structure in terms of learning a bit more.

- https://explainshell.com/ can be helpful as well.

- Don't forget the man pages! `man ` can be quite helpful! For a different approach on teaching some, bropages.org could be helpful.

- I haven't used it personally, but there is a lot of info at http://www.opsschool.org/

As for learning to program, I suggest a very good starter language is Python, and its built-in, first-party language reference/tutorial I found helpful when I learned it: https://docs.python.org/3.8/tutorial/index.html

As for "what" to program after that, I don't have any great resources for what constitutes some good initial programs. Off the top of my head, here are some ideas about places to start which are doable with only inputting and outputting text:

- FizzBuzz

- Play Rock Paper Scissors with the computer

- Play Tic Tac Toe with the Computer

- Sieve of Eratosthenes

- Conway's Game of Life

- Given a piece of text, count how many occurrences of each word there are and display the top ten.

Post reply on HN