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

Cpps Lab 1

The document details an experiment conducted by Mehul Totala on Linux commands and operating systems. It explains the role of an operating system, specifically Linux, its components, and various commands used for file and directory management. The conclusion emphasizes the insights gained about Linux's functionality and the importance of command-line proficiency.

Uploaded by

Mehul Totala
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 views11 pages

Cpps Lab 1

The document details an experiment conducted by Mehul Totala on Linux commands and operating systems. It explains the role of an operating system, specifically Linux, its components, and various commands used for file and directory management. The conclusion emphasizes the insights gained about Linux's functionality and the importance of command-line proficiency.

Uploaded by

Mehul Totala
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/ 11

CPPS Lab Experiment-1

Name: Mehul Totala


Roll no: 241040031
Aim: Study of Linux commands, language processors and
computer element

Theory:
What is an Operating System?
An operating system (OS) is a program loaded into a
system by a boot program that manages all the application
programs in a computer. It acts as an intermediary
between users and hardware. The OS provides services to
application programs via APIs and allows users to interact
with applications through CLI (Command Line Interface) or
GUI (Graphical User Interface). It ensures efficient
management of hardware resources and simplifies
application development by providing a consistent
environment.

Some Components of Operating system are:


 Process Management (Process is program under
execution)
 File Management
 Network Management
 Main Memory Management
 Secondary Storage Management
 I/O Device Management
 Security Management
 Command Interpreter System
What is LINUX?
Linux is a UNIX-like operating system that has been widely
used since the 1990s. It is open-source, meaning users can
modify and distribute it freely. Linux powers various
devices, from smartphones and televisions to
supercomputers and stock exchanges. It is known for its
security, stability, and flexibility.
It was created by Linux Torvalds from scratch.
There are several LINUX distributors, commonly called
“Distors”. A few of them are:
 Ubuntu
 Fedora
 Kali Linux
 Debran
 Red Hat
 Puppy
Components of Linux:
1. Bootloader: Manages the boot process of the system,
loading the OS into memory.
2. Kernel: The core of the OS, responsible for managing
CPU, memory, and hardware devices.
3. Init System: Initializes the user space and manages
system processes.
4. Daemons: Background services that handle tasks
such as printing, sound, and scheduling.
5. Graphical Server: Displays graphical output,
commonly referred to as the X server.
6. Desktop Environment: Provides the user interface,
such as GNOME, KDE, or Xfce.
7. Applications: Linux distributions include applications
like file managers, browsers, and text editors.
What is Linux Shell?
Shell is a program that receives commands from the user
and gives it to the OS to process and it shows the output.
Linux’s shell is it’s main part.

Commands in Linux:
sudo command
sudo stands for superuser do and is one of the most
popular basic Linux commands. It allows users to perform
tasks that require administrative or root permissions.
When using sudo, the system will prompt users to
authenticate themselves with a password. Then, the Linux
system will log a timestamp as a tracker.
By default, every root user can run sudo commands for 15
minutes per session.
If you try to run sudo in the command line without
authenticating yourself, the system will log the activity as a
security event.

pwd (Print Working Directory)


pwd stands for Print Working Directory. It prints the path of
the working directory, starting from the root. When you
first open the terminal, you are in the home directory of
your user. To know which directory you are in, you can use
the “pwd” command. It gives us the Absolute Path, which
means the path that starts from the root. The root is the
base of the Linux filesystem. It is denoted by a forward
slash (/). The user directory is usually something like
/home/username.
Syntax:
pwd
This command has two flags:
 pwd -L : Prints the symbolic path.
 pwd -P : Prints the actual path.
cd (Change Directory)
The cd command in Linux is used to navigate between
directories. It allows users to move from one directory to
another within the filesystem. By default, when you open a
terminal, you start in your home directory.
Flags of cd:
 cd Documents → Moves into the "Documents"
directory.
 cd .. → Moves one level up to the parent directory.
 cd - → Switches back to the last directory you were in.
 cd / → Moves to the root directory.
 cd ~ or cd → Moves to the home directory.
ls (List Directory Contents)
The ls command is used to list the contents of a directory,
such as files and subdirectories. By default, it lists the
contents of the current directory.
Syntax: ls [options] [directory]
Flags of ls:
 ls → Lists the files and directories in the current
directory.
 ls /home/user/Documents → Lists the contents of the
"Documents" directory.
 ls -l → Displays detailed information like permissions,
owner, size, and modification date.
 ls -a → Shows all files, including hidden ones (which
start with .).
 ls -lh → Displays human-readable file sizes (e.g., KB,
MB, GB instead of bytes).
 ls -R → Lists all files and directories recursively.

mkdir (Make Directory)


The mkdir command in Linux allows the user to create
directories (also referred to as folders in some operating
systems). This command can create multiple directories at
once as well as set the permissions for the directories.
It is important to note that the user executing this
command must have enough permissions to create a
directory in the parent directory, or he/she may receive a
‘permission denied’ error.
Syntax:
mkdir [options] [directories]
Example:
If you want to make a directory called “DIY”, then you can
type:
mkdir DIY

rmdir/rm (Remove Directory)


The rmdir command is used for deleting a directory.
However, rmdir can only be used to delete an empty
directory.
Remember that the user running this command should
have sudo privileges in the parent directory.
Example:
If you want to remove an empty subdirectory named
"personal1" and its main folder "mydir":
rmdir -p mydir/personal1

man
The man command in Linux is used to display the user
manual of any command that we can run on the terminal. It
provides a detailed view of the command, which includes
NAME, SYNOPSIS, DESCRIPTION, OPTIONS, EXIT
STATUS, RETURN VALUES, ERRORS, FILES,
VERSIONS, EXAMPLES, AUTHORS, and SEE ALSO.
Syntax: man [COMMAND NAME]

touch
The touch command is used to create a file. It can be
anything, from an empty .txt file to an empty .zip file.
Syntax: touch new.txt

rm
The rm command is used to remove a file.

echo
The echo command is a built-in utility that displays a line of
text or string using the standard output.
Syntax: echo [option] [string]

This command supports many options, such as:


 -n : Displays the output without the trailing newline.
 -e : Enables the interpretation of the following
backslash escapes:
 \a : Plays a sound alert.
 \b : Removes spaces in between a text.
 \c : Produces no further output.
 -E : Displays the default option and disables the
interpretation of backslash escapes.

Conclusion
Through this experiment, I have gained valuable insights
into operating systems, particularly Linux. I learned that an
operating system acts as an interface between the user
and hardware, managing resources efficiently. Linux, an
open-source OS, offers powerful features like multitasking,
security, and flexibility. Understanding its components,
such as the bootloader, kernel, and daemons, provided a
clearer view of how the system functions.
Additionally, working with Linux commands enhanced my
command-line proficiency. Commands like man, touch,
echo, cd, and ls helped me navigate, manage files, and
retrieve information effectively. This experiment
strengthened my understanding of Linux OS and reinforced
the importance of command-line operations in system
administration.

You might also like