Let’s Reboot Your Linux Computer

Today is another article with one of those things you probably already know, it’s about how you can reboot your Linux computer. Specifically, we’re going to reboot from the terminal. You can use the GUI to reboot easily enough, but if that’s frozen and you don’t really want to do a hard restart, you might as well reboot it if you can.

If you can’t reboot your computer because it appears frozen, consider the Magic SysReq Keys. (More specifically, the REISUB method.)

If you aren’t already aware, there are all sorts of ways to reboot your Linux computer. Like oh so many things in Linux, there’s a multitude of ways. We’re just going to cover a few of them, because you really don’t need to know more. Well, if you do need to know more,  you probably already know those ways to reboot your Linux computer!

It’s also another fairly simple article. That’s good (for me) as it’s a bit like work lately and I don’t want the site to really be about work but rather being about a hobby. If it’s work, I wanna get paid… 

This is also useful information if you’re working on something remote. You don’t want to shut that system down and have to have someone go physically turn it back on, so you reboot the system – making sure to reboot the right system and not the system you’re physically using. I’ve done that more times than I care to share – and I’ve done the reverse as well. It’s seldom good if you enter the reboot command and immediately follow it with a verbal, “Oops.”

Reboot Your Linux Computer:

This article requires an open terminal, because we’ll be learning how to reboot your Linux computer from said terminal. If you don’t know how to open the terminal, you can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

With your terminal now open, let’s start with the easiest of the commands to reboot your Linux computer:

With some distros, that’ll be all you need. With others, you may need to have elevated permissions. This is also often true if you’re connected remotely, via SSH. So, in those instances, you’ll need to preface it with sudo and use your password when asked. Like so:

If you want,  you can also use the shutdown command. That’s pretty easy, you can just use:

The -r flag tells the system to reboot and the ‘now‘ means to do so right now – immediately. You can play around with that ‘now’ bit, like so:

Instead of ‘now‘ you’ll see there’s a ‘1‘ and that’s how many minutes you want to wait before rebooting the system. You can change that to any number you’d like, I suppose.

Finally, you can use systemd to reboot. Why? Because of course you can! It’s systemd, and you can do anything with it! (Kinda like zombo.com, I guess.)

That’ll happily reboot your Linux computer, all nice and neat and proper. It does exactly what you’d expect it to do, so there’s that.

Closure:

There you have it. You now have a few ways to reboot your Linux computer from the terminal. There are other ways, including init or whatnot. You can also just use the GUI if you’re working locally. It’s Linux. There are all sorts of ways to accomplish a given task. That’s a good thing.

I find myself rebooting from the terminal more often than not, simply because I’ve already got a terminal open and it’s just as quick for me to type the reboot command as it is for me to go clicking around. I’m also often testing other systems and really don’t want to have to go fishing around to find the command, then click on some sort of secondary agree menu or the likes.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

How To: Make A File Executable

Today we’re going to learn something important, that is how to make a file executable. This is something everyone should know how to do. It’s not going to be easy to make this into an article, ’cause it’s really quite easy, but I’ll give it a shot.

One of the important things about Linux is that files have various permissions. You can read, write, and execute a file based on the permissions. This helps keep Linux a bit more secure, because files can’t be executed until you’ve given them permission to do so.

I’ll make this article as straightforward as I can, by trying to give you an example of how this works. We’ll create a file, make it executable, and then run said file. This should serve as a good example, so that you can do so in the future.

You’ll see a bunch of commands in this article. If you’re new, just follow ’em until the end and you’ll hopefully understand what’s going on, and see how to make a file executable. Trust me, this isn’t something all that taxing. I’m sure you can get it!

Make A File Executable:

This article requires an open terminal, like many other articles on this site. If you don’t know how to open the terminal, you can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

With your terminal open, let’s create a new file. We’ll do that with:

Open love.sh for editing with nano by using the following command:

Enter the following text:

Now, you’ll have to save that. Just press CTRL + X, then Y, and then ENTER. That will save the file with the newly added text.

Now, we’ll make the file executable with the ‘chmod‘ command. That’s done with this command:

With that done, all you need to do now is execute the file. To do that, you just call the file by name in the terminal. As you’re still in the same directory, you’ll need to use ./ – so your command actually looks like:

With that, you should get a message saying that you love Linux Tips. Aww… Isn’t that sweet of you! We love you too! It was also a fun way to create a file, edit it, make it executable, and then actually executed said file.

Closure:

See? That wasn’t all that hard. I hope that method shows you a little about how to make a file executable. It’s a pretty basic skill that all Linux users should be familiar with. It’s not a very complicated article, but that’s just fine. At least we (hopefully) had some fun with it.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

How To: Find Out When A File Was Created

Today, we’re going to learn how to find out when a file was created. Odds are good that you could use the right click menu in a GUI file manager and figure it out, or you can sort by time and show details, that sort of stuff. Those being ‘easy’ we’ll learn how to find out when a file was created in the terminal.

Yeah, a lot of these articles explain how to do things in a terminal – even when there’s a nice graphical way to accomplish those same things. While it’s true that we may have different shells, we’re far more universal in the terminal than we are in a graphical desktop environment.

It’s good to learn how to do things in the terminal. If you can accomplish your goal in the terminal – you can accomplish it quickly and easily everywhere. That’s a pretty great benefit. (It’s not even unique to Linux – as you can do a whole lot via command line in Windows and MacOS.)

Also, today’s article feels a bit like work. I was hoping that it’d take longer to really start feeling that way. It’s okay. I picked a brief subject, what should be a short article, and that’ll be almost like a day off.

Find Out When A File Was Created:

This article requires an open terminal, like many other articles on this site. If you don’t know how to open the terminal, you can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

With your terminal open, change to the directory that contains the file you want to find out when it was created. Let’s say it’s in your Documents directory:

Now, you can just use the -l flag with the ls command. That’d look like this –  showing the creation date (and maybe time, if the file is recent enough) for all the files in that directory:

That’s pretty messy, especially if you have a lot of files in the directory. So, you can specify the file for which you want to find the creation date by specifying the filename in the command itself, like so:

That’ll do it for you. Well, it should do it for you! If not, something’s broken and don’t ask me to fix it!

Closure:

There you have it… You can now tell when a file was created. It’s not a very difficult process and it’s one you can easily commit to memory. I find myself using it when I’ve created a file and then can’t find it among other files with similar names – I’ll check to wee when a file was created and figure it out that way.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Monitor rsync’s Progress

In this article, we’re going to learn how to monitor rsync’s progress. It’s a pretty trivial article, but it’s something you may want to know – especially if you’re using rsync often. Read on and learn how to monitor the progress of rsync. 

For the curious, I use rsync every day. It’s a part of what I do to beta test Lubuntu. It’s pretty handy for syncing my existing .iso with a fresh daily .iso, saving both Ubuntu and I a bunch of bandwidth.

I also use it locally. If I want to backup something like my home directory, there aren’t many better choices. Rather than mess with various applications, I can just write a simple command and can even automate it by making it a cronjob. 

However, it’s nice to get some feedback. It’s nice to see how far and how fast the syncing is taking place. It’s handy to monitor rsync’s progress. There are a couple of neat ways to do this, so I’ll show you them. 

If you don’t know, rsync is a tool used to sync files. It’s great for copying files from one location to another location. It even has some checks and balances, so it’s pretty great. By the way, the man page defines it like:

rsync – a fast, versatile, remote (and local) file-copying tool

Which I think is an apt and fair description. So, with that in mind, let’s move into the article about how to …

Monitor rsync’s Progress:

This article requires an open terminal, like many other articles on this site. If you don’t know how to open the terminal, you can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

For the most part, rsync works like so:

Now, you can just show the progress with the -av flags. The ‘a’ for “archive” and the ‘v’ is for verbose. That is a handy command. You will also need the ‘–info=progress2’ to go along with it. 

To use it, it might look something like this (to backup sync your entire home directory in this example):

See? That’ll output the progress as you go. For local stuff, that’s pretty much my ‘go-to’ command, or close enough.

But wait, there’s more!

That’s right, there’s more to know if you want to monitor rsync’s progress!

First, install ‘progress’. It’s probably not installed by default, so you’ll have to install it manually with your own package manager. For example, with apt in Ubuntu, it’s just:

With that done, it’s a tiny application, open up another terminal window – so that rsync is still happily running in your first terminal instance, and run the following command in the second terminal:

Pretty frickin’ neat, huh? You can monitor your rsync command’s progress quite easily with that command. It gives you a pretty good readout for your rsync’s progress. If nothing else, it’ll keep you amused while your data syncs. 

Closure:

Yay! Today you have another article. I still haven’t missed a day. You’ve had an article every other day for a long time now. Well, today is no different and in this article you learning how to monitor rsync’s progress – a pretty handy tool, especially for the inquisitive. 

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Let’s Take A Look At Logged In Users

Today is a good day to learn how to take a look at logged in users. The vast majority of my readers are desktop users, so you can mostly skip this article. On the other hand, when you take a look at logged in users, you might find users you didn’t know were logged in and discover a problem like unknown users.

Yeah, most of you – including me at the moment (which makes it difficult to do things like take useful screenshots) are using Linux (mostly) as a single user. You have a user and you login to that user account when you start your system up.

While you do have other system-configured users, you don’t generally login as those users. As such, you probably spend very little time thinking about the users you have. Those system users aren’t generally logged in but are there for permissions purposes, so they’re out of mind for most of us.

Well, for the rest of you, you can use this article to learn how look logged in users – even getting a glimpse at what they’re doing. I mentioned some difficulty in taking screenshots, so I’ll provide you with just one. Cherish it, as it’s the only one you’re getting!

Here it is:

looking at other users
See? I’ll reference some of this below, in the article itself. I might as well…

Have A Look At Logged In Users:

This article requires an open terminal, like many other articles on this site. If you don’t know how to open the terminal, you can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

As you can see from the image above you can see all the logged in users with the first command. The following command will list them:

You’ll see the same thing, with a bit more information, when you use the following command:

Now, in the image above, you can see where I used it once and then ran it again. What you don’t see is that, in between those two commands, I opened up another TTY and logged in again as ‘kgiii’. If you want to replicate that, just press CTRL + ALT, then F3 to F6, and login at the prompt with any user(s) you happen to have.

Finally, you can get a look at what they’re doing – like one has a desktop session open and two of those login instances just have bash sessions open in TTY sessions. To do that,  you just use:

That should be easy enough for you to remember! By the way, if you did login as an additional TTY instance, run ‘users‘ again and you’ll see the output for that command has changed accordingly. The command’s output will may also give you a good idea about how long the system has been up and what the system resources are like.

Closure:

There you have it. You have learned how to have a look at logged in users so that you can have an idea of what’s going on with your system. If you spot a user you don’t recognize, that might be indicative of a problem. If you spot a user you don’t recognize, you’ll need to do some more investigating. By the way, if you have ‘finger’ installed you can always run ‘finger <username>‘.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Linux Tips
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.