Converting date and time to Unix epoch in Perl

Today I was working on a script, and one of the subroutines needed simple seconds-based arithmetics with time. As you probably remember fromĀ  my date and time in Unix scripts article, the easiest way to approach this task is to deal with the raw representation of date and time in Unix – the Unix epoch times. This post will show you how to convert standard dates into Unix epoch times in Perl.

Continue reading →

How To Monitor Linux Memory Usage with Watch Command

Hi all, today I'm going to teach you not one, but two really cool things in one post! First, I'll introduce you to advanced memory usage stats available on Linux systems through /proc/meminfo file, and then I'll explain the basics of using the watch command.

Memory usage with /proc/meminfo

As you know, quite a few Unix-like systems use the so-called pseudo file systems like /proc. It's not a real filesystem, but just a convenient representation of processes managed by your Unix OS. In Linux systems, this directory also contains quite a few files allowing you to access various information about your system. /proc/meminfo is one of such files, it gives you access to most of the memory usage stats.

Continue reading →

How To Change Ownership of Files and Directories in Unix

I've just been asked a question about changing the ownership of files from one Unix user to another, and thought it probably makes sense to have a quick post on it.

File ownership in Unix

Just to give you a quick reminder, I'd like to confirm that every single file in Unix belongs to some user and some group. There simply isn't a way to create a file without assigning ownership. I've briefly touched the topic of confirming file ownership in Unix before, so today I will simply build on that and show you how to change ownership of files.

Continue reading →

Interesting Unix reads – Feb 3rd, 2009

Hi again, here's some more Unix articles which you'll probably find interesting and useful

Unix-related releases

Useful Unix tips

If you have any useful articles you'd like to share – just leave links in the comments area.

See also:

Perl Scripting: Check If a File Exists

It's not often that I write about Perl Scripting on Unix Tutorial, but that's just because I don't script in Perl this much on a regular basis. Today, however, I'd like to share one of the building blocks – a really basic piece of functionality which you'll find really useful in almost any Perl script.

Continue reading →

List drives by UUID in Ubuntu

Having used this tip a few times myself, I'd like to share it with you: a very simple way to list all the drives in your Ubuntu system using their UUID's.

Continue reading →

Updates in Unix Glossary

Just updated the Unix Glossary section with the following definitions:

There's no way these will be final, and so I'll be updating them now and them so stay tuned. For example, the Unix definition is still not in the glossary, because I'm struggling with wording the paragraph for it. Will add next week, for sure!

Interesting Reads – Jan 22nd, 2009

Now that I'm finally back into my usual posting and reading other blogs, I think it's a good time to restart the "Interesting Reads".

Here are the Unix articles you might like:

Enjoy these useful Linux tips! If you have any useful articles you'd like to share – just leave links in the comments area.

Ubuntu Upgrade: From Hardy Heron to Intrepid Ibex

I've been upgrading Ubuntu installations quite a few times recently, and thought it makes sense to post a really short how-to if you ever want to upgrade your Ubuntu distro from the command line.

Use apt-get to upgrade Ubuntu

The procedure for upgrading one Ubuntu release to another one is pretty straightforward. There are some rules though:

  1. Never attempt to skip a release or two when upgrading
  2. Never do a few Ubuntu release upgrades in a row without reboots in between
  3. Always backup the files you change
  4. Always have an install CD for your current Ubuntu release around

Continue reading →

New section added: Unix Glossary

I've just created another section on Unix Tutorial – the Unix Glossary, which is a section I'm going to use for listing definitions to all the topics I briefly touch in my regular posts.

So far, there's only one item there – runlevel definition. Obviously, it's a work in progress, so I'll be updating definitions constantly and expanding the section as I post more.

The plan is to have a Unix Glossary section at the bottom of each post on Unix Tutorial, so that it gives you another chance to expand your understanding of Unix basics.

If you have any terms from Unix world which you'd like me to cover first, please head over to the Unix Glossary page and leave a comment there with your suggestions.

Let me know what you think about this, do you think it will help? If there's any other side of this blog you'd like changed or improved – just let me know. I'm using this blog as my own reference all the time, so I always appreciate your feedback as it makes life easier and Unix Tutorial better for everyone.