The ip command is used to display information about network interfaces (among other things). (Shotts, 2019) Your network interface is the hardware within your computer which allows it to communicate via a computer network.
Here is an example of the ip command:
mislav@mislavovo-racunalo:~$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
inet 192.168.1.3/24 brd 192.168.1.255 scope global dynamic noprefixroute wlp3s0
valid_lft 81396sec preferred_lft 81396sec
inet6 fe80::5ce3:3fee:50bf:4d6f/64 scope link noprefixroute
valid_lft forever preferred_lft forever
First note that I have 3 network interfaces – each start with numbers 1 to 3. Also note that, in their first line, they have the keyword state following the word UNKNOWN, UP or DOWN. UP means that the interface is currently enabled. If you want to know your IP address, look up the inet field of the interface (before the forward slash). My IP address is 192.168.1.3. This is my local IP address, not my global IP address. You can Google “how to find out my global IP address” if you ever need to find your global IP address.
A side note: The ifconfig command was used for the purpose of finding out your local IP address before, but now it has been depracated. I couldn’t have used it on my Debian 10.
Thank you for reading!
References
Shotts, W. (2019). The Linux Command Line, Fifth Internet Edition. Retrieved from http://linuxcommand.org/tlcl.php. Pages 228-229
A quick word on time in Linux – incorrect time can cause web browser issues. (“How to troubleshoot time related errors on secure websites,” n.d.) Many distributions support using the NTP (Network Time Protocol) daemon to maintain the time using the remote server. (Ward, 2014) You can also mangle with timezones, but I never needed this. My advice: Don’t mangle with time unless you really need to (such as when you find the error above). I never had to.
Today let’s talk about scheduling tasks (to run periodically). cron is used for this, as well as at. at is for one time jobs, while cron is for jobs that should re-occur in the future consistently. I never used any of these, as I never needed to schedule something. This is just for you to know where to look if you ever need to schedule something.
There are efforts underway to replace cron with parts of init which are responsible for scheduling tasks, so look into that as well when pondering scheduling tasks. (Ward, 2014)
Thank you for reading!
References
Ward, B. (2014). How Linux Works: What Every Superuser Should Know (2nd ed.). No Starch Press. Pages 159-161
I wanted to make a quick note to say that whenever you encounter an issue or want to configure something, use Google to find what file in particular you are editing. I mentioned some files I deem are sort of foundational to know (such as /etc/passwd), but I think that in 2020. it is reasonable to assume that you have access to the World Wide Web and that you can use Google to answer queries such as “How can I modify systemd startup services” or similar.
In the language of optimization, no need to over-optimize for the goal of knowing about Linux. Know just enough to be confident that you have the major pieces of the puzzle and know how they work, but if a particular detail pops up use Google to solve 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
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.
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
When you want to shut down your system, the following happens: (Ward, 2014)
init asks every process to shut down
If some processes (or a process) don’t respond, init initiates a kill with a TERM signal
If some processes (or a process) don’t respond still, init initiates a kill with a KILL signal
The system makes preparations for a shutdown
The system unmounts all of the other filesystems other than root
The system remounts the root filesystem in read-only mode (meaning you can’t write, only read)
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.))
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.