Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
107 views

Lab Exercise 2. Linux Commands - Part 1

This document provides instructions for students to complete an exercise using Linux commands to create directories, move between directories, create text files, and list files in directories. The exercise has 5 parts where students will use mkdir, cd, cat, and ls commands to: 1) Create directory trees using mkdir 2) Navigate between directories using cd 3) Create and view a text file using cat 4) List files in directories using ls 5) Create a 50 line file about themselves as a challenge.

Uploaded by

jocansino4496
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
107 views

Lab Exercise 2. Linux Commands - Part 1

This document provides instructions for students to complete an exercise using Linux commands to create directories, move between directories, create text files, and list files in directories. The exercise has 5 parts where students will use mkdir, cd, cat, and ls commands to: 1) Create directory trees using mkdir 2) Navigate between directories using cd 3) Create and view a text file using cat 4) List files in directories using ls 5) Create a 50 line file about themselves as a challenge.

Uploaded by

jocansino4496
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

INFORMATION TECHNOLOGY EDUCATION DEPARTMENT

IOS101L
(OPERATING SYSTEM LAB)
EXERCISE

2
LINUX COMMANDS
PART I
Students Name

Block

Date

I.

Objectives:

II.

Create directory and sub-directories using mkdir command


Move between directories using cd command
Create a text file using cat command
List the files in a particular directory using ls command

Tasks / Procedure / Instructions:


Part I. Create directories
1. Login using your username and password.
2. To create a new directory, use mkdir command.
Syntax: $ mkdir directoryname
3. Create a directory called dir4.
$ mkdir dir4
4. Create a directory tree. The following command will created a directory tree where dir3 will be
created under dir2 and dir2 is created under dir1.
$ mkdir p dir1/dir2/dir3

Part II Move between directories.


1. To move to a directory, use cd command.
Syntax: $ cd directoryname
2. Move to the dir4 directory.
$ cd dir4
What is your current prompt? ______________________________________
3. Move to the dir1 directory. First, you need to exit from dir4 and go back to your home directory. To
do this, type the following:
dir4] $ cd ~

;do not type dir4]

What is your current prompt? ______________________________________


Now that you are in your home directory, what command should you enter to move to dir1? ______
What is your current prompt? ______________________________________
4. Move to dir2 and dir3 sub-directories.
dir1] $ cd dir2
dir2] $ cd dir3

What is your current prompt? ______________________________________


5. Move one level hierarchy down from the current directory.
dir3] $ cd ..
What is your current prompt? ______________________________________
Go back to your home directory. What command should you enter? _______________
What is your current prompt? ______________________________________
Part III Create a file.
1. To create a file, use cat command.
Syntax: $ cat >filename
2. Create a file called file1 in dir2.
$ cat >file1
My name is Bond.
James Bond.
Some call me Agent Bond.
Others call me Agent 007.
Dont mess with me.
[Ctrl+D]
3. Open the file1.
$ cat file1
Write the output.
______________________________________
______________________________________
______________________________________
______________________________________
______________________________________
4. Go back to your home directory.
Instructors Signature: ___________________________
Part IV Create a file.
1. To list the file/s, use ls command.
Syntax: $ ls
2. List the files / directories in your home directory.
$ ls
What files / directories do you see? _______________________________________________
3. Go to dir2 and repeat the command.

What files / directories do you see? _______________________________________________


4. Go back to your home directory.

Part V Challenge.
1. Create a file called myinfo in dir4.
2. The file should contain 50 lines about you.
3. Number each line.

Instructors Signature: ___________________________

You might also like