A Crash Course on Linux (Just The Good Parts)

Originally, this blog post was going to be about how Linux works with its kernel and everything. That turned out to be extremely dry, and it was a jumbled mess to try to fit everything into a blog post. Just check out the Linux wiki page for all that stuff. Instead this post is going to be more about parts of Linux that people should know about. Linux is used widely for developing software and embedded systems. One example is the ZYBOt, partially developed by Kaitlyn and me!

 

Tux in different outfits
Tux, the Linux logo, in different outfits.

 

Different Linux Environments: The open-source nature of Linux means that there are a lot of different systems of Linux, they’re all based off of the original kernel, so they’re all fairly similar to each other. If you think of it like different car models, each car is a little bit different, but you can switch between them without too much trouble. I personally use Ubuntu (it was easy to dual-boot), so all the terminology will be based off Ubuntu’s commands, but if you want to use a different environment, you’ll still be able to follow this blog post.

 

Credit to imgarcade
Image from imgarcade.

 

The Terminal
When using Linux, the terminal is the bee’s knees. If you know enough about the terminal, you can do anything! The terminal allows you to go into any folder (if you have the right permissions), and edit the folder’s files. In Unix and Linux everything is a file, which means anything in Linux can be changed –and the terminal is how you do that!

 

Important Commands:

sudo stands for substitute user do. This command grants temporary administrator privileges to the terminal. A lot of times you need special privileges to download something, and sudo grants you those privileges.

 

sudo apt-get update is a very important command. It synchronizes programs with their index files of needed packages. What this means is that sudo apt-get update compares the index of packages that programs have and an index of packages that it may need (this is accessed from the internet).

 

sudo apt-get upgrade will use the index files that sudo apt-get update and install required packages.

 

gcc and g++ are used to compile C and C++ code, respectively. Of course other languages can be compiled in Linux, but the general idea is the same for everything. There’s a lot of useful options that you can use with gcc, although -o is my personal favorite. When running gcc, you can just call the command like “gcc helloworld.c” and it will compile. After compilation, you can run the file by entering the command “./a.out”, a.out is the file that gcc sends the executable file too.

 

If you don’t want your file going to a.out, then -o can help! Instead of the command “gcc helloworld.c” (which will make the executable a.out), we can do “gcc helloworld.c -o helloworld”. This creates the executable and send it to the “helloworld” file, and then we can run that using “./helloworld”.

 

There are a lot of other commands. Here’s a list of some of the commands that you’ll use a lot.

 

Of course there’s a lot about Linux that we haven’t gone over! We could fill an entire book and still only scratch the surface of Linux, but this post hopefully exaplained a few important things!

Author

About Josh

I love Coding!

View all posts by Josh →

Leave a Reply

Your email address will not be published. Required fields are marked *