0% found this document useful (0 votes)
15 views19 pages

Os Lab 1

Uploaded by

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

Os Lab 1

Uploaded by

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

LAB REPORT COVER PAGE

Lab No: 01

Student ID: 23081003


Student Name: Sulav Adhikari
Course Name: Operating System
Course Code: CSC264
Semester: 4th
Instructor/Examiner/Lecture: Mr. Birendra Yadav
Date of submission: ________________

Evaluator’s Signature: ________________

Evaluator’s Comment: ________________


________________
________________
________________
Lab-1: Basic Linux Commands
Objectives:
The objective of this exercise is to familiarize users with basic Linux
commands and their functionalities. By following the steps, users learn
how to navigate the file system, manage directories and files, and
utilize various options for the ls command to display directory contents.
It covers essential operations such as creating, copying, moving, and
deleting files and directories, as well as viewing and editing file
contents. Additionally, it includes commands to check the current
directory and clear the terminal screen. Overall, this lab aims to build a
foundational understanding of command-line operations in a Linux
environment, essential for efficient system management and
administration.
Basic Linux Commands
1. Command: ls

Interpretation: It is used to list the contents of the current working


directory.

Output:

2. Command: dir

Interpretation: It is used to list information about the files (the current


directory by default).

Output:
3. Command: ls -a

Interpretation: It is used to list contents of the current working


directory where option -a is used for displaying all the contents of the
directory along with entries starting dddwith. (dot)

Output:

4. Command: ls -l

Interpretation: It is used to list contents of the current working


directory where option -l is used for displaying contents of the directory
with a long listing format

Output:

5. Command: ls -lh

Interpretation: It is used to list contents of the current working


directory where option -lh is used for displaying contents of the
directory with a long listing format with human understandable sizes
like 1K 234M 2G etc.
Output:

6. Command: ls -F

Interpretation: It is used to list directory contents and indicate the type


of each entry.

Output:

7. Command: ls -r

Interpretation: It is used to list the contents of directory in the reverse


order while sorting

Output:
8. Command: ls -R

Interpretation: It is used to list the contents of the current working


directory and subdirectories recursively

Output:

9. Command: ls -ltr

Interpretation: It is used to list the contents of the current working


directory where -l displays in long listing format and -t sorts by time,
(newest first) and -r reverse the order while listing So the content of the
directory is listed in long listing format sorted by time(oldest first)

Output:

10. Command: ls -i

Interpretation: It is used to list the contents of directory with index


numbers.
Output:

11. Command: ls –version

Interpretation: It Prints the version information of the program ls.

Output:

12. Command: ls --help

Interpretation: It displays the help guide of the program ls.

Output:
13. Command: ls -n

Interpretation: It lists the contents of directory with numeric users and


group IDs.

Output:

14. Command: clear

Interpretation: It is used to clear the terminal screen.

Output:
15. Command: mkdir os

Interpretation: It is used to make directories.

Output:

16. Command: ls

Interpretation: It is used to list the contents of the current working


directory.

Output:

17. Command: cd os

Interpretation: It changes directory to os in terminal.

Output:

18. Command: ls

Interpretation: It is used to list the contents of the current working


directory.
Output:

19. Command: touch linux.txt

Interpretation: It is used to create a file named linux.txt.

Output:

20. Command: ls

Interpretation: It is used to list the contents of the current working


directory.

Output:

21. Command: nano linux.txt

Interpretation: It opens the file linux.txt in text editor nano.

Output:
22. Command: cat linux.txt

Interpretation: It displays content of linux.txt in the terminal.

Output:

23. Command: touch unix.txt

Interpretation: It is used to create a file named unix.txt.

Output:

24. Command: cat > unix.txt

Interpretation: It allows user to display the text in the file unix.txt and is
excited by CTRL+C.

Output:

25. Command: cat unix.txt

Interpretation: It allows user to display the text in the file unix.txt


Output:

26. Command: touch fedora.txt arch.txt debian.txt red_hat.txt

Interpretation: It creates files named fedora.txt, arch.txt, debian.txt,


red_hat.txt.

Output:

27. Command: ls

Interpretation: It is used to list the contents of the current working


directory.

Output:

28. Command: cp linux.txt fedora.txt

Interpretation: It is used to copy the contents of file linux.txt into file


fedora.txt.

Output:

29. Command: cat fedora.txt


Interpretation: It allows user to display the text in the file unix.txt.

Output:

30. Command: cd

Interpretation: It allows user to change directory to one step back.

Output:

31. Command: mkdir ubuntu

Interpretation: It creates the directory named Ubuntu.

Output:

32. Command: ls

Output:

33. Command: pwd


Interpretation: It allows user to print name of current/working
directory.

Output:

34. Command: cp /home/sulav/os/fedora.txt /home/sulav/Ubuntu

Interpretation: It copies the file from directory cp


/home/sulav/os/fedora.txt to directory /home/sulav/UbuntuOutput:

35. Command: ls /home/user/Ubuntu

Interpretation: It lists the contents of directory cp/home/sulav/ubuntu.

Output:

36. Command: cat /home/user/ubuntu/fedora.txt

Interpretation: It allows user to read the


/home/sulav/ubuntu/fedora.txt and displays it in the terminal.

Output:

37. Command: mv /home/user/os/debian.txt /home/user/ubuntu


Interpretation: It allows user to move the file
/home/sulav/os/debian.txt to directory /home/sulav/ubuntu.

Output

38. Command: cd os

Interpretation: It is used to open the directory named os.

39. Command: ls

Output:

40. Command: rm fedora.txt

Interpretation: It deletes the file named fedora.txt.

Output:

41. Command: ls
Output:

42. Command: rm arch.txt linux.txt

Interpretation: It deletes the file named arch.txt linux.txt from current


working directory

Output:

43. Command: ls

Output:

44. Command: rm *.txt

Interpretation: It deletes all the files whose name ends with .txt.

Output:

45. Command: ls
Output:

46. Command: cd

Interpretation: It is used to navigate between directories.

Output:

47. Command: rmdir os

Interpretation: It deletes the directory named os from current working


directory.

Output:

48. Command: ls

Output:

49. Command: rmdir Ubuntu


Interpretation: It is used to delete the directory named ubuntu when
the specified directory is empty

Output:

50. Command: ls

Output:

51. Command: rm -rf Ubuntu

Interpretation: It deletes the directory ubuntu and it’s content


recursively and forcefully

Output:

52. Command: ls

Output:
Conclusion:
In conclusion, this lab exercise provides a comprehensive introduction
to fundamental Linux commands, equipping users with the skills
necessary to perform basic file and directory management tasks.
Through practical examples, users gain hands-on experience in
navigating the Linux file system, manipulating files and directories, and
using command options effectively. Mastery of these commands forms
the backbone of Linux system administration, enabling users to
efficiently interact with the operating system. This foundational
knowledge is crucial for advancing to more complex tasks and
optimizing workflow in a Linux environment. Ultimately, this exercise
serves as a stepping stone toward proficient Linux command-line usage .

You might also like