0% found this document useful (0 votes)
8 views14 pages

Unix Linux Unit1 Detailed Notes

The document provides an overview of Unix/Linux operating systems, detailing their history, features, structure, and commands. It covers essential topics such as the boot process, user accounts, process management, and shell scripting, along with the advantages and disadvantages of Unix/Linux. Additionally, it highlights important commands and utilities for file manipulation, compression, and system administration.

Uploaded by

anshik004
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)
8 views14 pages

Unix Linux Unit1 Detailed Notes

The document provides an overview of Unix/Linux operating systems, detailing their history, features, structure, and commands. It covers essential topics such as the boot process, user accounts, process management, and shell scripting, along with the advantages and disadvantages of Unix/Linux. Additionally, it highlights important commands and utilities for file manipulation, compression, and system administration.

Uploaded by

anshik004
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

UNIT I — UNIX/LINUX COMMANDS WITH

USAGES
Unix/Linux is one of the most powerful and widely used operating systems in the world. It is used in
servers, cybersecurity, cloud computing, networking, software development, embedded systems, and
supercomputers. Linux is an open-source Unix-like operating system that supports multitasking, multiuser
operation, process management, memory management, security, shell scripting, and file systems.

1. History of Unix

Unix was developed in 1969 at Bell Laboratories by Ken Thompson, Dennis Ritchie,
and their team. Initially, Unix was designed as a small and efficient operating system
for programmers and researchers. In 1973, Unix was rewritten in the C programming language,
which made it portable across different hardware platforms.

Over time, many versions of Unix were developed such as BSD Unix, System V, Solaris,
and AIX. Linux was later created in 1991 by Linus Torvalds as a free and open-source
Unix-like operating system.

Features of Unix/Linux:
• Multiuser support
• Multitasking capability
• Security and permissions
• Portability
• Hierarchical file system
• Shell scripting support
• Networking capability

Advantages:
• Stable and reliable
• Efficient memory management
• Strong security
• Excellent command-line tools

2. Structure of Unix System and Environment


Unix architecture is divided into layers:

1. Hardware
2. Kernel
3. Shell
4. Utilities and Applications

Kernel:
The kernel is the core part of Unix/Linux.
Functions:
• Process management
• Memory management
• File management
• Device management
• CPU scheduling

Shell:
The shell acts as an interface between the user and kernel.
It accepts user commands and passes them to the kernel for execution.

Utilities:
Utilities are small programs used for performing specific tasks like file handling,
searching, compression, and networking.

Unix Environment:
The Unix environment consists of:
• Shell environment
• Variables
• Paths
• User configurations
• Login settings

3. Unix/Linux Startup Process

The startup process of Linux is known as booting.

Steps in Linux Boot Process:


1. BIOS/UEFI:
Checks hardware devices and initializes the system.

2. Boot Loader:
Loads the Linux kernel into memory.
Example: GRUB

3. Kernel Initialization:
Kernel initializes drivers, memory, CPU scheduling, and devices.

4. init/systemd:
Starts system services and background processes.

5. Login Prompt:
User login screen appears.

Types of Booting:
• Cold Booting
• Warm Booting

4. User Accounts in Linux

Linux supports multiple users.

Types of Users:
• Root user
• Normal user
• System user

Root User:
Has complete administrative privileges.

Important User Commands:


• useradd
• passwd
• userdel
• su
• sudo
• whoami
• id

Important Files:
/etc/passwd → user details
/etc/shadow → encrypted passwords
/etc/group → group information

Permissions:
Linux uses read, write, and execute permissions for security.

5. Accessing Linux

Linux can be accessed using:


• Terminal
• SSH
• GUI

Logging In:
The user enters username and password.

Logging Out:
Commands:
logout
exit

Remote Access:
SSH (Secure Shell) is widely used for secure remote login.

6. Process Management

A process is a program in execution.

Process States:
• Running
• Waiting
• Ready
• Stopped
• Zombie

Important Commands:
ps → display processes
top → real-time process monitoring
kill → terminate process
jobs → list background jobs
bg → background execution
fg → foreground execution

Foreground Process:
Runs directly on terminal.

Background Process:
Runs independently while terminal remains free.

Example:
firefox &

7. Unix/Linux Commands

File Commands:
ls → list files
pwd → present working directory
cd → change directory
mkdir → create directory
rmdir → remove directory
touch → create file

File Manipulation:
cp → copy
mv → move or rename
rm → remove file
cat → display content
head → first lines
tail → last lines

Search Commands:
grep → search patterns
find → locate files
locate → fast file search

Permission Commands:
chmod → change permissions
chown → change owner
chgrp → change group

8. Compression Utilities

Compression reduces file size and saves storage.

Commands:

zip:
zip [Link] [Link]

unzip:
unzip [Link]

compress:
compress [Link]

uncompress:
uncompress [Link].Z

tar:
Used for archiving multiple files.

Create archive:
tar -cvf [Link] folder/
Extract archive:
tar -xvf [Link]

Advantages:
• Saves disk space
• Faster file transfer

9. Types of Shells

A shell is a command interpreter.

Types:
• Bourne Shell (sh)
• Bash Shell (bash)
• Korn Shell (ksh)
• C Shell (csh)
• Z Shell (zsh)

Bash Features:
• Command history
• Auto completion
• Scripting support
• Variables
• Aliases

10. Shell Programming and Scripting

Shell scripting automates repetitive tasks.

Structure:

#!/bin/bash
echo "Hello Linux"

Features:
• Variables
• Loops
• Conditional statements
• Functions
• Arrays
• User input

Conditional Example:
if [ $a -gt $b ]
then
echo "A is greater"
fi

Loop Example:
for i in 1 2 3
do
echo $i
done

Advantages:
• Automation
• Faster task execution
• Reduced manual work
• System administration support

11. Unix File System

Unix uses a hierarchical file system.

Root Directory:
/

Important Directories:
/home → user files
/bin → system commands
/etc → configuration files
/dev → device files
/tmp → temporary files
/usr → user utilities

Features:
• Tree structure
• Security permissions
• Efficient storage management

12. Mounting and Unmounting File Systems

Mounting connects a storage device to the file system.

Commands:
mount /dev/sdb1 /mnt

Unmounting:
umount /mnt

Uses:
• USB drives
• Hard disks
• CD/DVD drives
• Network storage

Advantages:
• Organized storage access
• Dynamic device management

13. Linux/Unix Files

Everything in Unix/Linux is treated as a file.

Types of Files:
• Regular files
• Directories
• Character files
• Block files
• Links
• Pipes
• Sockets

Special Files:
Device files represent hardware devices.

14. i-node

An i-node stores metadata about files.

Contains:
• File permissions
• Owner information
• File size
• Timestamps
• Disk block addresses

Does Not Contain:


• File name

Importance:
• Efficient file access
• File tracking
• Storage management

View inode:
ls -i

15. File System Related Commands

df → disk free space


du → directory usage
fsck → file system check
mkfs → create file system
mount → attach file system
umount → detach file system

These commands are important for storage and disk administration.

16. Shell as Command Processor

The shell acts as command processor.

Flow:
User → Shell → Kernel → Hardware

Functions:
• Reads commands
• Interprets commands
• Executes programs
• Displays output

Examples:
ls
pwd
date

17. Shell Variables

Variables store values in shell scripts.

Examples:
name="Linux"
echo $name

Types:
• Local variables
• Environment variables
• Read-only variables
Important Environment Variables:
PATH
HOME
USER
SHELL
PWD

18. General Purpose Utilities

Utilities perform common tasks.

Examples:
sort → sort lines
uniq → remove duplicates
wc → word count
cut → extract columns
diff → compare files
sort → sorting
tee → redirect output

These utilities are heavily used in shell scripting and administration.

19. Advanced Unix Commands

grep:
Searches text patterns.

awk:
Pattern scanning and text processing utility.

sed:
Stream editor used for replacement and editing.

cron:
Schedules tasks automatically.
vi/vim:
Powerful text editor.

netstat:
Displays network connections.

ping:
Checks network connectivity.

Important for:
• System administration
• Networking
• Automation
• Log analysis

20. Advantages and Disadvantages of Unix/Linux

Advantages:
• Secure operating system
• Stable and reliable
• Open source
• Multiuser support
• Strong networking
• Excellent performance

Disadvantages:
• Difficult for beginners
• Command-line complexity
• Limited commercial software support
• Driver compatibility issues in some hardware

Important Topics for Exams

Most Important Topics for Examination:

1. Unix Architecture
2. Linux Booting Process
3. Shell Programming
4. File System and i-node
5. Process Management
6. Shell Variables
7. Compression Commands
8. grep, awk, sed
9. User Accounts and Permissions
10. Advanced Unix Commands

You might also like