Learn about basic Linux Commands
Practice with basic commands in
Linux lecture first.
- 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
- 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
- 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
- Using vi, how can you search for a
string such as "name" in a file? What command will you use?
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
- 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
- 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
Part 3 - Writing a Shell Script
In this part you are expected a Linux Shell Script to perform the following tasks:
- Display your IP address
- Display your MAC address
- Display your HOST address
- Save the above information in a file called mynetwork.txt. Note that the created file must only have three lines in it.
Please note that each of the above information must be displayed on a separate line. You can use grep command to display the information; consequently the line may contain additional information.
Note that you must create the script using VI editor. Use these links to learn more about VI: Vi Editor / Vi Commands / The script must be executable on the machines in the lab.
Submission: Nothing needs to be submitted. You must show your script to the instructor for full credit. The intructor must be able to execute your script. No partial credit will be granted.