Osy Report

Download as pdf or txt
Download as pdf or txt
You are on page 1of 17

JSPM's

Rajarshi Shahu College of Engineering, Polytechnic.

Academic Year 2024-25

CLASS- CO5I Subject- Operating System (22516)

Micro-Project Report

TITLE OF MICROPROJECT : Study of Different types of Command in Ubuntu.

GROUP MEMBERS:

Enrollment No. Roll No. Name


2216200211 1 Jayesh Harihar
Maharashtra State
Board of Technical Education, Mumbai
(Autonomous) (ISO-9001-2008) (ISO/IEC 27001:2013)
CERTIFICATE
This is to certify that Mr. Jayesh Sachin Harihar of Diploma In Computer Engineering of JSPM’s
Rajarshi Shahu College of Engineering Polytechnic (Code: 1620) has completed Micro project of
the course Operating System (22516) as prescribed in the curriculum for the academic year 2024
to 2025.

Place: Tathawade, Pune Enrollment No: 2216200211

Date:____________________

Mrs. S.A.Saudagar Mrs. V. T. Thakare

(Course Incharge) (Head of Department)

Seal Of Institute
1.0 Brief Description :

➢ Introduction :

The Linux command line is a text interface to your computer. Often referred to as the shell,
terminal, console, prompt or various other names, it can give the appearance of being complex
and confusing to use. Yet the ability to copy and paste commands from a website, combined
with the power and flexibility the command line offers, means that using it may be essential
when trying to follow instructions online, including many on this very website!
This tutorial will teach you a little of the history of the command line, then walk you through
some practical exercises to become familiar with a few basic commands and concepts. We’ll
assume no prior knowledge, but by the end we hope you’ll feel a bit more comfortable the
next time you’re faced with some instructions that begin “Open a terminal”.

➢ A brief of History Lesson:

During the formative years of the computer industry, one of the early operating systems was called Unix.
It was designed to run as a multi-user system on mainframe computers, with users connecting to it
remotely via individual terminals. These terminals were pretty basic by modern standards: just a
keyboard and screen, with no power to run programs locally. Instead they would just send keystrokes to
the server and display any data they received on the screen. There was no mouse, no fancy graphics, not
even any choice of colour. Everything was sent as text, and received as text. Obviously, therefore, any
programs that ran on the mainframe had to produce text as an output and accept text as an input.

Compared with graphics, text is very light on resources. Even on machines from the 1970s, running
hundreds of terminals across glacially slow network connections (by today’s standards), users were still
able to interact with programs quickly and efficiently. The commands were also kept very terse to reduce
the number of keystrokes needed, speeding up people’s use of the terminal even more. This speed and
efficiency is one reason why this text interface is still widely used today.

When logged into a Unix mainframe via a terminal users still had to manage the sort of file management
tasks that you might now perform with a mouse and a couple of windows. Whether creating files,
renaming them, putting them into subdirectories or moving them around on disk, users in the 70s could
do everything entirely with a textual interface.

Each of these tasks required its own program or command: one to change directories (cd), another to list
their contents (ls), a third to rename or move files (mv), and so on. In order to coordinate the execution
of each of these programs, the user would connect to one single master program that could then be used
to launch any of the others. By wrapping the user’s commands this “shell” program, as it was known,
could provide common capabilities to any of them, such as the ability to pass data from one command
straight into another, or to use special wildcard characters to work with lots of similarly named files at
once. Users could even write simple code (called “shell scripts”) which could be used to automate long
series of shell commands in order to make complex tasks easier. The original Unix shell program was
just called sh, but it has been extended and superceded over the years, so on a modern Linux system
you’re most likely to be using a shell called bash. Don’t worry too much about which shell you have, all
the content in this tutorial will work on just about all of them.

Linux is a sort-of-descendent of Unix. The core part of Linux is designed to behave similarly to a Unix
system, such that most of the old shells and other text-based programs run on it quite happily. In theory
you could even hook up one of those old 1970s terminals to a modern Linux box, and access the shell
through that. But these days it’s far more common to use a software terminal: that same old Unix-style
text interface, but running in a window alongside your graphical programs.
➢ Opening a Terminal:

On a Ubuntu 18.04 system you can find a launcher for the terminal by clicking on
the Activities item at the top left of the screen, then typing the first few letters of “terminal”,
“command”, “prompt” or “shell”. Yes, the developers have set up the launcher with all the
most common synonyms, so you should have no problems finding it.

Other versions of Linux, or other flavours of Ubuntu, will usually have a terminal launcher
located in the same place as your other application launchers. It might be hidden away in a
submenu or you might have to search for it from within your launcher, but it’s likely to be
there somewhere.
If you can’t find a launcher, or if you just want a faster way to bring up the terminal, most
Linux systems use the same default keyboard shortcut to start it: Ctrl-Alt-T.
However you launch your terminal, you should end up with a rather dull looking window with
an odd bit of text at the top, much like the image below. Depending on your Linux system the
colours may not be the same, and the text will likely say something different, but the general
layout of a window with a large (mostly empty) text area should be similar.

Let’s run our first command. Click the mouse into the window to make sure that’s where your
keystrokes will go, then type the following command, all in lower case, before pressing
the Enter or Return key to run it.
1. pwd Command:

In Ubuntu (and other Unix-like operating systems), the pwd command stands for "print
working directory." It is used to display the full path of the current directory you are working
in. For example, if you are navigating through different directories in the terminal, using pwd
will show you the absolute path of your current location in the filesystem.

When you type a command in the terminal, it appears next to the "prompt," which is the
system's way of signaling it's ready for input. This is often referred to as the "command line."
After you run a command, its output (if any) appears in the terminal, followed by another
prompt, indicating it's ready for the next command. Some commands may output a lot of text,
while others may run silently without any output, which usually means they succeeded
without issues. The prompt simply reappears to show it's ready for more input.

2. cd Command:
The cd command in Ubuntu (and other Unix-like systems) is used to change directories in
the terminal. It allows you to navigate between different folders in the file system.

Example: $ cd documents # moves to 'documents' folder

$ cd .. # goes back to the parent folder


➢ Usage:
• cd directory_name: Changes to the specified directory.
• cd ..: Moves up one level to the parent directory.
• cd ~: Takes you to your home directory.
• cd /path/to/directory: Changes to an absolute path.
• cd -: Switches back to the previous directory.

3. Who am I Command:

The whoami command in Ubuntu (and other Unix-like systems) is used to display the
current logged-in user's username. It helps you identify which user account is currently
active in the terminal session.

Example: $ whoami
Username
➢ Creating folders and files:

In this section we’re going to create some real files to work with. To avoid accidentally
trampling over any of your real files, we’re going to start by creating a new directory, well away
from your home folder, which will serve as a safer environment in which to experiment:

1. mkdir Command:
• To create a directory in Ubuntu (or any Unix-like operating system), you use the
mkdir command, which stands for "make directory."
• Basic usage: mkdir directory_name
This creates a new directory with the specified name in the current location.
• Example: $ mkdir my_folder
This will create a folder named my_folder in the current directory.

A. Creating multiple directories at once:


mkdir dir1 dir2 dir3

B. Creating nested directories (parent and child directories):


mkdir -p parent_directory/child_directory
The -p option ensures that any missing parent directories are created as needed.
Example with -p: $ mkdir -p project/src/files

2. touch Command:-
• The touch command in Ubuntu (and other Unix-like operating systems) is primarily
used to create empty files. It can also be used to update the timestamp (modification
and access times) of existing files.
• Basic Usage: $ touch filename
• This creates an empty file with the name filename if it doesn’t already exist.

A. Create an Empty File:


touch myfile.txt
This will create an empty file named myfile.txt in the current directory.

B. Update the Timestamp of an Existing File: If the file already exists, touch will not
modify its contents, but it will update the file's modification and access times to the
current time.
touch existing_file.txt

C. Create Multiple Files at Once: You can create several files in one command:
touch file1.txt file2.txt file3.txt

D. Create Files with Specific Extensions: You can create files with any extension:
touch index.html script.js styles.css

E. Force Creation of Files (including when you don’t have write permissions): If
you don’t have permission to create the file, you can use the -c flag to prevent
touch from creating files if they don’t exist.
touch -c filename
3. nano Command:
• The nano command in Ubuntu (and other Linux systems) opens the Nano text editor,
which is a simple, user-friendly, command-line text editor. It’s widely used for
editing text files directly from the terminal.
• Basic Usage: nano filename
• This opens the file specified by filename in the Nano text editor. If the file does not
exist, Nano will create it.

A. Opening a File: Open or create a new file


nano myfile.txt

B. Editing the File:


• Once you're in Nano, you can start typing text to edit the file.
• You can use the arrow keys to move around in the file.

C. Common Keyboard Shortcuts:


• Save the File: Press CTRL + O (this stands for “write out”). It will prompt
for confirmation, where you can hit Enter to save.
• Exit Nano: Press CTRL + X to exit. If you made changes, Nano will ask if
you want to save them before exiting.
• Cut Text: Press CTRL + K to cut the selected text.
• Paste Text: Press CTRL + U to paste the text you cut.
• Search for Text: Press CTRL + W, type the search term, and press Enter.
• Undo: Press ALT + U to undo the last action.
• Redo: Press ALT + E to redo the undone action.

D. Creating a New File: If the specified file doesn't exist, Nano will create a new
file when you save it:
nano newfile.txt

4. echo Command:
The echo command in Ubuntu (and other Unix-like operating systems) is used to display a
line of text or string to the terminal. It’s commonly used in shell scripts and command-line
operations to output text or variables.
Basic Usage: echo [option] [string]
Example: echo "Hello, World!"

A. Display Text:
echo "This is some text."

B. Print the Value of Variables: You can use echo to display the value of shell
variables.
myvar="Linux"
echo "I am learning $myvar"

C. Create and Append Content to Files:


• To create or overwrite a file with the output of echo:
• echo "This is some content." > myfile.txt
• This writes This is some content. to myfile.txt. If the file doesn’t
exist, it will be created; if it does, it will be overwritten
• To append content to a file:
• echo "This is more content." >> myfile.txt
• This adds This is more content. to the end of myfile.txt.
5. cat Command:
• The cat command in Ubuntu (and other Unix-like operating systems) is used to
display the contents of files, concatenate multiple files, and create or append data to
files. The name "cat" comes from "concatenate," as it can combine and display the
content of multiple files.
• Basic Usage: cat [option] [filename]

A. Display the Content of a File:


cat filename.txt
This command will output the content of filename.txt to the terminal.

B. Concatenate Multiple Files: You can combine the contents of multiple files and
display them sequentially:
cat file1.txt file2.txt
This will print the contents of both file1.txt and file2.txt to the terminal.

6. rmdir Command:
• The rmdir command in Ubuntu (and other Unix-like systems) is used to remove
empty directories. It only works if the directory is completely empty. If the directory
contains any files or subdirectories, you’ll need to use the rm command with the -r
option to remove it recursively.
• Basic Usage: rmdir [directory_name]

A. Remove an Empty Directory:


rmdir emptydir
This will remove the directory named emptydir, but only if it contains no files or
subdirectories.

B. Remove Multiple Empty Directories:


rmdir dir1 dir2 dir3
This will attempt to remove dir1, dir2, and dir3, assuming they are all empty.

C. Remove a Directory and Its Parent Directories (--parents option):


Use the --parents (or -p) option to remove not only the directory but also any
parent directories, as long as they are empty.
rmdir -p dir1/dir2/dir3
This will remove dir3, and if dir2 and dir1 are also empty, they will be removed
too.
➢ Moving and manipulating files:

1. Copying Files(cp):
• The cp command is used to copy files and directories.
• Basic Syntax: cp [source] [destination]
• Example: cp file1.txt /home/user/Documents/
• This will copy file1.txt to the Documents folder.

A. Copy a File and Rename:


• cp file1.txt newfile.txt
• This will copy file1.txt and rename it to newfile.txt

B. Copy a Directory:
• Use the -r flag to copy directories recursively.
• cp -r dir1 /home/user/Documents/

2. Moving Files:
• The mv command is used to move or rename files and directories.
• Move a File: mv file1.txt /home/user/Documents/
• This will move file1.txt to the Documents directory.

A. Rename a File:
• mv oldname.txt newname.txt
• This renames oldname.txt to newname.txt

B. Move a Directory:
• mv dir1 /home/user/Documents/

4. Removing Files & Directories(rm):


• The rm command is used to delete files and directories.
• Remove a File: rm file1.txt
• This will delete file1.txt.

A. Remove Multiple Files:


rm file1.txt file2.txt

B. Remove a Directory: Use the -r flag to remove a directory and its contents
recursively.
rm -r dir1/

C. Force Remove: The -f flag can be used to forcefully remove a file, bypassing
any prompts.
rm -f file1.txt

5. Changin File Permission(chmod):


• The chmod command is used to change the permissions of a file or directory.
• Make a File Executable: chmod +x script.sh
• This will make the file script.sh executable.
A. Change Permissions for Owner, Group, and Others:
chmod 755 file1.txt
This gives the owner full access, and the group/others read and execute
permissions.

6. Listing of Files(ls):
• The ls command in Ubuntu (and other Unix-like operating systems) is used to list the
contents of a directory. It’s one of the most commonly used commands to view files
and directories.
• Basic Usage: ls [options] [directory]
• If no directory is specified, ls lists the contents of the current directory.

A. Basic Listing:
• ls
• This command lists the files and directories in the current directory. It
only shows the names, without any additional details.

B. List Files in a Specific Directory:


• ls /home/user/Documents
• This lists the contents of the /home/user/Documents directory.

C. Detailed Listing (-l option):


• ls -l
• This shows a detailed listing, including file permissions, number of links,
owner, group, file size, and modification date.
• Example: -rw-r--r-- 1 user user 1234 Oct 19 12:00 myfile.txt

D. List Hidden Files (-a option):


• Hidden files (files that start with a .) are not shown by default. Use the -a
option to display them:
• ls -a

E. Combine Detailed and Hidden Listing (-la or -al):


• To show a detailed listing that includes hidden files:
• ls -la
• This will display hidden files along with additional details like
permissions and file sizes.

➢ Process Status Commands(ps):


• The ps (process status) command in Ubuntu is used to display information about
currently running processes. It provides details like process IDs (PIDs), the command
running the process, memory and CPU usage, and more. It’s a useful tool for
monitoring system activity, especially when you want to inspect or manage processes.
• Basic Usage: ps [options]

A. Basic ps Command:
• ps
• This shows a snapshot of the current processes running in your shell. It
includes four columns: PID (Process ID), TTY (Terminal associated with
the process), TIME (CPU time used by the process), and CMD (command
that started the process).
B. List All Processes (-e or aux):
• To list all running processes on the system, use:
• ps -e or ps aux
• This displays all processes, including those not started from your terminal.

C. Detailed Process Information (-f option):


• For a full-format listing (more detailed information):
• ps -f

D. List Processes by a Specific User (-u):


• To see processes running under a specific user, use:
• ps -u username

E. Show Processes by Process ID (PID):


• To view details about specific processes by their PIDs:
• ps -p 1234
• This displays information about the process with PID 1234.

F. Hierarchical Process Tree (--forest or -ef --forest):


• To see processes in a tree-like structure (showing parent-child
relationships between processes):
• ps –forest

G. Filter Processes by Name (-C option):


• To view processes by name (e.g., all bash processes):
• ps -C bash

H. Show Processes for a Terminal Session (-T option):


• To view the processes associated with the current terminal:
• ps -T

I. List Processes with Resource Usage (aux format):


• To see resource usage such as CPU and memory for all processes:
• ps aux

➢ wait Command:
• The wait command in Ubuntu (and other Unix-like operating systems) is used to
pause script execution until specified background processes have completed. It waits
for the termination of the given process (PID) or all child processes if no PID is
specified. The wait command is primarily used in shell scripting to ensure that certain
processes finish before moving forward with the next command.
• Basic Usage: wait [PID]

A. wait [PID]:
• Description: Waits for the specific process with the given PID to
complete.
• Example:
sleep 10 &
PID=$!
wait $PID
echo "Process $PID finished"
B. wait without Arguments:
• Description: Waits for all background processes (child processes) to
complete.
• Example:
sleep 5 &
sleep 3 &
wait
echo "All background jobs finished"

C. wait -n:
• Description: Waits for any one of the background processes to complete
(i.e., the first one to finish).
• Example:
sleep 5 &
sleep 10 &
wait -n
echo "One of the processes has finished"
D. Exit Status:
• Description: The wait command returns the exit status of the waited-for
command.
• 0: If the command finished successfully.
• Non-zero: If the process terminated with an error or a non-zero exit status.
• Example:
sleep 2 &
PID=$!
wait $PID
echo "The exit status of the process is $?"
➢ Kill Command:
• The kill command in Ubuntu and other Unix-like systems is used to send signals to
processes, typically to terminate them. By default, the kill command sends the
SIGTERM signal, which gracefully terminates a process. However, other signals like
SIGKILL can be used to forcefully stop a process.
• Basic Syntax: kill [options] <PID>

A. kill [PID]:
• Description: Sends the default SIGTERM (signal 15) to the process with
the specified PID, allowing it to terminate gracefully.
• Example: kill 1234

B. kill -l:
• Description: Lists all available signals that can be sent using the kill
command.
• Example: kill -l
• This will display a list of signals like SIGHUP, SIGINT, SIGTERM, etc.

C. kill -s [signal] [PID]:


• Description: Sends the specified signal to the process.
• Example: kill -s SIGKILL 1234
• This sends a SIGKILL signal to the process to immediately force
termination.
D. killall [name]:
• Description: Terminates all processes with the given name (not just by
PID).
• Example: killall firefox

➢ Sleep Command:
• The sleep command in Linux and Unix-like systems is used to pause the execution of
a script or command for a specified amount of time. It is commonly used in shell
scripting to introduce delays between commands or to wait for a specific period
before continuing execution.
• Basic Syntax: sleep [NUMBER][SUFFIX]
• NUMBER: Specifies the amount of time to sleep.
• SUFFIX: Optional. Specifies the time unit. If no suffix is provided, the default unit is
seconds.

❖ Availabel Suffixes(Time Units):


• s: Seconds (default).
• m: Minutes.
• h: Hours.
• d: Days.

➢ Exit Command:
• The exit command in Linux and Unix-like systems is used to terminate a shell session
or script. When executed, it can return an exit status to the parent process, indicating
whether the script or command completed successfully or encountered an error.
• Basic Syntax: exit [n]
• n: An optional numeric argument that specifies the exit status. If no argument is
provided, the exit status of the last executed command is used.

➢ Advantages of Learning Ubuntu Commands:

• Enhanced Productivity: Faster task execution and automation of repetitive tasks


through scripting.
• Greater Control: Fine-tuned access to system configurations and operations
compared to GUIs.
• Problem-Solving Skills: Improved troubleshooting abilities and deeper
understanding of system behavior.
• Development and Scripting: Easier programming, compiling, and debugging;
efficient script creation for various tasks.
• Remote Management: Effective management of remote servers via SSH and
headless systems.
• Understanding System Internals: Insight into how operating systems function,
including file systems and processes.
• Cross-Platform Skills: Knowledge transferable to other Unix-like systems,
enhancing adaptability.
• Career Advancement: Increased job opportunities and competitive edge in tech
roles.
• Learning Resources: Access to extensive documentation and active community
support.
➢ Conclusion:
➢ Learning commands in Ubuntu and other Unix-like systems is an invaluable skill that
profoundly enhances your technical proficiency, efficiency, and problem-solving capabilities.
Mastery of the command line empowers you to execute tasks more quickly, automate
repetitive processes, and gain finer control over system configurations and operations. This
deeper understanding of operating system functionality is crucial for effective
troubleshooting, system monitoring, and resource management.
➢ Moreover, command-line skills are highly transferable, enabling you to adapt seamlessly to
various environments and technologies, from local machines to remote servers. This
adaptability is particularly important in today’s rapidly evolving tech landscape. As industries
increasingly rely on automation and cloud computing, proficiency in command-line
operations becomes essential.
➢ Acquiring these skills not only opens doors to numerous career opportunities in fields such as
system administration, software development, and DevOps but also gives you a competitive
edge in the job market. Employers often prioritize candidates who can navigate the command
line efficiently, as it reflects a deeper understanding of technology and a commitment to
continuous learning.
➢ Ultimately, learning commands equips you with the essential tools to work more efficiently,
customize your computing environment, and engage actively with the vibrant open-source
community. This holistic skill set not only contributes to your personal and professional
growth but also positions you as a versatile and capable technology professional in an
increasingly digital world

2.0 Aim Of The Micro-Project: To learn different types of Commands in Ubuntu.

3.0 Course Outcome Addressed :

a) Increased Efficiency.
b) Enhanced Control and Customization.
c) Empowerment through Automation.
d) Engagement with Open Source.
e) Greater Adaptability.

4.0 Actual Methodology Followed:

1) Firstly, a discussion will be held with group members and course coordinator and idea
about the topic will be encouraged.

2) The topic will be divided into several modules. Then each and every module.

3) A thorough research will be on the modules which will include all the key concepts related to each
modules of the microproject.

4) All the information shall be perfectly arranged into the Specified format and all the errors/mistakes
committed will be resolved.

5) Finally, the copy will be submitted to the concerned course

coordinator
1) Action Plan: 1-8 weeks

Name of the
Sr. Details of activity Start date Finish date responsible team
No. member.

1. Discussion of topic

2. Finalization of topic
Jayesh
3. Preparation of Abstract
Harihar
4. Submission of abstract

5. Literature survey

6. Collection of data

7. Collection of data

8. Discussion of content

2) Action Plan: 9-16 weeks


Name of the
Sr. Details of activity Start date Finis responsible team
No.
h date member.

9. Proof Reading of Content

10. Editing of Content

11. Editing of Content


Jayesh
12. Completion of Report
Harihar
13. Completion of Presentation

14. Viva

15. Presentation

16. Final Submission


5.0 Resources used

Sr.no Name of Resources Specifications Qualit Remark


y

1. Computer Intel core-i3,4GB 1


Ram,2.00GHz,64
bit OS,1Tb HDD

2. Internet -

3. Reference Books 2

6.0 Micro project program &

Output :

The output of learning Ubuntu commands includes enhanced proficiency in command-line interfaces and
scripting, leading to increased productivity through faster task completion and automation of repetitive
processes. It fosters improved troubleshooting abilities, enabling effective problem diagnosis and
proactive system monitoring. This skill set opens up expanded job opportunities in IT and related fields,
making individuals more marketable. Additionally, learning commands encourages community
engagement through participation in open-source projects and provides a deeper understanding of
computing systems. Ultimately, this knowledge boosts confidence and independence in managing
technology, making individuals valuable assets in any professional setting.

7.0 Skill Developed

• Communication skills
• Leadership
• Risk Management
• Cost control
• Negotiation
• Task Managemet

You might also like