0% found this document useful (0 votes)
29 views10 pages

Lab Rep 2 Intro To Rob

Uploaded by

Abdullah Anwar
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)
29 views10 pages

Lab Rep 2 Intro To Rob

Uploaded by

Abdullah Anwar
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/ 10

INTRODUCTION TO ROBOTICS

(MTS-417)
DE-43 Mechatronics
Syndicate – B
LAB Report
BASIC LINUX COMMANDS
Group Members:
NC MUHAMMAD ABDULLAH ANWAR

Reg # 370057

NC MOHIB AHMED MALIK

Reg # 375104

Submitted to: LE Hamza Sohail

1
Table of Contents
INTRODUCTION .......................................................................................................................... 3
Key Features of Linux: ................................................................................................................ 3
Uses of Linux: ............................................................................................................................. 4
Components of Linux:................................................................................................................. 4
Why Use Linux?.......................................................................................................................... 4
TASK .............................................................................................................................................. 5
Basic Linux commands: .............................................................................................................. 5
1. mkdir (Make Directory) .................................................................................................... 5
2. cd (Change Directory) ......................................................................................................... 5
3. ls (List Files) ........................................................................................................................ 5
4. touch (Create a File.............................................................................................................. 5
5. rm (Remove File/Directory) ................................................................................................ 6
6. cp (Copy Files/Directories) ................................................................................................. 6
7. mv (Move/Rename Files/Directories) ................................................................................. 6
8. sudo (Run as Superuser) ...................................................................................................... 6
9. apt (Package Manager for Debian/Ubuntu) ......................................................................... 6
10. pwd (Print Working Directory) ......................................................................................... 7
11. chmod (Change Permissions) ............................................................................................ 7
12. chown (Change Ownership) .............................................................................................. 7
13. ps (Process Status) ............................................................................................................. 7
14. kill (Terminate Process)..................................................................................................... 7
15. df (Disk Free)..................................................................................................................... 7
16. du (Disk Usage) ................................................................................................................. 8
17. cat (Concatenate and Display Files) .................................................................................. 8
18. grep (Search in Files) ......................................................................................................... 8
19. man (Manual Pages) .......................................................................................................... 8
20. echo (Print Text) ................................................................................................................ 8
IMPLEMENTATION ..................................................................................................................... 9
CONCLUSION ............................................................................................................................. 10

2
INTRODUCTION

Linux is an open-source operating system (OS) based on the Unix architecture. It is a system
software that manages hardware resources, provides a user interface, and acts as a platform for
running applications. Like other operating systems (e.g., Windows, macOS), Linux controls how
computer hardware (CPU, memory, storage, etc.) interacts with software applications.

Key Features of Linux:

1. Open Source: Linux is free and open source, meaning anyone can access, modify, and
distribute its code. This has resulted in a large, active community of developers and users.

2. Kernel-Based: At the core of Linux is the Linux kernel, the fundamental part that
controls hardware communication, memory management, and other system resources.

3. Multiuser and Multitasking: Linux allows multiple users to work on the same system
simultaneously and can run multiple processes at the same time.

4. Security: Linux is considered more secure than many other operating systems due to its
design, permissions structure, and active community.

5. Distributions (Distros): Linux is not a single OS, but a family of operating systems
called distributions (or "distros"). Examples include Ubuntu, Fedora, Debian, CentOS,
and Arch Linux. Each distro has its own set of features, package management, and
default applications.

6. Command-Line Interface (CLI): While Linux can have graphical interfaces (GUIs),
many Linux users interact with the system via the command-line interface (CLI),
providing more control over tasks.

7. Cross-Platform Compatibility: Linux can run on a wide variety of hardware platforms,


from personal computers to smartphones (like Android, which is based on Linux),
servers, and embedded systems (e.g., routers, IoT devices).

3
Uses of Linux:

• Servers: Linux is widely used in server environments (web, database, and mail servers)
due to its stability, performance, and security.

• Development: Developers often use Linux for programming because of its support for
multiple programming languages, tools, and environments.

• Desktop OS: While not as widely used on desktops compared to Windows or macOS,
Linux distros like Ubuntu and Linux Mint offer user-friendly interfaces.

• Embedded Systems: Linux powers many embedded systems such as smart TVs, routers,
and other IoT devices.

Components of Linux:

1. Kernel: The core component that interacts with the hardware and manages system
resources.

2. Shell: A program that provides the user with a command-line interface to interact with
the system.

3. File System: Linux has a hierarchical file system, where everything (files, directories,
devices) is treated as a file.

4. Package Management: Linux uses package managers (e.g., APT, YUM, Pacman) to
install, update, and remove software.

Why Use Linux?

• Customization: Linux allows for extensive customization of both the appearance and
functionality of the system.

• Performance: Linux systems are lightweight and can run efficiently even on older
hardware.

4
• Cost-Effective: Linux is free to use, which makes it an attractive option for personal,
enterprise, and educational purposes.

TASK

Make a Report including Linux commands you have learnt such as make directory, cd,
update, install etc.

Basic Linux commands:

1. mkdir (Make Directory)

• Purpose: Creates a new directory (folder).


• Command: mkdir <directory_name>
• Example: mkdir my_folder
• What it does: Creates a new folder called "my_folder" in the current directory.

2. cd (Change Directory)

• Purpose: Changes the current directory.


• Command: cd <directory_path>
• Example: cd /home/user/documents
• What it does: Changes the current working directory to "/home/user/documents".

3. ls (List Files)

• Purpose: Lists the files and directories in the current directory.


• Command: ls [options]
• Example: “ls” changes to “ls -l”
• What it does: Displays the contents of the current directory. Adding options like -l
provides detailed information like file size, permissions, etc.

4. touch (Create a File)

• Purpose: Creates an empty file or updates the timestamp of an existing file.


• Command: touch <filename>
• Example: touch myfile.txt
• What it does: Creates an empty file called "myfile.txt" in the current directory.

5
5. rm (Remove File/Directory)

• Purpose: Deletes a file or directory.


• Command:
o To remove a file: rm <filename>
o To remove a directory: rm -r <directory_name>
• Example: rm myfile.txt rm -r my_folder
• What it does: Deletes "myfile.txt" or "my_folder" and its contents.

6. cp (Copy Files/Directories)

• Purpose: Copies files or directories from one location to another.


• Command:
o For a file: cp <source_file> <destination_file>
o For a directory: cp -r <source_directory> <destination_directory>
• Example: cp file1.txt file2.txt cp -r folder1 folder2
• What it does: Copies "file1.txt" to "file2.txt" or recursively copies "folder1" and its
contents to "folder2".

7. mv (Move/Rename Files/Directories)

• Purpose: Moves or renames files or directories.


• Command:
o For renaming: mv <old_name> <new_name>
o For moving: mv <source> <destination>
• Example: mv oldfile.txt newfile.txt mv file.txt /home/user/documents/
• What it does: Renames "oldfile.txt" to "newfile.txt" or moves "file.txt" to
"/home/user/documents/".

8. sudo (Run as Superuser)

• Purpose: Allows a permitted user to execute a command as the superuser (admin


privileges).
• Command: sudo <command>
• Example: sudo apt update
• What it does: Executes the command with root (admin) privileges, in this case, updating
the package list.

9. apt (Package Manager for Debian/Ubuntu)

• Purpose: Used for managing packages (install, update, remove).


• To update the package list: sudo apt update
• To upgrade installed packages: sudo apt upgrade
• To install a package: sudo apt install <package_name>
• To remove a package: sudo apt remove <package_name>

6
• What it does: Manages packages, including updates, installation, and removal.

10. pwd (Print Working Directory)

• Purpose: Displays the current directory path.


• Command: pwd
• Example: pwd
• What it does: Prints the full path of the current working directory.

11. chmod (Change Permissions)

• Purpose: Changes file or directory permissions.


• Command: chmod <permission_mode> <filename>
• Example: chmod 755 script.sh
• What it does: Changes the permissions of "script.sh" to allow the owner to read, write,
and execute, while others can only read and execute.

12. chown (Change Ownership)

• Purpose: Changes the owner of a file or directory.


• Command: chown <owner>:<group> <filename>
• Example: sudo chown user:group myfile.txt
• What it does: Changes the ownership of "myfile.txt" to the specified user and group.

13. ps (Process Status)

• Purpose: Displays information about active processes.


• Command: ps [options]
• Example: ps aux
• What it does: Displays detailed information about all running processes.

14. kill (Terminate Process)

• Purpose: Terminates a running process.


• Command: kill <process_id>
• Example: kill 1234
• What it does: Terminates the process with the process ID (PID) "1234".

15. df (Disk Free)

• Purpose: Displays disk space usage.


• Command: df [options]
• Example: df -h
• What it does: Shows the disk space usage of all mounted file systems. The -h flag
displays the data in human-readable format (MB, GB, etc.).

7
16. du (Disk Usage)

• Purpose: Shows disk usage of files and directories.


• Command: du [options]
• Example: du -h my_folder
• What it does: Displays the disk usage of the "my_folder" directory and its contents in a
human-readable format.

17. cat (Concatenate and Display Files)

• Purpose: Displays the contents of a file.


• Command: cat <filename>
• Example: cat file.txt
• What it does: Outputs the contents of "file.txt" to the terminal.

18. grep (Search in Files)

• Purpose: Searches for a specific pattern in files or output.


• Command: grep <pattern> <filename>
• Example: grep "hello" file.txt
• What it does: Searches for the word "hello" in "file.txt" and displays matching lines.

19. man (Manual Pages)

• Purpose: Displays the manual for a command.


• Command: man <command_name>
• Example: man ls
• What it does: Displays the manual (help documentation) for the ls command.

20. echo (Print Text)

• Purpose: Outputs the provided text or variables to the terminal.


• Command: echo <text>
• Example: echo "Hello, World!"
• What it does: Prints "Hello, World!" to the terminal.

These are fundamental Linux commands that can help us navigate and manage our system
effectively.

8
IMPLEMENTATION
We have attached the output of these commands after performing them in our system.

9
CONCLUSION

In conclusion, we learned that Linux is a powerful, open-source operating system with a wide
range of features that make it suitable for various environments, including servers, desktops, and
embedded systems. We explored the fundamentals of Linux, including its kernel-based
architecture, command-line interface, and multiuser capabilities. Additionally, we covered
essential Linux commands such as mkdir, cd, sudo, apt, and others, which help manage files,
directories, processes, and system updates. The flexibility, security, and extensive community
support make Linux an excellent choice for users ranging from beginners to advanced
developers.

10

You might also like