Using Cut With Date Command

Cut Chop Dice

If you want to get the time without the other date info, use 'cut' command. You can cut fields to eliminate data you don't want displayed.

When you give the 'date' command it normally prints time and date. The output looks like this:

$ date
Sun May 15 13:15:36 BST 2011

If you only want to print the time, use 'cut' with -c.

$ date | cut -c 12-19
13:15:46

Here we pipe 'date' output to 'cut' and cut everything except columns 12 - 19.

We only get the time to display.

Try it on text strings.

Done!

Copy Home Directory

Home Sweet Home

If you want a quick 'n' easy way to copy your home directory to another disk, or just to copy a bunch of files effortlessly, use the following command:

cp -avx /home /new/path

This will copy everything in your home directory including hidden files.

It will retain file ownership and creation data.

You can also use tar to copy /home

Use the following command:

(cd /home; tar cf - .)|(cd /new_home; tar pxvf -)

This does the same as cp -a

Preserving mode, time, ownership, and other data. It also copies symlinks, hidden files and subdirs.

Thats about it!