Professional Documents
Culture Documents
Chapter 4c Introduction To Linux
Chapter 4c Introduction To Linux
Linux
Basic Commands
Linux Introduction
• Linux is a computer operating system.
– free software (open-source)
– source code is available to the public
• freely use
• Modify
• redistribute it.
• Since then, Linux has gained the support of major corporations such as IBM, Hewlett-
Packard, and Novell for use in servers and is gaining popularity in the desktop
market.
2
What is Linux?
• Free i.e. free of charge, freedom to use Linux, and free Software applications, programming
languages, and development tools etc.
• Unix Like: i.e. Like Unix, Linux runs on different hardware platform; e.g. Intel x86 processor
(Celeron/PII/PIII/PIV/Old-Pentiums/80386/80486)
– Macintosh PC's, Cyrix processor, AMD processor, Sun Microsystems Sparc processor, Alpha
Processor (Compaq)
– Like Unix its also Multi-user/Multitasking/32 or 64 bit Network OS.
• Open Source Linux is developed under the GNU Public License – referred to as “copyleft”
(not a copyright)
• Different vendors and volunteer developers share source code and build on each other’s
work.
• The source code is available, freely modifiable, developed, and so forth.
• There are only a few restrictions on the use of the code.
– If you make changes to the programs, you have to make those changes available to
everyone.
• Network operating system it is Internetwork and Internet-aware
3
How to get Linux?
4
Various Linux distribution
• use Linux :
– as Server Os
– as stand alone Os on your PC.
6
What is Kernel?
7
What is X-Windows?
X-Windows is the most common graphical interface for Linux / Unix
8
What is Linux Shell/Console ?
• Shell is a command-line
interface to the kernel.
• It is a user program that
provide user interaction
i.e. traditional user
interface.
• Shell is a command
language interpreter that
executes commands read
from the standard input
device (keyboard) or from
a file.
9
How to use Shell ?
10
What is a directory?
• Directory is group of files. It is used to
organize your data files and programs more
efficiently.
• It is divided into two types:
– Root directory (shown by / and have only one in
your system)
– Sub directory (other directory under root, can be
created and renamed by the user).
11
Linux File
System
Structure
12
Linux Basic Commands
• A way to “do things” in Linux / Unix
• Commands are typed at the command prompt / console
• In Linux / Unix, everything (including commands) is case-sensitive
13
The Shell prompts
• Usually the prompts defined as:
– Username
– Host name (machine name)
– Name of the directory
• Example:
[kpu01@localhost ~]$
The Command Prompt
14
File Handling commands
• mkdir – make directories
Usage: mkdir [OPTION] DIRECTORY...
eg. mkdir csc1100
• ls – Display a listing of all the files in the current directory (called “folders”
in other OS)
Usage: ls [OPTION]... [FILE]...
eg. ls, or ls -al, or ls csc1100
The l option means to give a listing in one column.
The a option means to show all files.
• cd – changes directories
Usage: cd [DIRECTORY]
eg. cd csc1100
• cp – used to copy the files
– cp File1 dir-name/new-filename
Linux Introduction
16
File Handling commands
• pwd print name of current working directory
Usage: pwd
• ps – report a snapshot of the current processes
Usage: ps [OPTION]
eg. ps, ps el
• cat – concatenate files and print on the standard output
Usage: cat [OPTION] [FILE]...
eg. cat file1.txt file2.txt
• locate – find or locate a file
Usage: locate [OPTION]... FILE...
eg. locate file1.txt
File Handling(contd...)
• rm – remove files or directories
Usage: rm [OPTION]... FILE...
eg. rm file1.txt , rm rf some_dir
• find – search for files in a directory hierarchy
Usage: find [OPTION] [path] [pattern]
eg. find file1.txt, find name file1.txt
• history – prints recently used commands
Usage: history
•clear - clear the screen .
Usage:clear
Editor commands
• kate – KDE Advanced Text Editor
Usage: kate [options][file(s)]
eg. kate file1.txt file2.txt
• vim – Vi Improved, a programmers text editor
Usage: vim [OPTION] [file]...
e.g. vi hello.c e.g. vim file1.txt