Tag: Computer

  • Linux Tutorial Series – 167 – The traceroute command

    Here is the video version, if you prefer it:

    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.

    An example of its usage:

    mislav@mislavovo-racunalo:~$ traceroute www.google.com

    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

  • Linux Tutorial Series – 166 – The ping command

    Here is the video version, if you prefer it:

    The ping command is used to check if your Internet connection is working properly.

    Here is its syntax: (Shotts, 2019)⁠

    ping internetAddress

    An example:

    mislav@mislavovo-racunalo:~$ ping www.google.com

    PING www.google.com (172.217.16.100) 56(84) bytes of data.

    64 bytes from bud02s25-in-f4.1e100.net (172.217.16.100): icmp_seq=1 ttl=55 time=14.2 ms

    64 bytes from bud02s25-in-f4.1e100.net (172.217.16.100): icmp_seq=2 ttl=55 time=16.9 ms

    ^C

    --- www.google.com ping statistics ---

    2 packets transmitted, 2 received, 0% packet loss, time 3ms

    rtt min/avg/max/mdev = 14.244/15.552/16.861/1.314 ms

    Focus on the 0% packet loss here. If it was 100% packet loss, then I would know something is wrong with my network.

    Thank you for reading!

    References

    Shotts, W. (2019). The Linux Command Line, Fifth Internet Edition. Retrieved from http://linuxcommand.org/tlcl.php. Pages 226-227

  • Linux Tutorial Series – 161 – Printing – how I do it

    Here is the video version, if you prefer it:

    There is an entire chapter in (Shotts, 2019)⁠ dedicated to printing, but let me tell you how I print the things I want to print. I just use the GUI of the app that I am viewing the file in. I advise you to do the same. Now, could there potentially be a situation where you are accessing a Linux machine remotely and you need to print something out and you can’t use a GUI? Sure. But, I’ve never encountered it so far and I think that using Google in that particular situation would help you.

    Hope you learned something useful!

    References

    Shotts, W. (2019). The Linux Command Line, Fifth Internet Edition. Retrieved from http://linuxcommand.org/tlcl.php. Pages 361-373

  • Linux Tutorial Series – 160 – Checkpoint

    Here is the video version, if you prefer it:

    In the upcoming posts, we will talk about a whole bunch of things – printing, scheduling tasks, computer networking and building a program from source.

    We won’t cover any of those (except building a program from source) in much detail. The reason is because I either haven’t used it as much and thus feel that the topic is not as relevant to everyday use or the topic is very broad and I narrowed it down to the very basics.

    An interesting mix coming up. Focus on the computer networking chapter most, followed by building a program from source. Feel free to quickly read the other things.

    Talk soon!

  • Linux Tutorial Series – 158 – Shutting down your system via the command line

    Here is the video version, if you prefer it:

    If you ever want to shut your system down via the command line, here is how it is done: (Ward, 2014)⁠

    shutdown -h now

    If you want to restart your machine, execute this:

    shutdown -r now

    In order to delay the shutdown or the restart, write this (this is the shutdown case):

    shutdown -h +numberofMinutes

    I usually shut down my computer via the GUI, but there may be some situations where you might have to shut down the computer via the command line (such as when accessing a computer remotely, for example).

    Hope you learned something new!

    References

    Ward, B. (2014). How Linux Works: What Every Superuser Should Know (2nd ed.). No Starch Press. Pages 144-145

  • Linux Tutorial Series – 157 – Shutting down your system – what goes on

    Here is the video version, if you prefer it:

    When you want to shut down your system, the following happens: (Ward, 2014)⁠

    1. init asks every process to shut down
    2. If some processes (or a process) don’t respond, init initiates a kill with a TERM signal
    3. If some processes (or a process) don’t respond still, init initiates a kill with a KILL signal
    4. The system makes preparations for a shutdown
    5. The system unmounts all of the other filesystems other than root
    6. The system remounts the root filesystem in read-only mode (meaning you can’t write, only read)
    7. The system writes out all of the data left over in the buffers to the filesystem (this happens during the remounting process; see (“Is the root filesystem unmounted during a Linux shutdown?,” n.d.)⁠)
    8. The kernel reboots or stops the system

    My 2 cents – just know this conceptually. The only case where you will need to go deep into the details of this will be if you need to optimize something on a Linux machine (most likely you would be doing this professionally), if you need to know the details to accomplish some other task or if you are really really curious.

    Hope you learned something useful!

    References

    Is the root filesystem unmounted during a Linux shutdown? (n.d.). Retrieved February 13, 2020, from https://unix.stackexchange.com/questions/298216/is-the-root-filesystem-unmounted-during-a-linux-shutdown

    Ward, B. (2014). How Linux Works: What Every Superuser Should Know (2nd ed.). No Starch Press. Pages 144-145

  • Linux Tutorial Series – 156 – init

    Here is the video version, if you prefer it:

    As we already learned, init is important because it is a part of the booting process, as well as a part of the user space startup process. Here we talk a little bit more about init.

    init is the process which starts all system services. (Shotts, 2019)⁠ init always has a PID of 1. A lot of the services which init starts are called daemon programs – programs that don’t have any user interface and do their thing in the background.

    A thing to review, if you forgot – when talking about processes in general, we can say that a parent process spawns a child process. That means that the programs that init starts are its child processes and init is the parent process.

    That’s it about init. Nothing too fancy. It starts a lot of essential system services (which are daemons).

    References

    Shotts, W. (2019). The Linux Command Line, Fifth Internet Edition. Retrieved from http://linuxcommand.org/tlcl.php. Pages 134-135

  • Linux Tutorial Series – 155 – User space startup

    Here is the video version, if you prefer it:

    Let’s talk about how the user space starts up. To remind ourselves, there is the user space, which “regular” users can access and there is the kernel (system) space, which “regular” users can’t access. If they try to, the operating system doesn’t allow them to.

    Here is roughly how the user space starts up: (Ward, 2014)⁠

    1. init
    2. Essential low-level services which enable managing hardware devices and system logging
    3. Network configuration
    4. Mid and high-level services (such as cron (used for scheduling tasks) and printing)
    5. Login prompts, GUIs, and other high-level applications

    To remind ourselves, init is the process with the PID of 1, with which it all begins. I hope you now see why this holds – because init has the PID of 1 and it is the first step here. It is also speculated that init is how the universe was made, albeit scientist are not yet sure.

    Hope you learned something useful!

    References

    Ward, B. (2014). How Linux Works: What Every Superuser Should Know (2nd ed.). No Starch Press. Pages 111-112

  • Linux Tutorial Series – 154 – Viewing kernel messages

    Here is the video version, if you prefer it:

    The dmesg command is used to display kernel messages. (Ward, 2014)⁠ You use this command when you want to see if a kernel is giving you an error for a particular hardware device, for example.

    An example:

    mislav@mislavovo-racunalo:~/Linux_folder$ sudo dmesg

    [2344706.157876] x86: Booting SMP configuration:

    [2344706.157877] smpboot: Booting Node 0 Processor 1 APIC 0x2

    [2344706.158274] cache: parent cpu1 should not be sleeping

    [2344706.158419] CPU1 is up

    [2344706.158436] smpboot: Booting Node 0 Processor 2 APIC 0x4

    [2344706.158833] cache: parent cpu2 should not be sleeping

    [2344706.158987] CPU2 is up

    dmesg gives a lot of output, so be prepared. You can pipe it and use less to read through it, for example, or redirect its output in a file.

    Another way to look at kernel messages (besides dmesg) is by looking at the contents of a file which is located in /var/log/kern.log. (Ward, 2014)⁠ Keep in mind that catting this file will produce a lot of output.

    Thank you for reading!

    References

    Ward, B. (2014). How Linux Works: What Every Superuser Should Know (2nd ed.). No Starch Press. Pages 94-95

  • Linux Tutorial Series – 153 – Boot loaders

    Here is the video version, if you prefer it:

    Boot loader’s job is to start the kernel – that is, to load the kernel into memory and start the kernel with a set of kernel parameters. (Ward, 2014)⁠ Kernel parameters are text-based parameters that tell the kernel about how it should start. Boot loader also selects among multiple kernels, switches between sets of kernel parameters, allows users to meddle with the kernel parameters and kernel images and provides support for booting other operating systems.

    One of the most popular boot loaders is GRUB, short for Grand Unified Boot Loader. So, if you ever see some errors related to GRUB, you now know: “Oh, it’s my boot loader that’s the problem”.

    To be honest, I never had to deal with boot loader problems, but I imagine they must be bad. May the force of Google help you in your quest to resolve those.

    Thank you for reading!

    References

    Ward, B. (2014). How Linux Works: What Every Superuser Should Know (2nd ed.). No Starch Press. Pages 97-98