Linux Operating System — Study Notes

Unit 02

Terminal navigation, file management, permissions, processes and scheduling — organized as exam-ready answers.

7 Questions5 Marks EachLinux Operating System
01
5 Marks Question

Explain Navigation Commands

Linux navigation commands are used to view, create, remove, list, and move between directories through the terminal. The main commands are pwd, cd, mkdir, rmdir, ls, and tree.

pwd — Print Working Directory
Shows the complete path of the current working directory.
cd — Change Directory
Moves between directories using absolute or relative paths.
mkdir / rmdir
Creates a new directory or removes an empty directory.

Common Syntax

$ pwd
$ cd /home/user/Pictures
$ mkdir mydirectory
$ rmdir mydirectory
$ ls -al
$ tree Documents

Quick Revision

CommandFunction
pwdShows the current directory
cdChanges the current directory
mkdirCreates a directory
rmdirRemoves an empty directory
lsLists files and directories
treeDisplays directory hierarchy
In shortLinux provides navigation commands such as pwd to show the current directory, cd to change directories, mkdir to create directories, rmdir to remove empty directories, ls to list contents, and tree to display the directory hierarchy.
02
5 Marks Question

Explain File Management Commands

File management commands in Linux are used to create, view, copy, move, rename, and delete files and directories. The main commands are cat, rm, cp, mv, and touch.

cat
Creates, displays, combines, and copies text file contents.
rm
Deletes files and directories; -r and -rf remove folders recursively.
cp / mv / touch
Copy, move or rename files, and create empty files or update timestamps.

Examples

cat > filename
cat file1 file2 > file3
rm sample.txt
cp original_file new_file
mv test.txt newtest.txt
touch demo.txt
Quick reminder: cat handles file contents, rm deletes files, cp copies files, mv moves or renames files, and touch creates empty files or updates their timestamps.
03
5 Marks Question

Explain File Permissions and Ownership Commands

Linux is a multi-user operating system, so file permissions and ownership are used to protect files and directories from unauthorized access. Linux provides two levels of authorization: Ownership and Permissions.

Ownership

User (u)
The owner of the file.
Group (g)
A group of users sharing the same permissions.
Other (o)
All other users who are neither owner nor group members.

Permissions

PermissionSymbolValueMeaning
Readr4Allows reading the file
Writew2Allows modifying the file
Executex1Allows executing the file

Important Commands

chmod 764 sample.txt
chmod u+x file.txt
chmod g-w file.txt
chown faizan sample.txt
chown faizan:students sample.txt
chgrp students sample.txt
umask
umask -s
umask 0022
Remember: chmod changes permissions, chown changes owner, chgrp changes group ownership, and umask controls default permissions for newly created files and directories.
In shortLinux uses read (r), write (w), and execute (x) permissions for the user, group, and others. The commands chmod, chown, chgrp, and umask are used to manage these permissions and ownership settings.
04
5 Marks Question

Explain Common System Commands

Common system commands in Linux are used to perform basic system operations such as checking logged-in users, displaying information, getting help, viewing date and time, and clearing the terminal.

who / whoami
Shows logged-in users and the current user name.
man / echo
Provides command help and displays text output.
date / clear
Displays date and time, or clears the terminal screen.

Examples

who
whoami
man ls
echo "Hello, World!"
date +%d/%m/%Y
clear
CommandPurpose
whoShows currently logged-in users
whoamiShows the current user's name
manDisplays the manual/help for commands
echoDisplays text or command results
dateDisplays or sets date and time
clearClears the terminal screen
05
5 Marks Question

Explain Text Processing Commands

Text processing commands in Linux are used to view, extract, sort, compare, transform, filter, count, and redirect text data stored in files.

head / tail
Show the beginning or end of a file.
cut / sort / cmp
Extract, order, or compare file contents.
tr / uniq / wc / tee
Translate text, remove duplicates, count data, or duplicate output.

Examples

head sample.txt
tail -f sample.txt
cut -d "," -f 2 file.txt
sort -r file.txt
cmp -s file1 file2
tr 'a-z' 'A-Z'
uniq -c file.txt
wc -l file.txt
ls | tee output.txt
Quick memory trick: head = start, tail = end, cut = extract, sort = arrange, cmp = compare, tr = transform, uniq = remove adjacent duplicates, wc = count, tee = show and save.
06
5 Marks Question

Explain Process Control Commands

A process is an instance of a program currently running in the system. Process control commands are used to view, control, move, and terminate running processes in Linux.

ps / top
Displays process status and running processes in real time.
bg / fg
Moves a process between background and foreground.
kill / nice
Terminates processes or sets their priority.

Examples

ps -e
ps -f
ps ux
bg %1
fg %1
top
kill 1234
kill -9 1234
nice -n 10 firefox
CommandFunction
psDisplays process status
bgResumes a process in the background
fgBrings a process to the foreground
topDisplays running processes in real time
killTerminates a process
niceSets the priority of a process
07
5 Marks Question

Explain Job Scheduling Commands

Job scheduling in Linux is used to automatically execute commands or tasks at a specified time or under specified conditions.

at
Schedules a one-time job at a specified time.
batch
Runs a job when the system load is low.
cron / crontab
Runs recurring jobs and manages schedules.

Examples

at 10:30 PM
at now + 1 hour
batch
cron
crontab -e
crontab -l
crontab -r
0 8 * * * /home/user/script.sh
CommandPurpose
atSchedules a one-time job at a specified time
batchRuns a job when system load is low
cronService for recurring / periodic jobs
crontabCreates and manages cron schedules
In shortUse at for one-time tasks, batch for tasks based on system load, and cron/crontab for tasks that need to run repeatedly at scheduled intervals.