If you work with a lot of files, you often save the files with numbers for each system.
For example,
1sample.out
2sample.out
3sample.out
4sample.out
......
......
......
......
10sample.out
11sample.out
12sample.out
.......
.......
Nsample.out
Suppose, you want to extract some information from these files in order from 1sample in order. If you type 'ls', the file 10sample.out will be listed first. You will get list as follow. So the extracted info will be different from what you expect as follow.
10sample.out
11sample.out
12sample.out
......
......
15sample.out
1sample.out
2sample.out
.....
.....
Nsample.out
To order file names based on the numbers in the file, use 'ls -v"
Now, the files will be ordered properly.
So, to list the files based on the numbers, use:
ls -v *.out [to list files with extension .out]
This is a series of post on the "Efficient use of Linux" as well as "Linux Tips for beginners" series. To see all the post, click the link on the right side.
Using ls command to list all the files in the current directory recursively:
Use:
ls -R
This will list all the files int he current directory recursively.
No comments:
Post a Comment