0% found this document useful (0 votes)
2 views2 pages

UNIX Practical Summary

This document outlines practical UNIX commands and their outputs across various categories including calendar and date, directory commands, file operations, comparing files, permissions, file search and sorting, shell scripts, control structures, background processes, and print/display commands. Each section provides specific commands along with their expected outputs. The document serves as a comprehensive guide for executing basic UNIX tasks.

Uploaded by

Abhay Shaw
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)
2 views2 pages

UNIX Practical Summary

This document outlines practical UNIX commands and their outputs across various categories including calendar and date, directory commands, file operations, comparing files, permissions, file search and sorting, shell scripts, control structures, background processes, and print/display commands. Each section provides specific commands along with their expected outputs. The document serves as a comprehensive guide for executing basic UNIX tasks.

Uploaded by

Abhay Shaw
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
You are on page 1/ 2

UNIX Practical Assignment (Summary with Output)

1. Calendar and Date

Command: cal

Output:

May 2025

Su Mo Tu We Th Fr Sa

1 2 3

4 5 6 7 8 9 10

...

Command: date

Output:

Thu May 1 10:30:00 IST 2025

2. Directory Commands

pwd -> /home/user

cd Documents -> (no output)

mkdir test -> creates test directory

rmdir test -> removes test directory

3. File Operations

cat > file.txt -> create file

cat file.txt -> Hello, this is UNIX.

cp file.txt copy.txt

mv copy.txt newname.txt

rm newname.txt

4. Comparing Files

cmp file1 file2 -> file1 file2 differ: byte 9, line 2

diff file1 file2 -> shows line differences


UNIX Practical Assignment (Summary with Output)

5. Permissions and Ownership

ls -l -> -rw-r--r-- 1 user user 24 May 1 10:30 file.txt

chmod o+wx file.txt

chown user2 file.txt

6. File Search & Sorting

grep -i "unix" file.txt -> Unix is powerful.

sort file.txt -> alphabetically sorts lines

wc file.txt -> 3 6 42 file.txt

7. Shell & Scripts

echo $SHELL -> /bin/bash

Script:

#!/bin/bash

echo "Hello World"

Run with: ./script.sh -> Hello World

8. Control Structures

if [ $a -eq $b ]; then echo "Equal"; else echo "Not Equal"; fi

case "$car" in "bmw") echo "BMW car";; esac

9. Background Process

sleep 5 & -> [1] 1234

ps -> shows running processes

10. Print & Display

head file.txt -> first 10 lines

tail file.txt -> last 10 lines

pr -2 file.txt -> prints file in 2 columns

You might also like