Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Task 4: Linux Bash shell commands For each of the numbered items below, determine a single bash shell statement that will perform the operation(s) requested.

image text in transcribed

Task 4: Linux Bash shell commands For each of the numbered items below, determine a single bash shell statement that will perform the operation(s) requested. To test your commands, you should have unzipped hwl.zip into the current directory. You can assume you are in the hwl" directory when doing these problems. In response to each question, you will provide the command that will perform the task described, not the output that the command produces. Write your commands in on the indicated lines in the task4.sh file in the hwl folder. 1. Copy the file MyProgram.java from the current directory to the java subdirectory. 2. List all files in the /var directory, in reverse alphabetical order. (Notice the slash!) 3. List all files in the current directory, in "long listing format". 4. Print a text calendar for the month of July 2019. 5. Rename the file Burrot.java to Borat.java . (Hint: Renaming is done using the same command as moving.) 6. Delete the files diff.html and diff.css Note that your answer must be a single command and not multiple commands. (Hint: Many commands can accept more than one parameter.) 7. Set the file My Program.java to have a last-modified date of January 1, 2019, 4:15am. (Hint: the man page for the proper command describes the timestamp 'STAMP" format to use. Look for this!) (Also note that Linux is case-sensitive when you are specifying file or directory names.) 8. You can use a * (asterisk) as a "wild-card" character to specify a group of files. For example, *foo means all files whose names end with foo , and foo* means all files whose names begin with foo . You can use a wildcard in the middle of a file name, such as foo*bar for all files that start with foo and end with bar. List all web page files (files whose names end with the extension .html or .css) in the current directory. Note that the ls command can accept more than one parameter for what files you want it to list (e.g. ls website/ java/). 9. Copy all the text files (files whose names end with .txt) from the current folder to the java subdirectory. 10. The cat command outputs the contents of a file to the terminal. The less command outputs the contents of a file to the terminal, page by page, pausing for you to press a key. Use whichever command is best suited to display the contents of the file lyrics.txt. 11. Display the contents of all files whose names begin with song and end with the extension .txt, such as song1.txt and song2.txt. (Write a single command that displays all their contents concatenated.) 12. The head and tail commands output only the first or last few lines (respectively) of a file to the terminal. Display only the first 7 lines of the file animals.txt from the current directory on the terminal. 13. The wc command outputs how many bytes, words, lines, etc. a file occupies. Display only the number of lines in the file song3.txt (It is fine to display the filename as well as the number of lines, just don't display the number of bytes and words.)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Peter Rob, Carlos Coronel

6th International Edition

061921323X, 978-0619213237

More Books

Students also viewed these Databases questions