Saturday, 8 September 2012

UNIX: Create directory and view files in ascending and descending order

Question 1: Create a directory in UNIX
Answer:
bash -3.2$ mkdir newFile

The above command creates a new directory with name 'newFile' 

Question 2: How to see files in a directory in ascending and descending order ?
Answer : 
bash -3.2$ ls -l
This command displays the files in a directory

bash -3.2$ ls -lt
This command displays the files first which are recently added and then older files. ( like 10AM, 9AM , 8AM ) in this order.

'-lt' means sorted by time

bash -3.2$ ls -ltr sorted by time in reverse order

In the below screen shot please see the time of the files.
See the green arrows to locate the commands.



No comments:

Post a Comment