Unix commands

What is the unix command that will display the current UTC time, hours, and minutes only.

What is the unix command for sorting in descending order.

What is the unix command for display the first 10 characters in a file.

  1. Try

date -u '+%H:%M'

  1. This depends on what you are sorting

  2. Try

head -c 10 myfile

Please read the man pages for details.

As cbkihong posted, head -c 10 myfile will get you the first 10 chars of a file. However, if you use head and/or tail, you can get the first 10 chars of a particular line in a file.

Example

head -c 10 myfile | head -1 #cuts the first 10 chars from the first line

Charlton,

many of hte answers you seek can be found in teh man pages on any UNIX system...

IF you read the sort man page, you will see that it shows. you the options for sorting...

Here is an excerpt from the man page... the -r option reverses the sort order... -k n where n is a number sorts based upon the field number, normal delimiter is space or tab.

Sort the contents of infile with the second field as the sort key:

       sort -k 2,2 infile

  Sort, in reverse order, the contents of infile1 and infile2, placing
  the output in outfile and using the first two characters of the second
  field as the sort key:

       sort -r -o outfile -k 2.1,2.2 infile1 infile2

  Sort, in reverse order, the contents of infile1 and infile2, using the
  first non-blank character of the fourth field as the sort key:

       sort -r -k 4.1b,4.1b infile1 infile2

Where can I get info on how to use telnet?