Write a shell script and using grep command (or anything else) display the IP address and machine name (use uname)
Create the following directories and files (/ is the root directory):
Write a shell script (called myshell) to perform the following:
Remove all the new directories: junks, primary, secondary.
Backup HOSTS file by creating HOSTS_BACK
Display the IP address of your machine
Create a new file called YOUR_IP_ADDRESS containing the IP address of your machine à thus, by doing a less YOUR_IP_ADDRESS we should get your IP address
Change the permission on YOUR_IP_ADDRESS such that can only be viewed by the user and make sure it is readable only.
Note: you should be able to run the script multiple times with no errors! (make sure you try that)
Part 2
In the root directory create three directories.
Call them primary,secondary and junks. What commands
will you use?
In the junks directory create a file called
my_stall Write your first name in this file and save it. What commands
will you use?
Move my_stall into the secondary
directory. What commands will you use?
Move my_stall into the primary and change
the name to my_first_file.log . In this directory you should only have
one file. What commands will you use?
Draw the directory configuration for the above questions
Find the file called yp.conf; can you find it? where
is it?
How can you login as a different user from a terminal?
How do you know which user you have signed in as?
What is the difference between commands touch and
cat?
To find out when file .emacs was generated what
command will you use?
How do you use echo command to display the
following message: *** This is a test ****.
What will be the purpose of running the
following command: ls /etca/*release*
What does SU command do?
What does ping do? what command can you use to ping?
What does ifconfig command do?
What can you do with chmod command. Make an
example.
Using vi, how can you search for a
string such as "name" in a file? What command will you use?
What
command allows you to find the file called .bash_profile
Let's say you are logged on as the system administrator.
Assuming .bash_profile file contains user specific environment
and startup programs and it is located in the home directory of each user,
where will be location of the file?
Display the .bash_profile file.What is the
first line of .bash_profile file?
Explain the sequence of commands you use to create the
following steps:
Assuming you are the system admin, what is your home directory (all
filenames and directory names are lower case) ?
Write the command to create a directory called myprofile
Write the command to create a file called mytest.txt in the above
directory.
Write the command to copy mytest.txt into yourtest.txt
Write the command to copy mytest.txt into ourtest.txt
At this point, write the name of all the files in myprofile