Question & Answer: Bash commands…..

Bash commands

1. Without using sort, use one unix utility to list files/subdirectories sorted my modification time

2. Without using sort, use one unix utility to list files/subdirectories sorted by file size

3. Given classlist, complete echo so output “class 2031 has x students”, where x is number of students in class
Echo “class 2031 has

4. Given classlist, complete echo so output “class 2031 has x students with name Wang or Wong”, where x is number of students in class with Wang, Wong
Echo “class 2031 has
Wang or Wong”

5. Given text file Foo, begins with single character followed by nd, as a whole word only

6. Contains a character followed by non digit, followed by capital eg exA

7. Ends with not a, b, c followed by nd

8. Contains ABC, abbc, eg a followed by one or more b, then c

Expert Answer

 

Answer:1

ls -t $(find directory1/ -type f)

Here in the above command we have used “find” command to get all the files of the directory. then we have used “ls” to list the files on the bases of the modification time.

Answer:2

The command “du -ah DIRECTORY” is being used to list all the files as well as the directories in a given directory DIRECTORY. Here in this command -h is being used to output the humane readable file size.

example: du -ah /var/abc/alpha

The above command will list all the files of the directory “var/abc/alpha” on the bases of size.

Still stressed from student homework?
Get quality assistance from academic writers!