How To: Get CDROM/DVD Information From The Linux Terminal

In today’s article, we’re going to learn how to get CDROM/DVD information from the Linux terminal. What we’ll be doing is getting hardware information. It should be a brief article, as we’re just going to cover two commands.

I won’t even need to detail the various options, as we’re just after the hardware information. I’d say it’s going to be a short article, but that has a way of blowing up in my face and those articles sometimes end up longer than the “regular” articles! You get what you get. If  you don’t like it, write an article or two for me!

This particular article is actually based on one of my unix.stackexchange.com answers that didn’t get much notice, even though it was the accepted answer. Frankly, in modern days there’s not much need to know this information, as optical disks become a thing of the past. I decided to place the content here, hoping it’s easier for people using search engines. People still use optical media.

As you may know, most of my traffic comes from search engines. That’s the primary motivation for moving this answer here. I’m also motivated by laziness! I want a nice and easy day, for reasons I’ll probably detail in the next meta article. I also want it more easily indexed.

If you don’t know much about your CDROM/DVD player/recorder, then this would be a good article for you. In fact, even if you do know the basics, this is still probably a good article for you. You can learn a lot with a few simple commands. You’ll see…

So then, let’s learn how to get CDROM/DVD information from the Linux terminal. Sure, there’s probably a GUI way to do this, but let’s just stick to the terminal – after all, every Linux user has a terminal available. Plus, I don’t know a GUI method.

How To: Get CDROM/DVD Information:

In today’s article, we’re going to learn how to get CDROM/DVD information from the Linux terminal. What we’ll be doing is getting hardware information. This will require an open terminal. So, to open a terminal, just press CTRL + ALT + T and your default terminal should open.

With your terminal now open, you may need to install the first application we’ll be using. The first application we’ll be using is ‘wodim’, an application used to write data to an optical disk. If you’re using a major distro, it’s in your default repositories. If you’re using apt, then install it with:

Of course, adjust that command to suit the distro you’re using, be it yum or even zypper. Then, run the following command:

Consult the output. That’s it. It should be obvious. Also, if you get any errors from this command, along with the second command I’ll share, remove any disks from the drive. 

For the second command to find CDROM/DVD information, and cdrecord is more likely to be installed by default, you need only to use this command:

Note the similar flags. It’s pretty much the same as you’re going to get with wodim, except cdrecord has a chance of being installed already. I don’t think I’ve come across a distro with wodim installed by default, but I could be wrong. I have come across distros with cdrecord installed by default. So, there’s that.

If I’m wrong and a distro exists with wodim installed by default, be sure to yell at me in the comment section! I’ve been wrong before, so this won’t be a first. I’m a big boy, I can handle it! Also, I’m kinda curious, so please do let me know in a comment.

Anyhow, enjoy the output from either command. They’ll tell you a bunch of information about your optical drives. Both of the commands will help you get CDROM/DVD information. Pick the one you like best and run with it. It’s your computer, you do what you want!

Closure:

As you can see, it’s pretty easy to get CDROM/DVD information from the Linux terminal. As you can also see, you have yet another article! There sure have been a lot of ’em. Again, I reach out to see if you’d like to write an article. I sure could use a break! We’ll soon cross the 300 articles mark! I am very grateful to those who have already helped. 

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: Compress And Decompress .bz2 Files

In today’s article, we’re going to discuss how to compress and decompress .bz2 files. This is something you may eventually need to know, so I’ll cover it here. I’ll just cover the basics, as most folks won’t need to know anything more than the basics. This should actually be a fairly short and direct article. There’s not a whole lot to it.

If you don’t already know, .bz2 files are bzip2 files. You’ll find that bzip2 is an opensource compression program that gets some regular usage, and you’ll sometimes find downloaded files that are compressed with this format. You may also, for compatibility reasons, want to compress files with bzip2 to share with other users who are already set on using the .bz2 format.

For the curious, the bzip2 man pages define this particular application as (and, as always, I highly encourage folks to read the man pages themselves – this one being a bit more complicated than others):

bzip2, bunzip2 – a block-sorting file compressor

Again, we’re going to just cover how to compress and decompress .bz2 files in this article. That’s all we’re going to do. You don’t tend to come across too many files compressed with bzip2, but they do show up from time to time.

Because of that, we’re going to cover how to compress and decompress those files in this article. It’s gotta get covered eventually, so it might as well be now. Read on!

Compress And Decompress .bz2 Files:

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.

You might actually not have bzip2 installed. It’s not always installed by default. Fortunately, as far as I can tell, it shares the same name in every major distro, that is ‘bzip2‘. So, just go ahead and install it like you’d install any other software. For example, if you’re using Fedora, your command would look similar to:

See? I didn’t use Ubuntu as the default example! We’re mixing everything up today! (Use apt if you’re using a distro with apt, like Debian or Ubuntu and derivatives.)

At this point, you should probably have a .bz2 file to work on for the sake of the article. Seeing as I have no idea what you’ve already downloaded, we should probably start with you making one – just so you can see how to decompress it. 

To compress a file with bzip2, the command looks like (See the detailed warning below this command, do not use this command without reading the warning!):

That will create a file with the same filename but make a .bz2 file. However, this is a destructive act. If you use the above command, the original file will be deleted! If you wish to keep the original file, you need the -k (keep) flag. That looks like:

That command will not remove the original file, as would be the default. Obviously, the -z flag means ‘zip’.

If you want to decompress a file with bzip2, the command looks like:

This will extract the file(s) into the current directory. Of course, the -d means ‘decompress’. This is not a destructive operation. The original and extracted files will remain on your file system.

As you can see, it’s not all that difficult to compress and decompress .bz2 files. You might go years not seeing any files in that format, but you’re eventually going to bump into one and now you know  how to deal with it in the terminal – and how to respond in kind.

Closure:

And there you have it. You have yet another article. We’re getting close to 300 articles at this point, so it has been a long journey. If you feel like writing an article, let me know! Anyhow, you can now compress and decompress .bz2 files easily enough, and that was the point of the article.

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.

Some Fun With Sorting The Output Of ‘ls’

Today’s article will be relatively short and easy, as we have some fun with sorting the output of ‘ls’. It’ll be a pretty short and simple article, but that doesn’t mean it’s not useful. Read on and learn about sorting the output of ‘ls’!

The last article I wrote was:

Some Fun With Formatting The Output From ‘ls’

This article will be remarkably similar, but isn’t about formatting the output of ‘ls’, it’s about sorting the output of ‘ls’. Yes, there is a difference! This is useful for a variety of reasons, but it’s mostly useful for viewing your files categorically. There are just a handful of sorting options, but we’ll cover them all.

Like always, it’s important to know that you should not to parse the output of ‘ls’. Parsing the output of ‘ls’ if full of risks, so you shouldn’t do it! The link explains it better than I can, and it tells you what to do instead of parsing the output of ‘ls’.

Obviously, and again, we’ll be using the ‘ls’ command. The ‘ls’ command defines itself fairly accurately as:

ls – list directory contents

So, just like the last article, there’s no real reason to make the intro longer than it needs to be. Let’s just jump right into the article.

Sorting The Output Of ‘ls’:

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 now open, you can stay right there in your /home directory, or you can ‘cd‘ into a directory of your choice – preferably one with a variety of files in it.

When you’re done picking a directory, you have the following choices:

See? I even alphabetized them for you! The list of what they do should be fairly obvious, with ls --sort=version being the most unusual and only applying to versioned files.  Also, while included, there’s not a whole lot of reason to use ls --sort=none, as that’s just the default output.

I find sorting by time to be pretty handy, as well as sorting by size. I don’t have much of a reason to use the rest, but they’re there if you need them. I figured I’d include ’em all, rather than just those that I find useful.

Closure:

There you have it, another short article! It’s also another article about the ‘ls’ command, but this time we’re sorting the output of ‘ls’. I figured I’d do this article right after the other one, mostly so that I’d remember to actually cover 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.

Some Fun With Formatting The Output From ‘ls’

Today’s article will be a nice and simple one, in which we’ll have some fun with formatting the output from ‘ls’. It’s just a quick article today, as there’s no real reason to make this all that difficult. Read on, my dear readers!

While it’s true that you shouldn’t parse the output from the ‘ls’ command, you can format it to get an output that more suits your needs. You might want to do this to more easily understand the output from ‘ls’. There are a half dozen or so formatting options and we’ll show them all to you in this article. One (or more) of them might tickle your fancy.

Obviously, we’ll be using the ‘ls’ command. The ‘ls’ command describes itself like this:

ls – list directory contents

Which is exactly what it does. It’s not a very complicated command, as far as some commands go, but there are a lot of options. Like always, I highly suggest that you read the man page (man ls) to get more information than will be contained in this article.

Anyhow, I said this will be a short article, so I will just get right into the meat of the article instead of typing a bunch of additional fluff. You’re welcome!

Formatting The Output From ‘ls’:

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 now open, you can choose to view the output of ‘ls’ with a variety of formats. They’re more or less self-explanatory, so I’m just going to show them all to you. If you’re confused by any of them, try them in your terminal, which will should make it more clear.

I even made you an alphabetized list! See? I am helpful today!

So, for ls --format=across you’ll get the output spread across your screen (as much as possible). If you use ls --format=comma, the files will be separated by a comma.

Out of all of them, I tend to use ls --format=verbose more often than I use any of the other ways of formatting the output from ‘ls’. It gives me just enough information, from file modification date and time to the file’s permissions. So, out of all of them, that’s the one I’ll use most often. 

Feel free to flip through and try them all. You’re bound to find something interesting in there. The ‘ls’ command is surprisingly useful, and it’s harmless enough for you to explore it at length.

Closure:

See? I told you that it’d be a pretty short article today. I just showed you some ways of formatting the output from ‘ls’ and that’s all I’ve done. There’s no reason to make this longer than necessary. I think my readers are smart enough to take it from here, and figure out what they like most, or find the most useful.

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.

Find Files Modified On A Specific Day

In today’s article, we’re going to do exactly what the title says, we’re going to find files modified on a specific day. Imagine that! We’re doing what it says in the title! I dunno why I write the things I do. But, I do have quite a few people reading, and hardly any of ’em complain!

So, why would you want to do this? Well, let’s say Big Bad John logged into your system on Friday. He was fired for drinking at lunch, but still had access to the system for another hour before security got around to hauling his butt out of the building.

Wouldn’t you like to know what files were changed on his computer that day, just to see if he’d done anything malicious? You might also have some weird system errors and want to know what files have changed today so that you can narrow down your search for the culprit. There are all sorts of reasons why you might want to know how to find files modified on a specific day.

We’re going to be using a simple command, and just one command. We’ll be using the ‘find’ function. There are surely other ways to do this, but we’ll use the find command. It works and it means you have a relatively short article.

How To: Find Files Modified On A Specific Day:

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 now open, let’s say you want to find files edited on the day this article is published. To do that, you’d run this command:

For the sake of simplicity, the format is YYYY-MM-DD. You could use other date formats that are recognized by the system, but we’ll just stick to this date format as it’s nice and easy.

Now, you can also adjust your ‘maxdepth‘ value. If it’s a 1, it will dig down one directory deep. So, if you’re in your home directory, it’ll dig into ~/Downloads, ~/Pictures, ~/Documents, etc… If you change it to 2, it’ll dig into the sub-directories, like ~/Downloads/foo and ~/Documents/bar.

If you want to find files modified on a specific day, simply change the date in the command and start searching. It’s handy if you edited a file and can’t recall which file it was you edited. The command can be used for all sorts of things like that. Good luck!

Closure:

There you go… You have another article and this one teaches you how to find files modified on a specific day. It’s a short article with just one command. There’s no reason to pad the article further. It’s just the one command. Thanks for reading!

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.

Subscribe To Our Newsletter
Get notified when new articles are published! It's free and I won't send you any spam.
Linux Tips
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.