Skip to main content

7.3) More Options (cont'd)


If you want to use more than one option then you can do this easily. The ‘-t’ option for the ls command makes the listing of files in order of most recent to least recent. To use it with the ‘-l’ command type:
ls -lt
Compare this to the ls –l command and ensure you see that the files are now reordered so that the most recent are at the top of the page and least recent at the bottom.
Almost all Unix commands have options. You have been exposed to some of the ls command options above. Below are other commands with options. For example, if you want to remove a file called 'oldfile' then you can type:
rm oldfile
And you Unix system may ask you to confirm you want to remove the file. If you want to force it to remove the file without any additional confirmation, then type:
rm -f oldfile
If you type man rm then you will see a listing of all the options that are available. You can type this for any Unix command you like.
In general, Unix commands all have the form of:
command [options] [file or directory names if required]
Tip

If you have more than one option that you want to use then include them both.    For example, if you want to use the -l and -t option with list then use:
ls -lt
or
ls -l -t