How to figure out what I need to search for in order to create a program?
To a certain degree, it comes down to experience. But if you don't have experience, I feel you can get a lot of mileage of just trying to do the simplest thing possible to see what'll happen and googling your questions as you go. 

At some point, you'll run into an obstacle you didn't anticipate and realize you need to pivot and adjust or even entirely re-write your code to accommodate. (Having to rewrite code can seem painful at first, but it's basically something everybody needs to get used to. It's helpful to have a sort of zen mindset, where you let go of your attachment to your code).

Once you do this enough times, you start to develop a sort of gut sense for what sorts of obstacles you might end up.

For example, take your shell example. If I had absolutely no idea what I was doing but just moved forward instead, I would probably...


Start by writing the code to do the user input/output stuff so I can get commands from the user. This code would likely be extremely minimal/something you'd write in a CS1 class.
Next implement some basic shell navigation functionality like cd and ls directly within the shell. Now, my shell is a little more complicated: I need to remember things like where I'm located in the file system; I'd probably have to do some research on how you'd implement things like ls within C...
Next, try I'd try and implement the ability to have my shell call other programs. Since I'm a beginner, I have no idea how to do this, so I'd pretty much immediately just google "C run another program". This will immediately bring up results that mention the "fork" and "exec" keywords. 

I might not know what those mean, but it gives me just enough context that I can form more specific google queries. ("C exec example", "C exec vs excv", etc...)

Now, depending on how I previously wrote my shell, I might immediately be able to adapt these examples to my own code, or I might need to rewrite and rearrange things significantly. This is mildly painful, but such is the life of a beginner -- no biggie, I do what I need to.


Then you rinse and repeat...

Another strategy you can try is to try planning ahead: specifically, figure out what precisely you want to do, then decompose that plan into smaller and smaller subproblems. The nice thing about this approach is that it forces you to think about potential obstacles you might run into and can help make it easier for you to form precise google queries.

For example, we want to write a shell. Well, what exactly does this shell need to be able to do? Let's say as a minimum prototype, I want to be able to:


Get user input
Run basic navigational commands like cd and ls
Define basic environment variables
Be able to run other programs


Ok, how do we do all three of these things? Well, if we drill down, we might end up coming up with something like this:


Get user input


Recognize and expand environment variables first?

Run basic navigational commands like cd and ls


Make some kind of system or library call to get the data I need? (Note to self: google this)

Define basic environment variables


Process the user input to get the variable name and the value somehow?
Store the variables in a map of some sort?

Be able to run other programs


??? (Note to self: google this)



Notice that if we had kept drilling down, we'd end up learning about the fork and exec thing here as well.