IMPLEMENTATION OF LINUX
COMMANDS
Display System Information :
a. uname: It shows the kernel name (Linux on Ubuntu).
b. hostname: Shows the system current network name.
c. date: Displays the current date, time, timezone, and year.
d.whoami: Shows the currently logged-in username.
e.uptime: Displays how long the system has been running
and load average.
File Operations:
a.cat : used for multiple tasks like reading,
combining, and creating text files.
To create a new file and type the contents directly
in the terminal. (Ctrl+D to save and exit .)
➢ To append content to an existing file.
➢ To display the contents of a file.
➢ Create another file.
➢ View multiple files together.
➢ Combine multiple files to a single file.
b. touch: To create empty files.
c. cp: To copy files or directories from one location to
another.
d. mv: To move and rename file and directories.
➢ To move a file from one location to another .
➢ To rename a file .
➢ Rename and move at the same time.
e.chmod : Make files executable.
f. usmask: Sets the default permission mask for
newly created files and directories in Linux/Unix.
Create , view and navigate directories:
a. mkdir: To create new directories
b. rmdir: To remove directory.
c. cd: To change directory.
➢ Go to a specific directory.
➢ Go to home directory
d. pwd: Prints current working directory.
Disk commands:
a. du : To show the disk usage i.e. how much space
files or directories are consuming.
b. df : (disk free) To show how much space is free in
the disk.
c. mount: To mount another filesystem to your system.
d. unmount : To unmount the filesystem from the
system.
e. mkfs: To create a new filesystem in storage device
or partition .
f. fsck : Used to check and repair filesystems on
storage.
NOTE: mount , unmount , mkfs and fsck commands
should be used carefully as they can have significant
changes to your system.
Redirection and piping commands :
a. Redirection: It changes where input comes from or
where output goes.
Output Redirection
> : Redirects output to a file (overwrites the file).
>> : Redirects output to a file (appends instead of
overwrite).
Input Redirection
< : Takes input for a command from a file.
(Reads data from names.txt and sorts it.)
b. piping : Sends the output of one command as the
input to another command.
ex: ls | wc -l
(Counts how many files are in the current directory)
Archiving and compression :
a. tar : (tape archive) Combines multiple
files/directories into a single archive file.
➢ Without compressing
➢ With compression.
b.gzip : Compresses a single file in .gz format.
c. gunzip : Decompresses a compressed .gz file.
d. zip : Archives and compresses multiple file in .zip
format.
e. unzip: Extracts file from a .zip file.
Process commands :
a. ps : To display information about active processes.
b.Kill : Sends a signal to a process by PID to terminate
it.
c. Killall : Sends a signal to all process by process
name to terminate it without PID.
d.pgrep : Searches process by their name and return
their PID.
e.nice : Runs a program by giving specific scheduling
priority (default 0 , lower has more priority than
higher).
f. top : Displays real-time, dynamic information about
running processes, including CPU usage, memory
usage, runtime, etc.
g. htop : A more user friendly version of top with
colourful interface scrollable mouse , etc.
Network Commands :
a. ifconfig : Show IP address, netmask, and other
network details.
b. ping : Test network connectivity between user and
another host
c.netstat : Display network connections , interface
statistics , etc
d.host : finds ip address and domain name of an ip
address
e.ip route: Used to view and manipulate system
routing table.
f. ip addr : Replacement for ifconfig command.
Administrator commands:
1. adduser / useradd
2. passwd
3. deluser / userdel
4. usermod
5. groupadd
System Calls in Unix/Linux :
A system call is a way for programs to request
services from the operating system kernel (like file
operations, process control, device handling, etc.).
Types of System Calls with Examples:
1.Process Control
Used to create, terminate, or control processes.
Examples:
fork() → Create a new process.
exec() → Run a new program.
exit() → Terminate process.
wait() → Wait for a child process.
2.File Management
Used to create, delete, read, and write files.
Examples:
open() → Open a file.
read() → Read data from a file.
NOIDA INSTITUTE OF ENGINEERING & Session:
2025-26
TECHNOLOGY, GR. NOIDA III Semester
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
write() → Write data to a file.
close() → Close a file.
unlink() → Delete a file.
3.Device Management
Used to request or release devices.
Examples:
ioctl() → Control device.
read() / write() → For device I/O.
4.Information Maintenance
Used to get or set system information.
Examples:
getpid() → Get process ID.
alarm() → Set a timer.
getuid() → Get user ID.
5. Communication
Used for inter-process communication (IPC).
Examples:
pipe() → Create a pipe for communication.
shmget() → Allocate shared memory.
mmap() → Map files into memory.
msgget() → Message queue.
Operating System Lab (BCSE0353)
Index
“LINUX COMMANDS”
Programs Date Signature Grade
1 Introduction of Unix/Linux Operating system and their
architecture
2 Display system information using uname, hostname, and
date etc.
3 File operations using cat, touch, cp, mv, rm, and
chmod ,umask etc.
4 Create, view, and navigate directories using mkdir, rmdir, cd,
pwd, ls etc
5 Disk Commands df,du,mount,unmount,mkfs,fsck etc.
6 Use redirection and piping in commands.
7 File compression and archiving using tar, gzip, zip, unzip etc.
8 Process commands ps,kill, killall,nice, pgrep, top,htop etc.
9 Network commands ifconfig, ping, netstat, host,ip route etc.
10 Administrator Commands Adduser,Passwd, deluser,
usermod, groupadd etc
11 Implement different types of system calls in Unix/Linux.
“SHELL SCRIPTING PROGRAMS”
Programs Date Signature Grade
1 Write a shell script to ask your name, program name and
enrollment number and print it on the screen.
2 Write a shell script to find the sum, the average and the
product of the four integers entered.
3 Write shell script to find average of numbers given at
command line
4 Write a shell program to exchange the values of two variables
5 Write a shell program to Print Numbers 1 to 10 using while &
do while loop.
6 Write a shell program to Print Numbers 1 to 10 using for loop.
7 Write a shell script to display the digits which are in odd
position in a given 5-digit number.
8 Write a shell program to search for a given number from the
list of numbers provided using binary search method.
9 Write a shell program to concatenate two strings and find the
length of the resultant string
10 Write a shell script to find the smallest of three numbers
11 Write a shell program to count number of words, characters,
white spaces and special symbols in a given text