Question

In: Computer Science

Use linux Original question: d) Use metacharacters and the ls -lL command (with lower and upper...

Use linux

Original question:

d) Use metacharacters and the ls -lL command (with lower and upper case L) to list all filenames under the datafiles directory that contain a dot '.' with the letter 'f' or 'u' anywhere after the dot.

e) Use metacharacters and a single ls -lL command (with lower and upper case L) to listall file names that contain a dot '.' followed by a lower case letter, then end with the letter 't' or 'r' as the second from last character. And these files should be from your current directory as well as any directory under the current directory that contains the letters "data".
For example: data1/a.pqrs would be a match, but dabta.Dtu and datafiles/.softdo not match.
Hint: use two command arguments, one for the current directory, and one for directories the contain 'data'.

Instructure sample output:

d)

-rwx------ 1 rpa b20003 2401 Sep 5 14:15 datafiles/famous.backup
-rwx------ 2 rpa b20003 2401 Sep 5 14:25 datafiles/famous.soft

e)

-rwx------ 2 rpa b20003 2401 Sep 5 14:25 datafiles/famous.hard
-rwx------ 2 rpal b20003 2401 Sep 5 14:25 famous.data

What I have so far:

[dfoote1$$$$$$ bin]$ ls -lL /students/dfoote1/bin/datafiles/*.*[fu]*
-rwx------ 1 dfoote1 students 2401 Sep 17 17:45 /students/dfoote1/bin/datafiles/famous.backup
-rwx------ 2 dfoote1 students 2401 Sep 17 16:15 /students/dfoote1/bin/datafiles/famous.soft
[dfoote1$$$$$$ bin]$ ls -ll /students/dfoote1/bin/datafiles/*.*[fu]*
-rwx------ 1 dfoote1 students 2401 Sep 17 17:45 /students/dfoote1/bin/datafiles/famous.backup
lrwxrwxrwx 1 dfoote1 students   33 Sep 17 17:40 /students/dfoote1/bin/datafiles/famous.soft -> /students/dfoote1/bin/famous.data

Solutions

Expert Solution

Answer d)

What ever you have done is correct.

Answer e)

ls *.[[:lower:]]*[tr]? *data*/*.[[:lower:]]*[tr]

In the above command i use * for any character as first name, then . then i[[:lower:]] means the character after . is lower case letter, then * means any character with any length, then [tr] means then second last character with either t or r, ? means the last character will be any. I give 2 times the same expression , one for current directory and other for directory contains data as the word.

Screenshot


Related Solutions

Systems Programming in Linux using C Remake the version of the ls -ialR command in C.....
Systems Programming in Linux using C Remake the version of the ls -ialR command in C.. In this version of ls, you must also consider symbolic file types. Make sure you have file header comments and function header comments. Also, write inline comments whenever necessary.
a) Observe the following Linux commands and work out what each command does: 1) $ ls...
a) Observe the following Linux commands and work out what each command does: 1) $ ls –al 2) $ /etc/profile 3) $ chmod 200 final_assignment.txt b) Consider a scenario where Bob has downloaded his messages to the local machine with an access of POP3, he can create mail folders and move the downloaded messages into the folders. Bob can then delete messages, move messages across folders, and search for messages (by sender name or subject). But this paradigm—namely, folders and...
Linux question: Take the command 'vmstat' in linux for a program, explain why the number of...
Linux question: Take the command 'vmstat' in linux for a program, explain why the number of context switches is more than the number of interrupts?
Unix/Linux Turn in the following commands and any output from the commands. 1) ll to show the original 3 files
Unix/LinuxTurn in the following commands and any output from the commands.1) ll to show the original 3 files2) run the tar command to stuff three files3) ll to show the 'tar archive'4) mkdir newdir to create a new directory to unstuff the 'tar archive'
please use linux or unix to complete Diff command The diff command displays differences between two...
please use linux or unix to complete Diff command The diff command displays differences between two files on a line-by-line basis. It displays the differences as instructions that you can use to edit one of the files ( using the vi editor) to make it the same as the other. When you use diff, it produces a series of lines containing Append (a), Delete (d), and Change (c) instructions. Each of these lines is followed by the lines from the...
linux: Become the root user for this exercise. What command did you use to do this...
linux: Become the root user for this exercise. What command did you use to do this again? $ Now that you are root, create a new user on your system called labsevenuser. What is the command you used to create this user? # Set a new password for the new user you just created in step 2 above. What is the command you used to do this? # Create a new group called awesomepeople. Add the user you created in...
linux: Become the root user for this exercise. What command did you use to do this...
linux: Become the root user for this exercise. What command did you use to do this again? $ Now that you are root, create a new user on your system called labsevenuser. What is the command you used to create this user? # Set a new password for the new user you just created in step 2 above. What is the command you used to do this? # Create a new group called awesomepeople. Add the user you created in...
Use Linux fedora At the command prompt, type route and press Enter. What entries are listed?...
Use Linux fedora At the command prompt, type route and press Enter. What entries are listed? What does each entry represent? What IPv4 address is listed as your default gateway? At the command prompt, type ip route add 1.0.0.0/8 via gwIP and press Enter, where gwIP is the IPv4 address of your default gateway. At the command prompt, type route and press Enter. Is the route added in Step 3 visi- ble? Will this route interfere with traffic that is...
Look up and use each of these Linux commands. (Each command will have two parts) Summarize...
Look up and use each of these Linux commands. (Each command will have two parts) Summarize their function then use the command Use the Command and document the output (<parameters of your choice> Command Function info cat Demonstrate 'cat' in use   man cp Demonstrate 'cp' in use   man touch Demonstrate 'touch' in use   man mv Demonstrate 'mv' in use   man rm Demonstrate 'rm' in use   info wc Demonstrate 'wc' in use   man find Demonstrate 'find' in use   man chmod Demonstrate...
QUESTION 1 PARTNERSHIP (20 Marks) Use the information extracted from the accounting records of LS TRADING,...
QUESTION 1 PARTNERSHIP Use the information extracted from the accounting records of LS TRADING, a partnership owned by partners, LONG and SHORT, and prepare the Statement of Changes in Equity for the year ended 28 February 2017. NB: copy the format given below in your answer book. INFORMATION: 1. Extracts from the Trial Balance on 28 February 2017. Accounts Debit Credit Capital : Long 300 000 Capital : Short 300 000 Current Account : Long 3 000 Current Account :...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT