A crochet needle is looped into a gray and white project. White and gray bundles of yarn sit attached to the project.
A crochet needle is looped into a gray and white project. White and gray bundles of yarn sit attached to the project.
Photo by Kelly Sikkema on Unsplash

Remember in elementary school how there was always that one topic that the kids in the grade above would warn you about? They’d whisper horror stories about learning multiplication or cursive (am I aging myself here?) at the bus stop, sending a chill into the students in the grades below.

Recursion is that topic for many programmers. It comes in whispers and horror stories. But the thing is, just like cursive and multiplication, it becomes much easier with practice. Don’t get me wrong — I still have to practice explaining it out loud in order to understand what I’m doing…


Shelves that look like boxes hold vintage books upon a wooden wall.
Shelves that look like boxes hold vintage books upon a wooden wall.
Photo by Paul Melki on Unsplash

When working on large projects, it can be frustrating to compile many files together. This is even more of an issue when sharing the files with others. Libraries enable us to organize and use functions without having to copy the source code into each location.

If you’ve done any programming in C, you’ve likely begun your file with something like

include <stdlib.h>

When you do this, you are calling the header function for the standard library. Each of the files in the standard library exist as source code, but you don’t have to compile them into your file because the…


A laptop displays code in a terminal. Next to the laptop, three plants sit before a window.
A laptop displays code in a terminal. Next to the laptop, three plants sit before a window.
Photo by Safar Safarov on Unsplash

What happens when you type a command like ls -l into the shell?

When you open a terminal on your computer, it will begin to run the shell program. A shell is a program that interprets and executes commands from the standard input or from a file. If you’re using a Linux-type system, your default will be a bash shell. However, there are several different shells available, and you can even create your own!

To better understand the shell, let’s dig into the ls -l command to see each step of its process.

When you first enter the shell, it prints a prompt. When you type in ls -l, the shell uses the…


Photo by Jessica Ruscello on Unsplash

You’ve done it: you worked tirelessly on a series of functions to plug into your main file, but now you’re typing a rambling stream of files into your command line to compile them together. There has to be a better way, right?

(Enter libraries.)

A library is a single file that contains any object files that are needed for a project. During compiling, the linker uses a library to access several object files as one item.

There are two different types of libraries in a Unix system. A static library (also called an archive) is an indexed library that is…


A green circuitboard
A green circuitboard
Photo by Michael Dziedzic on Unsplash

Before using any C program, it is essential to first compile it. While a simple

gcc main.c

will compile your code for you, it’s critical to understand the steps that it takes to make your program executable.

Steps of Compilation

  1. Preprocessor
  2. Compiler
  3. Assembler
  4. Linker

Preprocessor

The preprocessor will format your program for the compiler. To do so, it removes comments, includes header files, and performs macro expansion.

To send a file to the preprocessor but not compile it, we will use this command:

gcc -E [filename.c]

Compiler

The compiler takes the output from the preprocessor and turns it into assembly code.

To…


A deck of cards is spread across a table. On top, an ace of spades is visible.
A deck of cards is spread across a table. On top, an ace of spades is visible.
Photo by Jack Hamilton on Unsplash

What do you do when you only want to see the c files in your directory? With a simple string, you can filter only the desired files to your list.

ls *.c

How does this command work? Let’s start at the beginning of the string.

ls

The ls command lists directory contents. When used alone, it will display the names of all contents that are not hidden (starting with a period).

“*”

The * acts as a wildcard, instructing the command to match certain patterns. When used on its own, an asterisk will select every item in the current directory…


A laptop displays a screen full of code.
A laptop displays a screen full of code.
Photo by Clément H on Unsplash

When linking files in a Linux system, it’s important to think about your goal. Are you trying to save an exact copy of the file? Are you trying to make it easier to reach in a different directory?

Depending on these goals, you will want to use either a hard link or a soft link. While both will direct you to a file, they serve different functions and may lead you to different versions of a file.

Hard links

A hard link is an exact link to a file’s inode. This means that even if you change the content of the file…

Aleia DeVore

Software engineering student and lover of mountains.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store