How To Create User Accounts in Unix

If you want to quickly create a new user account in your Unix OS, it ca be done with just one line

Adding new user accounts in Unix

To create a basic Unix user account with default settings, you need to know only one thing: the username.

The reason I say it as one word is because username (quite often referred to as "login") is not the actual name of the new person gaining access to your Unix system, but rather a single keyword uniquely identifying this user in your system. Most often, usernames are derived from real names of users – jsmith, johns or smithj for John Smith, just to give you a few examples.

The simplest way to add a new user to your system is to do run a command like this:

ubuntu# useradd jsmith

[Read more…]

New section on this blog: Unix Commands

I've just integrated a new section: Unix Commands. The long-term plan is to have a categorized list of commands with most common usage documented in my typical easy-to-follow examples.

So far, there's not much, but I will referer to this section a lot in my future posts and its pages will have more examples for a particular Unix command compared to the original Unix Tutorial post where such a command is mentioned.

Have a look for yourself:

  • Unix Commands – the main index
  • Basic Unix commands – like it says, they really are basic. If you can think of something else which should be part of it, let me know
  • Advanced Unix commands – to Unix gurus they'll seem basic as well, but my only guidance so far was that commands there will be the ones you don't have to use on a daily basis. As I add more pages, this section will most likely become something like "Most common Unix commands" and a set of really advanced commands will be added.

Let me know what you all think, and if there are some immediate candidates for any of the section – let me know and I'll add them to my list!

Confirm the Day of the Week Based on a Timestamp

I recently created a Unix Questions and Answers page, if you have a Unix question – feel free to ask it there using the submit form and I'll do my best to help you out.

Today's Unix question is this:

How can we write a shell script in unix to find the day of the week when date is given?

The solution for this is even simpler: there's no need for Unix scripting, all you need is to have GNU date command at your disposal. I've already shown you all the basic date/time calculations using this great tool, and that's just another way of using it.

How to find a Day of the week based on timestamp

All you need is to know the base date. Let's say I'm interested in October 16th, 2009. Here's how easy it is to confirm that day will be Friday:

ubuntu$ date -d "Oct 16 2009" "+%a"

That's it – enjoy!

See also:

How To Update atime and mtime for a File in Unix

If you remember, all files and directories in Unix filesystems have three timestamps associated with them – atime, ctime and mtime. Since questions about modifying access time (atime) and modification time (mtime) are quite frequent in my website logs, I thought I'd explain how it is done.

How to view atime, ctime and mtime

Before we go any further, I'd like to remind you that using stat command is probably the easiest way to look at all the three timestamps associated with each file:

[Read more…]

Today Only: Grab Your 100% Free Copy of CrossOver Pro

CodeWeavers are giving their award-winning CrossOver software for free.

What is CrossOver?

CrossOver is a tweaked and polished, proprietary version of Wine – an implementation of Windows API for Unix. Simply put, it's a software which allows you to run Windows applications on your Unix system. Wine, especially since the 1.0 release, is quite a pleasant and reliable way of running Windows software on your Unix desktop, but CrossOver is known for putting many more tweaks on top of the features implemented in Wine, mostly to make popular office packages (Microsoft Office) and games work even better in emulated environment.

CrossOver Pro For Free

For one day only, October 28th 2008, you can go to the CodeWeavers website to request your free registration key for the professional version of their CrossOver software suite – either for Linux or Mac. These are fully functional serial keys for the pro version, technical support included.

The trick is that you need to have this key activated as soon as possible! Originally, you were only given time until midnight, but it is now promised that you'll get another 48hours to activate your key, although free registration keys will stop after 23:59 PM Central Standard Time.

Wait no more – the main CodeWeavers website is already down due to traffic, but Free CrossOver Pro registration form is still available!

See also:

How To Remove Files and Directories with Special Characters

Today is going to be a practical tip. If you're managing many Unix systems, sooner or later you come across files with special characters – they can't be deleted with rm command using standard approach and require a bit of trickery to be successfully removed.

Examples of files with special characters

Any language apart from English will probably have special characters in the alphabet, but for the purpose of today's exercise I'll give you more standard examples: files starting with dash (-) and hash (#) characters:

ubuntu$ ls -al
-rw-r--r-- 1 greys admin    0 Sep 25 05:50 #try
-rw-r--r-- 1 greys admin    0 Sep 25 05:48 -try

[Read more…]