Question

In: Computer Science

Create a file named Good1 nano Good1 Type Welcome in the file and save it. What...

  1. Create a file named Good1

nano Good1

Type Welcome in the file and save it.

  1. What command gives you a long listing of your filenames in the current directory, including permissions attached to each file.
  2. What command would you use to change a file’s permissions to include read, write and execute permission for the owner of the file only.
  3. Explain the following file permissions

   a) 777

         b) 765

         c) 400

         d) 666

         e) 600

         f) 444

  1. Create a shell script named script1 to perform the following task
    1. Print the current date
    2. Print the current working directory
    3. Print the calendar.

Solutions

Expert Solution

Please see the answers below. Please provide your feedback

Thanks and Happy Learning!

1. Create a file named Good1

use 'touch' command to create a file:: touch Good1

2. Type Welcome in the file and save it.

command to open the file : vi Good1

Steps to write something into the file after opening the file:

a. switch to 'insert' mode by pressing 'i' or 'Insert' key on the keyboard

b. Now write the desired text(here it is the string 'Welcome'

c. Once the writing is done the press 'esc' key , the type colon (ie :), then type 'wq' then press enter key. Now the changes will be saved and the control exits from vi editor.

3.What command gives you a long listing of your filenames in the current directory, including permissions attached to each file.

command to get the lon listing of the items in current direatory is : ls -l .

4. What command would you use to change a file’s permissions to include read, write and execute permission for the owner of the file only.

Command to change the file permission is : chmod

To add read(r),write(w) and execute(x) permission to the owner(u) of the file one can use the command : chmod u+rwx filename

5. Explain the following file permissions

Numeric values for read, write , execute permission ar 4, 2 and 1 respectively

   a) 777  

Here 777 means all users including the owner has full permission on the file. Here 7 means read(4)+write(2)+execute(1) permission

         b) 765

Here 765 means

owner has full permission(4+2+1 = 7) on the file.

Group users has only read(4) and write(2) permissions (ie 4+2 =6)

Others has only read(4) and execute(1) permission (ie 4+1=5)

         c) 400

Here 400 means

owner has full permission only read(4) permision on the file.

Group users has no(0) permissions on the file

Others has no(0) permissions on the file

         d) 666

Here 666 means  

owner has only read(4) and write(2)permision on the file (ie 4+2 =6).

Group users has only read(4) and write(2) permissions (ie 4+2 =6)

Others has only read(4) and write(2) permissions (ie 4+2 =6)

         e) 600

Here 600 means  

owner has only read(4) and write(2)permision on the file (ie 4+2 =6).

Group users has no(0) permissions on the file

Others has no(0) permissions on the file

         f) 444

Here 444 means  

owner has only read(4) permision on the file.

Group users has only read(4) permissions.

Others has only read(4) permissions .

Create a shell script named script1 to perform the following task

  1. Print the current date
  2. Print the current working directory
  3. Print the calendar.
#!/bin/bash
#print current date
echo "Todays date is: `date`"

#Print current working directory
echo "Current working directory is: `pwd`"

#Display calendar
echo "Current calendar is: `cal`"

Related Solutions

Create a file named StudentArrayList.java,within the file create a class named StudentArrayList. This class is meant...
Create a file named StudentArrayList.java,within the file create a class named StudentArrayList. This class is meant to mimic the ArrayList data structure. It will hold an ordered list of items. This list should have a variable size, meaning an arbitrary number of items may be added to the list. Most importantly this class should implement the interface SimpleArrayList provided. Feel free to add as many other functions and methods as needed to your class to accomplish this task. In other...
Use your IDE (PyCharm) to create a new file named countertop.py. Type in the following lines,...
Use your IDE (PyCharm) to create a new file named countertop.py. Type in the following lines, exactly as they are shown here (including the four spaces before the indented lines of code) and save the file: def countertop(sideLength): """ Compute the area of a square countertop with a missing wedge. The parameter x is the length of one side of the square. """ square = sideLength ** 2 # area of the full square triangle = ((sideLength / 2) **...
Invent a recursive function and save the program in a file named " q3c.java” It should...
Invent a recursive function and save the program in a file named " q3c.java” It should not be any of the familiar ones (like fibonacci or binomial coefficients or any of those). Make one up. Make sure it is well-defined (no ambiguity), make sure it isn’t “infinitely recursive”. • Implement it in a Java program and demonstrate it with at least 7 test values. • Add necessary comments to the program to explain it. • In comments, describe your test...
(C++) Create a data file and name it "input.txt". manually save 10 integers into the file....
(C++) Create a data file and name it "input.txt". manually save 10 integers into the file. Write a program to read the data and calculate the average of events and odds, separately. Print out the average values.
Consider a text file that you will create named “employees.txt”. The file contains data organized according...
Consider a text file that you will create named “employees.txt”. The file contains data organized according to the following format:John Smith 10 15Sarah Johnson 40 12Mary Taylor 27 13Jim Stewart 25 8For instance, “John” is the first name, “Smith” is the last name, “10” is the number of hours per week, and “15” is the hourly rate.Write a program that computes the weekly salary of each employee. The program prints the first name, last name, and weekly salary of each...
Create a file named work.sh in your hw5 directory. Give this file read and write permission...
Create a file named work.sh in your hw5 directory. Give this file read and write permission (no execute permissions) for you alone. No other account should have any access privileges to this file. Change the permissions on the work.sh file so you have read and write permissions. Give everybody else, including the group, read permissions only. Give yourself read, write and execute permissions to the file work.sh. Give everyone else, including the group, execute permissions only. Create a directory named...
The requirements for this program are as follows: Create a header file named “Employee.h”. Inside this...
The requirements for this program are as follows: Create a header file named “Employee.h”. Inside this header file, declare an Employee class with the following features: Private members a std::string for the employee’s first name a std::string for the employee’s last name an unsigned int for the employee’s identification number a std::string for the city in which the employee works Public members A constructor that takes no arguments A constructor that takes two arguments, representing: the employee’s first name the...
​​​​Python Create a new file named compute_cost.py. Write your name and date in a comment. Create...
​​​​Python Create a new file named compute_cost.py. Write your name and date in a comment. Create a variable named base_fee and set the value to 5.5. Prompt the user for the zone. The zones can be an integer value from 1 to any value for the zone. Convert the zone to an integer. Display the zone on the SenseHat with a scroll speed of 0.3, make the text blue, and the background yellow. Scroll "The zone is " and the...
Create a bash script file named assessment-script-a that: 1. Accepts any number of file names on...
Create a bash script file named assessment-script-a that: 1. Accepts any number of file names on the command line 2. For each file name provided, delete any line that contains the string: qwe.rty When the changes are completed, the script should display the total number of files scanned, and the total number of files changed. Example Command: assessment-script-a file.a file.b file.c file.d file.e    Example Output: 5 files scanned, 3 files changed 3. Your script should include a series of...
C# Create a console application named that creates a list of shapes, uses serialization to save...
C# Create a console application named that creates a list of shapes, uses serialization to save it to the filesystem using XML, and then deserializes it back: // create a list of Shapes to serialize var listOfShapes = new List<Shape> { new Circle { Colour = "Red", Radius = 2.5 }, new Rectangle { Colour = "Blue", Height = 20.0, Width = 10.0 }, new Circle { Colour = "Green", Radius = 8 }, new Circle { Colour = "Purple",...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT