Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
6 views

unix programming chapter basics

The document outlines the fundamentals of Unix programming and the installation process of the Unix operating system, emphasizing core principles such as file handling, modularity, multitasking, and security. It also details the steps for installing Unix, including choosing a distribution, creating bootable media, partitioning, and post-installation updates. Additionally, it covers general-purpose utility commands in Unix that facilitate efficient file and process management.

Uploaded by

v.badlani125
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

unix programming chapter basics

The document outlines the fundamentals of Unix programming and the installation process of the Unix operating system, emphasizing core principles such as file handling, modularity, multitasking, and security. It also details the steps for installing Unix, including choosing a distribution, creating bootable media, partitioning, and post-installation updates. Additionally, it covers general-purpose utility commands in Unix that facilitate efficient file and process management.

Uploaded by

v.badlani125
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Shri Vaishnav Vidyapeeth Vishwavidyalaya, Indore

Shri Vaishnav Institute of Information Technology

Experiment No. 1

AIM: Explain Unix programing also explain installation of unix operating system

Outcome:-
Unix programming is the creation of efficient, secure, and scalable applications that automate
tasks and interact with system resources.
Objectives :-
Understand Unix Installation and Learning Unix programing.

Theory: -

Introduction:
Unix programming is based on several core principles that make it a powerful and flexible
operating system for software development. The theory behind Unix programming includes the
following fundamental concepts:
Everything is a File:
In Unix, everything is treated as a file, including devices, processes, and directories. This
unified approach simplifies file handling. For example, hardware devices like printers or
network interfaces are accessed just like files.
Modularity:
Unix follows the principle of "small tools doing one thing well." This allows developers to
combine various utilities to build powerful applications by creating small, modular
components. For instance, text processing utilities like grep, awk, and sed can be
combined in pipelines to process data in real-time.
Multitasking and Process Management:
Unix supports multitasking and process management. Processes are created, scheduled,
and terminated by the kernel. Unix provides features like fork() (to create child processes)
and exec() (to run programs) for efficient multitasking. Inter-process communication
(IPC) and signals are used to manage processes and synchronize tasks.
Security and Permissions:
Unix employs a permission-based security model to control access to files and system
resources. Each file and process has an owner, group, and permission settings (read,
write, execute), which ensures that only authorized users can perform certain actions.
Shri Vaishnav Vidyapeeth Vishwavidyalaya, Indore
Shri Vaishnav Institute of Information Technology

Shell Scripting:
Unix shell scripting allows automation of tasks using command-line interfaces (CLI).
Shells like Bash provide scripting capabilities to automate system administration tasks,
file manipulation, and program execution. Scripts are sequences of commands that are
executed in a shell, enabling batch processing of tasks.

Pipes and Filters:


Unix allows programs to be linked together using pipes (|), allowing data to flow from
one program to another. This facilitates efficient data processing by chaining small
utilities. A typical Unix command can take input from a file, process it, and output the
result to another command.
Portability:
Unix systems adhere to the POSIX (Portable Operating System Interface) standards,
which make programs written for Unix systems portable across different hardware
platforms. This allows software to run on various Unix-based systems (e.g., Linux,
macOS, FreeBSD) without modification.
File System Hierarchy:
Unix has a hierarchical file system where all files are part of a single directory tree,
starting from the root directory /. This structure makes it easy to organize files,
directories, and system resources.
Unix Architecture :-

The main concept that unites all the versions of Unix is the following four basics −

 Kernel: The kernel is the heart of the operating system. It interacts with the hardware and most
of the tasks like memory management, task scheduling and file management.

 Shell: The shell is the utility that processes your requests. When you type in a command at your
terminal, the shell interprets the command and calls the program that you want. The shell uses
standard syntax for all commands. C Shell, Bourne Shell and Korn Shell are the most famous
shells which are available with most of the Unix variants.

 Commands and Utilities: There are various commands and utilities which you can make use of in
your day to day activities. cp, mv, cat and grep, etc. are few examples of commands and utilities.
There are over 250 standard commands plus numerous others provided through 3rd party
software. All the commands come along with various options.

 Files and Directories: All the data of Unix is organized into files. All files are then organized into
directories. These directories are further organized into a tree-like structure called the filesystem.
Shri Vaishnav Vidyapeeth Vishwavidyalaya, Indore
Shri Vaishnav Institute of Information Technology

Installation of Unix operating system :-

Installing a Unix operating system involves setting up the environment where Unix can run and
ensuring that the system is configured to meet the user's needs. The key steps and theory behind
installing a Unix OS include:
1. Choosing the Distribution:
Unix systems come in different variants, such as Linux distributions (Ubuntu, Fedora),
FreeBSD, or macOS. The choice depends on the user's needs, such as hardware
compatibility, package management, and system features.
2. Creating Bootable Media:
The installation process begins with downloading the ISO file of the chosen Unix OS. This
ISO is then used to create bootable media (USB stick or DVD) using tools like Rufus (for
Windows) or dd (for Unix systems).
3. Partitioning and Disk Setup:
During installation, the system disk must be partitioned to create spaces for the operating
system, files, and data. This is typically done manually or automatically using an installer.
The partitioning scheme (e.g., MBR or GPT) is chosen based on the system’s needs.
4. Installation Process:
The installer guides the user through setting up language preferences, timezone, and user
accounts. The system will also install the base operating system along with additional
software packages, such as desktop environments (for graphical interfaces), utilities, and
development tools.
5. System Configuration:
After installation, the system needs to be configured for networking, user permissions,
and system services. This includes setting up the network interface, configuring the
firewall, and ensuring the system is ready for regular use.
6. Post-Installation Updates:
After installation, it is essential to update the system to ensure that the latest security
patches and software packages are applied. This can be done via package managers like
apt (Ubuntu), yum (CentOS), or pkg (FreeBSD).
7. Rebooting and Booting into Unix:
Once installation and configuration are complete, the system is rebooted. The Unix
operating system will boot into its default shell or graphical environment, where users can
begin interacting with the system.
Shri Vaishnav Vidyapeeth Vishwavidyalaya, Indore
Shri Vaishnav Institute of Information Technology

Experiment No. 2

AIM: Study of unix genral purpose utility command.

Outcome:-
studying Unix general-purpose utility commands is mastering efficient file, process, and system
management through powerful command-line tools.
Objectives :-
Understanding Unix General-Purpose Utility Commands

Theory: -

Introduction:
Unix is a powerful, multi-user, multitasking operating system that provides a vast array of utility
commands to manage files, processes, system resources, and network activities. These general-
purpose utility commands form the core set of tools that users and system administrators rely on
to perform day-to-day operations efficiently. From file management to process monitoring, text
manipulation, and system configuration, Unix utilities offer flexibility and control through the
command-line interface (CLI). Understanding these utilities is crucial for effectively working with
Unix-based systems, as they enable users to automate tasks, troubleshoot issues, and manage
system resources in a streamlined and efficient manner.

1. Calendar Commands (cal)


cal → Displays the current month’s calendar.
cal -y → Displays the calendar for the entire current year.
cal [month] [year] → Shows the calendar for a specific month and year (e.g., cal 5 2024 for May
2024).
cal 2025 → Displays the full calendar for the year 2025.
cal -3 → Shows the previous, current, and next month's calendar.

2. Date Commands (date)


date → Displays the current system date and time.
date -u → Displays the current date and time in UTC/GMT.
date --date="1 year ago" → Shows the date exactly one year ago.
date --date="yesterday" → Shows the date of the previous day.
date --date="1 day ago" → Another way to get yesterday’s date.
date --date="5 days ago" → Displays the date from five days ago.
Shri Vaishnav Vidyapeeth Vishwavidyalaya, Indore
Shri Vaishnav Institute of Information Technology

3. Echo Command (echo)


echo "Hello, World!" → Prints "Hello, World!" to the terminal.
echo $HOME → Displays the path of the home directory.

4. Printf Command (printf)


printf "Hello, %s!\n" "World" → Prints formatted output ("Hello, World!").

5. Basic Calculator (bc)


echo "5+3" | bc → Performs basic arithmetic and returns 8.
bc → Opens an interactive calculator. You can type expressions like 10/3 to get a result.

6. Change Password (passwd)


passwd → Allows a user to change their password. It will prompt for the current and new
passwords.

7. Command History (history)


history → Displays the list of previously executed commands.

8. Listing Files (ls)


ls → Lists all files and directories in the current directory.
ls -l → Displays detailed information about each file.
ls -a → Shows all files, including hidden ones (files starting with .).

9. Create Directory (mkdir)


mkdir directory_name → Creates a new directory with the specified name.

10. Show Current Directory (pwd)


pwd → Displays the full path of the current working directory.

11. Who is Logged In (who)


who -a → Shows all logged-in users and system information.
who --all → Same as who -a, displays user details.
who -q -H → Shows the list of logged-in users with a header.

12. Find Files (find)


find . -name "A_text" → Searches for a file named "A_text" in the current directory (. refers to the
current directory).
find /home -name "*.txt" → Searches for all .txt files in the /home directory.
find / -type d -name "Documents" → Finds directories named "Documents" across the system.

You might also like