LINUX
LINUX
PRACTICAL FILE
SUBMITTED TO SUBMITTED BY
A50504922002
TABLE OF CONTENT
6 21/10/24 Vi editor 20
Introduction to Linux
Linux is a powerful, open-source, and widely used operating system based on the
Unix architecture. It was first developed by Linus Torvalds in 1991 as a free
alternative to proprietary operating systems. Over the years, Linux has grown into
a versatile OS used in servers, desktops, embedded systems, and supercomputers
worldwide
Concept of Linux
Linux is a multi-user, multi-tasking operating system that allows multiple users
to perform various tasks simultaneously. Its open-source nature means the source
code is freely available for modification and distribution, making it highly
customizable.
Features of Linux
• Open Source: The Linux kernel is freely available and can be modified by
anyone, which fosters collaboration and innovation.
• Security: Linux is renowned for its robust security features, including user
permissions, firewalls, and encryption.
• Portability: Linux can run on a wide variety of hardware platforms, from
smartphones to servers.
• Stability: It is known for its high stability and uptime, making it ideal for
servers.
• Community Support: A large, active community provides extensive
resources and support for troubleshooting and development.
Components of Linux
Linux comprises three key components:
• Kernel: The core part of the operating system that interacts with the
hardware and manages system resources.
• System Utilities: Tools that manage tasks like file handling and process
control.
• Shell: The command-line interface for interacting with the kernel.
Uses of Linux
• Servers: Over 90% of web servers, such as those running Google,
Facebook, and Amazon, use Linux for its reliability and performance.
• Desktops: Popular distributions like Ubuntu and Fedora provide a user-
friendly desktop experience.
• Embedded Systems: Linux is widely used in smart TVs, routers, and IoT
devices.
• Supercomputers: Most supercomputers in the world use Linux due to its
scalability.
Benefits of Linux
• Cost-Effective: Linux is free to use, unlike many proprietary operating
systems.
• Customizable: Users can modify it to suit their specific needs.
• Efficiency: Linux is lightweight and performs well even on older hardware.
• Developer-Friendly: With powerful tools, scripting capabilities, and
compilers, Linux is ideal for software development.
Contribution to Modern Technology
Linux powers a vast range of devices and systems:
• Android smartphones are based on the Linux kernel.
• Cloud computing services like AWS and Azure rely on Linux servers.
• It plays a critical role in Artificial Intelligence (AI) and machine learning
systems.
Conclusion
Linux is more than just an operating system; it is a philosophy of collaboration,
innovation, and openness. Its flexibility and reliability make it indispensable in
modern computing, ensuring its continued dominance across various sectors. For
students, developers, and IT professionals, learning Linux is a gateway to
understanding system-level computing and advanced technology trends.
Installation of UBUNTU
1. ls
o Description: Lists the contents of a directory.
o Example: ls -l (shows detailed information about files and directories).
2. mkdir
o Description: Creates a new directory.
o Example: mkdir folder_name.
3. rmdir
o Description: Removes an empty directory.
o Example: rmdir folder_name.
4. echo
o Description: Prints text or variables to the terminal.
o Example: echo "anshika".
5. cd
o Description: Changes the current directory.
o Example: cd /path/to/directory.
6. touch
o Description: Creates an empty file or updates the timestamp of an
existing file.
o Example: touch file_name.txt.
7. pwd
o Description: Displays the current working directory.
o Example: pwd.
8. cp
o Description: Copies files or directories.
o Example: cp file1.txt /destination_folder/.
9. mv
o Description: Moves or renames files and directories.
o Example: mv file1.txt file2.txt.
10.cat
• Description: Displays the contents of a file.
• Example: cat file_name.txt.
11.grep
• Description: Searches for patterns in a file.
• Example: grep "text" file_name.txt.
12.whoami
• Description: Shows the current logged-in user.
• Example: whoami.
13.chmod
• Description: Changes file permissions.
• Example: chmod 755 file_name.
14.chown
• Description: Changes the owner of a file or directory.
• Example: chown user_name file_name.
15.who
• Description: Shows information about logged-in users.
• Example: who.
16.sort
• Description: Sorts the contents of a file.
• Example: sort file_name.txt.
17.ifconfig
• Description: Displays or configures network interfaces.
• Example: ifconfig eth0.
18.date
• Description: Displays the current date and time.
• Example: date.
19.cal
• Description: Displays a calendar for the current month or year.
• Example: cal.
20.df
• Description: Displays disk space usage of filesystems.
• Example: df -h.
PRACTICAL 3
Step 3: For exit press cntrl+x after that Y and then enter you will get exit from
shell and : enter the commands which are given below to get your desired result
Practical – 4
Step 2: after entering the shell write your query which is given below very
carefully remember to give space after every word so that you won’t get syntax
error
Step 3: For exit press cntrl+x after that Y and then enter you will get exit from
shell
Step 4: enter the commands which are given below to get your desired result
Practical - 5
Step 3: For exit press cntrl+x after that Y and then enter you will get exit from
shell and then enter the commands which are given below to get your desired result
Practical -6
Vi Editor in Linux
The default editor that comes with the Linux/UNIX operating system is
called vi (visual editor). Using vi editor, we can edit an existing file or create a new
file from scratch. we can also use this editor to just read a text file. The advanced
version of the vi editor is the vim editor.
Control Command (Scrolling) in vi Editor:
There are the following useful commands which can be used along with the
Control Key. These commands are helpful in saving time by navigating quickly in
a file without manually scrolling.
Command Description
Colon followed by a The cursor on the line number is represented by the number
number position after the colon. For example, “:10” positions the cursor on
line 10.
O Creates a new line for text entry above cursor location and switches to
insert mode.
R Overwrites text from the cursor to the right, without switching to insert
mode.
`d$` Deletes from current cursor position to the end of the line.
`Dd` Deletes the line the cursor is on.
q Quit
Step 2: After entering the shell write your program which is given below very
carefully remember to give space after every word so that you won’t get syntax
error
Step 3: For exit press cntrl+x after that Y and then enter you will get exit from
shell and then enter the 1st and 2nd no and you will get the sum of it
Practical - 8
Step 2: After entering the shell write your program carefully so that you won’t get
syntax error
Step 3: For exit press cntrl+x after that Y and then press enter you will get exit
from shell and then enter the 1st and 2nd no then the swapping would be done
Practical – 9
Step 2: After entering the shell write your formula of Fibonacci series carefully so
that you won’t get syntax error
Step 3: For exit press cntrl+x after that Y and then press enter you will get exit
from shell and then enter the 1st and 2nd no then the swapping would be done