0% found this document useful (0 votes)
15 views13 pages

Introduction to Linux: History & CLI Basics

The document provides a comprehensive overview of Linux, detailing its history from the GNU Project in the 1980s to its current role in cloud computing and mobile systems. It covers essential command line interface (CLI) commands for file management, process management, user management, and system information, along with an introduction to shell scripting. Key commands like ls, cd, chmod, and ps are explained, highlighting their functionalities and usage.

Uploaded by

animatedmovies82
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views13 pages

Introduction to Linux: History & CLI Basics

The document provides a comprehensive overview of Linux, detailing its history from the GNU Project in the 1980s to its current role in cloud computing and mobile systems. It covers essential command line interface (CLI) commands for file management, process management, user management, and system information, along with an introduction to shell scripting. Key commands like ls, cd, chmod, and ps are explained, highlighting their functionalities and usage.

Uploaded by

animatedmovies82
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Q1.

Introduction to Linux
History of Linux
1980s: The Foundation
 1983 - The GNU Project: Richard Stallman launched the GNU Project (GNU stands for
"GNU's Not Unix!"), an effort to create a complete, free, Unix-like operating system
composed entirely of free software. By the early 1990s, the project had developed most
of the necessary components, such as compilers (GCC) and utilities, but lacked a usable
kernel.
1991: The Birth of the Kernel
 1991 - Linus Torvalds: A Finnish student at the University of Helsinki, Linus Torvalds,
began working on a simple kernel for his personal computer as a hobby, inspired by the
MINIX operating system (a small Unix-like system for teaching).
 September 17, 1991: Torvalds publicly released the first version of his kernel, version
0.01. He named it Linux (a mix of his name, Linus, and Unix).
1992–1994: Combining Forces and Maturation
 1992 - GPL and GNU/Linux: Torvalds relicensed the kernel under the GNU General
Public License (GPL). This was a pivotal moment, as it allowed the Linux kernel to be
combined with the existing tools from the GNU Project, resulting in the first complete,
fully free operating system, often referred to as GNU/Linux.
 1993 - Early Distros: The first major Linux distributions, like Slackware and Debian,
began to emerge, bundling the kernel and GNU software into user-installable packages.
 1994 - Linux 1.0: Torvalds released Linux 1.0.0, the first stable version of the kernel,
marking its official maturity.
Late 1990s and Beyond: Commercial and Desktop Growth
 1996 - Tux the Penguin: Tux, the cheerful penguin mascot, was created for Linux.
 Late 1990s: Companies like Red Hat and SUSE began offering commercial Linux
distributions and support, driving enterprise adoption. Graphical desktop environments
like KDE (1998) and GNOME (1999) significantly improved the user experience.
 2000s - Enterprise and Desktop: Major corporations like IBM announced significant
investments in Linux, cementing its role in the server market. User-friendly desktop
distributions, most notably Ubuntu (2004), made Linux more accessible to general users.
 2008 - Android: Google released the Android operating system, which is based on the
Linux kernel, leading to Linux's dominance in the mobile market.
 2010s - Cloud and Supercomputing: Linux became the foundational operating system for
nearly all cloud computing services (AWS, Azure, Google Cloud) and continues to
power virtually all of the world's supercomputers, demonstrating its immense scalability
and stability.
The Command Line Interface (CLI)
The Command Line Interface (CLI) is a text-based interface for interacting with a
computer's operating system. Instead of clicking icons and navigating menus (like in a
Graphical User Interface or GUI), you type commands using your keyboard to execute tasks.
1. The Shell
The Shell is a program that acts as an interpreter between you and the operating system's
kernel.
 It accepts your text commands.
 It interprets them (parses the command, arguments, and options).
 It executes the requested programs or operations.
 It displays any resulting text output (like data, status, or error messages).
2. The Command Structure
A typical command follows this structure:
$$\text {Command} \ \text {Argument}(\text{s}) \ \text {Option}(\text{s}) $$
 Command: The name of the program or function you want to run (e.g., ls, cd, mkdir).
 Options/Flags: Modify the command's behaviour, usually preceded by a single hyphen
(-) for a short option or a double hyphen (--) for a long option (e.g., ls -l for a detailed
list, or ls --human-readable).
 Arguments: The data the command operates on, typically a file or directory path (e.g.,
cd /home/user/Documents).
3. Navigation and Paths
The CLI uses a hierarchical file system (like an inverted tree). You are always located in
a current working directory (CWD).
 PWD (Print Working Directory): Shows the full path of your current location.
 ls (List): Shows the files and folders in your current directory.
 cd (Change Directory): Moves you to a different directory.
o Absolute Path: Starts from the root directory (/), like /home/user/Documents.
o Relative Path: Starts from your current location, like Documents (if you're in the
/home/user directory).
o . (Single Dot): Represents the current directory.
o .. (Double Dot): Represents the parent directory.
o ~ (Tilde): Represents your home directory (e.g., /home/user).
4. Basic File & Directory Management

Command Action Example

mkdir Make directory mkdir new folder

rmdir Remove directory (must be empty) rmdir old folder

touch Create an empty file touch [Link]

cp Copy a file or directory cp [Link] /tmp/

mv Move/Rename a file or directory mv [Link] [Link]

rm Remove (delete) files rm bad_file.txt

Q2) Basic File and Directory Management


1s: Listing files and directories.
The ls command (short for list) is one of the most fundamental and frequently used commands
in the Linux command line interface (CLI). Its primary purpose is to list the contents of a
directory.

(cd):Changing Directories
The cd command (short for change directory) is the essential command for navigating the
Linux file system. It changes your Current Working Directory (CWD) to a different location.
When you execute a command, it runs within the CWD. By using cd, you tell the shell to move
your location, which affects where other commands (like ls or touch) will look for or create
files.
pwd: Printing the current working directory
The PWD command (short for Print Working Directory) is a straightforward utility used to
display the full, absolute path of the directory you are currently located in within the file
system.

mkdir: Creating directories


The mkdir command (short for make directory) is used to create new directories (folders) in the
Linux file system
mkdir /home/user/Documents/reports
rmdir: Removing empty directories.
The rmdir command (short for remove directory) is used to delete or remove directories from
the Linux file system.
Crucially, rmdir can only remove directories that are completely empty. If the directory
contains any files or subdirectories, the command will fail, and you must use the more powerful
rm command instead.

cp: Copying files and directories


The cp command (short for copy) is used to duplicate files and directories in the Linux file
system. It creates an exact replica of the source at the specified destination path.

mv: Moving or renaming files and directories.


The mv command (short for move) is used for two main purposes in the Linux file system:
1. Renaming a file or directory.
2. Moving a file or directory from one location to another.
RENAME
MOVE

rm: Deleting files and directories.


The rm command (short for remove) is used to permanently delete files and directories from the
Linux file system

Q3) File Content Manipulation:


cat: Displaying and concatenating file contents
The cat command (short for catenate, a synonym for concatenate) is a fundamental Linux
utility with three main uses:
1. Displaying the contents of one or more text files to standard output (your screen).
2. Concatenating (joining) multiple files into a single output stream or a new file.
3. Creating new files or appending to existing ones using standard input

less / more: Paging through file contents


The less and more commands are utilities known as pagers. They are used to view the content
of large files one screen (or "page") at a time, making it much easier to read without the content
scrolling off the top of the terminal, which is what happens when using a command like cat.
head / tail: Viewing the beginning or end of files.
The head and tail commands are used to quickly view specific portions of files, usually the
beginning or the end. They are especially useful for checking the start of configuration files or
monitoring the most recent entries in log files.

grep: Searching for patterns in files


The grep command (short for Global Regular Expression Print) is one of the most powerful and
frequently used utilities in Linux. Its purpose is to search for lines that match a specified text
pattern within one or more files and then display those matching lines.
wc: Counting lines, words, and characters.
The wc command (short for word count) is a simple but useful utility that counts the number of
lines, words, and bytes (characters) in a file, or from data piped to it.

Q4) Permissions and Ownership


chmod: Changing file permissions
The chmod command (short for change mode) is used to alter the access permissions of files
and directories in a Linux/Unix system. File permissions are essential for security, as they
determine who can read, write, or execute a file.

chown: Changing file ownership


The chown command (short for change owner) is used in Linux to change the user owner
and/or the group owner of a file or directory. Only the root user (or users with sudo privileges)
can typically use chown
chgrp: Changing file group ownership.
The chgrp command (short for change group) is used to change the group owner of a file or
directory. This is distinct from chown, which can change both the user owner and the group
owner.

Q5). Process Management


ps: Listing running processes.
The ps command (short for process status) is used to display information about the currently
running processes on a Linux system. It provides a static snapshot of the processes at the
moment the command is executed.

top: Monitoring system processes.


The top command provides a dynamic, real-time view of a Linux system's activity. Unlike ps,
which gives a static snapshot, top continuously updates its display, making it the primary tool
for real-time system monitoring and performance analysis.
kill: Terminating processes.
The kill command is used to send signals to processes running on the Linux system, most
commonly to request or force their termination.

Q6). User and Group Management


useradd / userdel: Adding and deleting users
The useradd and userdel commands are essential for system administrators to manage user
accounts on a Linux system. Because these commands modify core system files, they must be
executed with root privileges
groupadd / groupdel: Adding and deleting groups.
The groupadd and groupdel commands are used by system administrators to manage user
groups on a Linux system. Groups are essential for defining shared access and permissions to
files and directories for multiple users. Like user management commands, these typically
require root privileges .

passwd: Changing user passwords


The passwd command is used to change or set the password for a user account on a Linux
system.

Q7) System Information and Utilities


uname: Displaying system information
The uname command (short for unix name) is used to print fundamental information about the
operating system kernel and the system hardware

date: Displaying and setting the system date and time.


The date command is used to display the current system date and time, and, with root
privileges, to set or change the system's time and date
who / whoami: Displaying logged-in users and current user
The who and whoami commands are simple but useful utilities for determining who is currently
using the system and who you are logged in

man: Accessing manual pages for commands.


The man command (short for manual) is the primary way to access the built-in documentation
for commands, programs, functions, and files on a Linux system. It provides a comprehensive
reference guide for nearly every utility you use in the terminal
Q8) Shell Scripting
Shell Scripting is the process of writing a series of commands for the Unix/Linux shell (the
command-line interpreter) to execute. It allows you to automate repetitive tasks, execute
complex command sequences, and perform administrative functions efficiently.
A shell script is essentially a text file containing a list of commands, just as you would type
them interactively in the termina
Variables, conditional statements, and loops are fundamental programming concepts that allow
Bash scripts to store data, make decisions, and perform repetitive actions, moving them beyond
simple lists of commands
A variable in a shell script is a named container that stores data. Unlike many other
programming languages, Bash variables are untyped (they store strings by default) and follow
specific rules for assignment and retrieval

You might also like