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 Java class named ReadWriteCSV that reads the attached cis425_io.txt file that you will save...
Create a Java class named ReadWriteCSV that reads the attached cis425_io.txt file that you will save in your workspace as src/cis425_io.txt and displays the following table: -------------------------- | No | Month Name | Days | -------------------------- | 1 | January | 31 | | 2 | February | 28 | | 3 | March | 31 | | 4 | April | 30 | | 5 | May | 31 | | 6 | June | 30 |. | 7...
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.
Create a class named Employee and its child class named Salesperson. Save each class in its...
Create a class named Employee and its child class named Salesperson. Save each class in its own file. Name your class and source code file containing the main method homework.java. Make sure each class follows these specifications: 1. An employee has a name (String), employee id number (integer), hourly pay rate (double), a timesheet which holds the hours worked for the current week (double array) and email address (String). A salesperson also has a commission rate, which is a percentage...
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...
Implement a python program in file named tarvel.py. Create an empty dictionary named responses. Implement while...
Implement a python program in file named tarvel.py. Create an empty dictionary named responses. Implement while loop to take in user's name and desired destination for as long as there are user inputs. Prompt user to input yes to continue and no to quit. Prompt for user's name. Receive the name into the program and save it as the value of name variable. Prompt user for their desired vacation destination. Receive response and save it as the value of a...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT