In: Computer Science
nano Good1
Type Welcome in the file and save it.
a) 777
b) 765
c) 400
d) 666
e) 600
f) 444
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
#!/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`"