We are about to delve into shell scripting. Shell scripts are used to automate certain things related to files.
It is good to be acquainted with shell scripts if you are a software developer, but if you are a regular user, read this only if you are interested. The aim of this section will be to get you familiar enough with shell scripting to read and write shell scripts, albeit you will need to Google certain details of the things you are trying to achieve (if you are writing your own shell scripts). We will do this by making a very simple shell script which demonstrates the usage of each of the constructs we will learn to use.
Use cron to schedule things periodically; use at to schedule things only once
Every single computer in a computer network has an IP address through which it can be addressed
ip command is used to see information about your network interfaces
Use ping someWebsite to check your Internet connection (you should have no packet loss)
Use ssh to login to a remote host
Use scp for copying files to/from a remote host
X Window System is related to the Linux desktop
Build systems exist to ease the process of creating an executable from source code
To build something from source code do the following: 1. Download the folder with the source code; 2. Run ./configure; 3. Run make; 4. Run make install
Today I want to introduce you to the concept of a build system. To understand what a build system does, let’s first discuss some other things and then we will gleam an intuition behind build systems.
Let’s say you were compiling a program that used a lot of libraries. To remind ourselves, libraries have to be linked to our program to produce the final executable file. Those libraries can also be called dependencies – we depend on them (or, more precisely, on the functionality within them) to be able to use our program.
Now, imagine if our program depended on a lot of libraries. Let’s say thousands of them. I think you get a feeling that it would be pretty hard to manage all of that manually. We would have to tell the linker to look for all of the thousands of libraries and that is tedious. And one thing programmers don’t like is tedious.
Build systems take care of this problem (among other things). Build systems make managing dependencies very easy. One of the most popular build systems is make, which is used when building programs from source code – that is, when compiling programs from source code.
As the title says, not all programs are compiled. Your reaction might be: Gasp “That means that the last post was a lie?” “No”, I would respond. Read on.
There are two kinds of programming languages – ones that are compiled and ones that are interpreted. (Shotts, 2019) The compiled programming languages undergo the process described in the previous post. Interpreted do not. Interpreted programming languagesare executed line-by-line. So instead of taking the whole program and translating it into zeroes and ones, then linking it and forming an executable file, a program called interpreter goes line-by-line over the interpreted language’s source code and executes it as it encounters each line of the source code.
Interpreted languages are generally slower than compiled languages.
Hope you learned something new!
References
Shotts, W. (2019). The Linux Command Line, Fifth Internet Edition. Retrieved from http://linuxcommand.org/tlcl.php. Pages 375-376
In this article, I will mention a couple of key terms related to the Linux desktop. (Ward, 2014)
The first one is the X Window System. It is just a framework – think of it as “bare bones” of a GUI (Graphical User Interface) environment. It is up to other programs to build upon this “bare bones” and construct the graphical user interface. (“X Window System,” n.d.)
Desktop environment is a package that allows for cooperation of different applications in a graphical sense. For example, application A tells application B that it is 50% done with a certain task and the application B displays that on its status bar. GNOME and Unity are examples of a desktop environment.
Some other terms and their explanations: Window managers arrange windows on the screen and provide interactive decorations like title bars that allow the user to move and minimize windows. Common elements on desktop applications (such as buttons and toolbars) are called widgets. Toolkits are used to provide widgets because that speeds up development.
That’s it for this post. I never dug really deep into Linux desktop, but if you ever encounter any one of these terms, I hope you have some more clarity as to what they mean.
Hope you learned something useful!
References
Ward, B. (2014). How Linux Works: What Every Superuser Should Know (2nd ed.). No Starch Press. Pages 297-299
In this article, I will mention a couple of key terms related to the Linux desktop. (Ward, 2014)
The first one is the X Window System. It is just a framework – think of it as “bare bones” of a GUI (Graphical User Interface) environment. It is up to other programs to build upon this “bare bones” and construct the graphical user interface. (“X Window System,” n.d.)
Desktop environment is a package that allows for cooperation of different applications in a graphical sense. For example, application A tells application B that it is 50% done with a certain task and the application B displays that on its status bar. GNOME and Unity are examples of a desktop environment.
Some other terms and their explanations: Window managers arrange windows on the screen and provide interactive decorations like title bars that allow the user to move and minimize windows. Common elements on desktop applications (such as buttons and toolbars) are called widgets. Toolkits are used to provide widgets because that speeds up development.
That’s it for this post. I never dug really deep into Linux desktop, but if you ever encounter any one of these terms, I hope you have some more clarity as to what they mean.
Hope you learned something useful!
References
Ward, B. (2014). How Linux Works: What Every Superuser Should Know (2nd ed.). No Starch Press. Pages 297-299
To connect to a remote host (remote computer), use ssh. (Shotts, 2019) ssh will allow you to use the command line as if you were physically present on the other computer’s Terminal. The computer you are connecting to needs to run ssh server and you need to be running ssh client.
if you want to connect with a different username other than the username on your local machine.
Note: You most likely won’t be using this if you are a desktop user, but if you are a programmer, you will most likely at least sometimes be required to connect to a machine remotely.
Thank you for reading!
References
Shotts, W. (2019). The Linux Command Line, Fifth Internet Edition. Retrieved from http://linuxcommand.org/tlcl.php. Pages 234-238
If you ever need to edit connections, you can use nmtui. It came preinstalled with my Debian 10. It allows you to set your IP, among other things. I used it only once, but if you want more information, (and you can assume what I will say next) Google will give it to you.
The traceroute command is used to see the route of a packet sent from your computer to the destination computer. (Shotts, 2019) Remember, packets are just small chunks of data sent over the computer network.
traceroute to www.google.com (172.217.16.100), 30 hops max, 60 byte packets
1 speedport.ip (192.168.1.1) 4.490 ms 5.863 ms 7.275 ms
2 172.27.99.1 (172.27.99.1) 12.774 ms 15.713 ms 18.709 ms
3 172.28.238.67 (172.28.238.67) 21.826 ms 25.468 ms 26.822 ms
4 hdr11-gut21.ip.t-com.hr (195.29.224.145) 30.081 ms 33.572 ms hdr11-gut21-2.ip.t-com.hr (195.29.225.121) 35.273 ms
5 gtr11-hdr11.ip.t-com.hr (195.29.3.46) 37.511 ms 40.042 ms 42.717 ms
6 72.14.204.128 (72.14.204.128) 51.135 ms 13.224 ms 13.562 ms
7 74.125.242.241 (74.125.242.241) 17.242 ms 74.125.242.225 (74.125.242.225) 19.994 ms 22.164 ms
8 72.14.239.195 (72.14.239.195) 23.811 ms 27.805 ms 72.14.239.201 (72.14.239.201) 32.334 ms
9 bud02s25-in-f4.1e100.net (172.217.16.100) 32.541 ms 33.624 ms 35.218 ms
We can see all of the points that my packets visited until it finally reached www.google.com. If you were to see asterisks (*) instead of concrete information in any of the steps, that means that the router (the part of the networking hardware that routes the packets) is configured not to give away identifying information. Here this is not the case.
Thank you for reading!
References
Shotts, W. (2019). The Linux Command Line, Fifth Internet Edition. Retrieved from http://linuxcommand.org/tlcl.php. Pages 227-228