
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question

Transcribed Image Text:E7. Write a simple shell script to display number of files/directories in the current working directory.
By using a text editor, write text as shown below and save it as "cmd1.sh":
# files & direc tories script
# displays # of files and directories
echo "number of files & directories is:" && echo | ls -1 | WC -1
You can
use bash command to execute script files. To run the cmd1.sh script, type
$ bash cmd1. sh. There is also a way to change the script file mode and make it executable using the
chmod command. Note that only the owner of a file can use change file mode. More information on
chmod is available online or by using man.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images

Knowledge Booster
Similar questions
- If the PYTHONPATH environment variable is set, which of the following directories are searched for modules? A) PYTHONPATH directory B) current directory C) home directory D) installation dependent default path A only A, B, and D B and D only A, B, C, and Darrow_forwardCreate a Linux shell script that will search for US phone numbers in files that are in a directory that has been passed in as a parameter to your script. The script must recognize phone numbers in the following formats: (570)555-1212, 570.555.1212, 570-555-1212, and +1.570.555.1212. Your script should also attempt to minimize false positives. The script should work on files that are compressed or uncompressed. This script could be useful to you if you were trying to find phone numbers on a filesystem image that you have mounted on your Linux forensics workstation. The output should be similar to the following, but you have some flexibility in the exact format: letter.docx: (312)555-1212 570.389.3000 intro.txt: 570-389-3000arrow_forwardCan someone please explain to me ASAP??!!!arrow_forward
- 2.arrow_forwardDraw a picture with 9 little boxes and fill in the 1s and Os for the mode for a file with permission modes of rwxr-x-- X rw-r- - r - - rwxr-x - - X rw-rw - r - - rw-r- - r - -arrow_forwardWrite a shell script that allows the user to enter six numbers, and sends it to a file. After which, the script will then display it on the screen. Hint: Make sure the script "cleans up" before running again.arrow_forward
- Write code that when executed in PowerShell, will satisfy the following requirements: • Display the contents of the c:\windows\system32 directory. • Only display the file / directory names. • Pipe the result into the format list cmdlet • Use only one line to solve the problem.arrow_forwardäbäi 15 The following problems can be solved by writing commands in the command window, or by writing a program in a script file * .and then executing the file 22+5.12 1. 50-6.32 V412 –5.22 2. e5-100.53arrow_forwardYou shall implement a Microshell, “MSH”. MSH shall provide the following functions: Provide a shell-like interface for launching new programs: When MSH starts running, it will print a prompt "cssc0000% " (replace cssc0000 with your username) and then wait for the user to type in a file name. Note, MSH will NOT have any shell built-in functions (such as cd, setenv, printenv, bg, fg, etc), with the exception of #5 (below). When the user enters a filename and hits the “enter” key, MSH then reads the filename entered and determines if the file is an executable file. If it isn't, MSH will print a useful error message to the user and then return to #1 above (display a new prompt and wait for user input). If it is an executable file, then MSH will create a new process and run this program in the new process. Note – you will need to determine whether the filename is a fully qualified path name or if the file needs to be searched for (fully qualified pathnames begin with a slash (i.e. "/"),…arrow_forward
- Can you please write C program that will act as a shell interface that should accept and execute a rm[ ] command in a separate process. There should be a parent process that will read the command and then the parent process will create a child process that will execute the command. The parent process should wait for the child process before continuing. This program should be written in C and executed in Linux.arrow_forwardfind The find command takes a pattern as a command-line argument and recur- sively searches through directories to find a filename matching that pattern. It should print a relative path starting with "./" for every file/directory that matches. For example, running ./find 1s.c from within the hw2 directory should print ./1s.c. If run from the parent directory, the output would be . /hw2/1s.c. There may be multiple matches. If we run ./find .c from within the hw2 directory, we should see: ./find.c ./1s.c ./tree.c The output does not need to be sorted. If nothing matches, it shouldn't print anything. Pattern matching should be case sensitive.arrow_forwardWrite a shell script that reads a directory name and displays all the files in this directory if it is a valid directory; otherwise keeps displaying a message like "Enter a valid directory" until the user enters a valid directory. Hints: you can use a while loop.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY

Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON

Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education

Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY