Teachers Day 2020 - Basics of Linux Commands, Git and Github
History of Linux? (Fast Forward)
Brief overview of Linux OS files/ folders system
Basics Commands on Linux (Useful in daily routine)
What is Git? How to use?
Difference between Git and GitHub
How can we host HTML based website,
and to get github.io domain, Free of cost ₹ 0/-
2. ● History of Linux? (Fast Forward)
● Brief overview of Linux OS files/ folders system
● Basics Commands on Linux (Useful in daily routine)
● What is Git? How to use?
● Difference between Git and GitHub
● How can we host HTML based website,
and to get github.io domain, Free of cost ₹0/-
Agenda
3. ● It is one of the flaour of UNIX
● Linus Torvalds modified UNIX and called called it as LINUX
(LINUS+UNIX=LINUX)
● Linus together with Richard stallman made LINUX free
○ And Agencies such as Free Software Foundation created
GNU project to provide free software
● Linux is open source operating system
● GNU/Linux flavours
○ Red Hat, Caldera, Debian, SuSE and Mandrake.
● It also has GUI Environment like GNOME and KDE (K Desktop
Environment)
● Technically, Linux is the Kernel, which is derived from UNIX
History of Linux
4. ● Linux has Two components : Kernel and Shell.
○ Linux Kernel is the the program which runs in background
and convert all your commands to machine dependent
signals. It is the core of the OS.
○ Shell is the interface between the user and the kernel.
● Command Line Interface : bash, sh, dash, zsh etc.
● Graphical User Interface : GNOME, KDE, Unity, Xfce,
Pantheon, etc.
History of Linux (Continue...)
What is Linux Kernel?
5. ● Graphical Environment - KDE/ GNOME/IceWM, others ...
● Browser - Mozilla
● E-mail - Kmail / Evolution
● Instant Messenger - Gaim
● FTP Client - gftp
● Multimedia - XMMS/ Xine / Cdparania / Cdrecord
● Image Browser - GQView
● Image Editor - GIMP
● Security - iptables / ipchains
● Office Suite - OpenOffice / StarOffice / KOffice
● File Browser - Konqueror
● Editors - Joe, VI, Kwrite, Gedit, OpenOffice Writer
● Games - Quake, Doom, SimCity, many others…
● Database - Postgres
● Server - Apache Server
History of Linux (Continue...)
Linux Applications (supported in earlier stage)
7. Brief Overview of Linux File System (Continue)
/ (root) - The root contains, user's home directory
/bin/ - This directory where many commonly used executable UNIX commands
resides here
/boot/ - This directory holds files used in booting the operating system
/dev/ - It contains device specific files
/etc/ - It contains system configuration files
/home/ - It contains user directories and files
/lib/ - It contains all library files
/media/ - Directory contains subdirectories where removable media devices inserted
into the computer are mounted.
/mnt/ - It contains device files related to system related to mounted devices
/opt/ - In directory where to install unbundled packages, each in its own subdirectory
/root/ - The root system administrator users directory
/sbin/ - Commands for system administrator
/srv/ - contains site-specific data which is served by this system
/tmp/ - Storage for temporary files which are periodically removed from the file
System
8. /usr/ - It have several subdirectories that contain additional UNIX commands and
data files
/usr/bin/ - that contains most of the executable files
/usr/include - Contains standard header files used by c program
/usr/lib/ - Contains object files and libraries
/usr/sbin/ - It is used to store many application programs
/usr/man/ - Manuals pages stored here.
/var/ - Variable part of the file system
. Contains print jobs and outgoing and incoming mail
/var/cache/ - It is intended for cached data from applications. Such data is locally
generated as a result of time-consuming I/O or calculation
/var/log/ - This directory contains logs from the OS itself, services, and various
applications running on the system.
/var/spool/ - Contains data which is awaiting some kind of later processing
/var/tmp/ - This directory is for programs that require temporary files or
directories that are preserved between system reboots
Brief Overview of Linux File System (Continue)
10. Basics Commands Theory
Advanced Package Tool, or ‘apt’, is a free-software user interface that works with core
libraries to handle the installation and removal of software on Debian, Ubuntu, and
related Linux distributions.
apt
‘sudo’ command allows you to run programs with the security privileges of another user
(by default, as the superuser). It prompts you for your personal password and confirms
your request to execute a command by checking a file, called sudoers , which the system
administrator configures.
sudo
‘su’ is used to switch from one account to another. User will be prompted for the
password of the user switching to.
su
‘man’ command in Linux is used to display the user manual of any command that we can
run on the terminal. It provides a detailed view of the command which includes NAME,
SYNOPSIS, DESCRIPTION, OPTIONS, EXIT STATUS, etc.
man
11. Basics Commands Theory (Continue...)
‘clear’ command, clears the terminal screen
clear
‘who’ command lets you display the users that are currently logged into your Unix
computer system, with date and time.
who
‘whoami’ command lets you display the users that are currently logged into the system.
whoami
‘uname’ command reports basic information about a computer's software and
hardware. When used without any options, uname reports the name, but not the
version number, of the kernel (i.e., the core of the operating system).
uname
‘ls’ command is used for listing the contents of a directory or directories given to it via
standard input. It writes results to standard output. The ‘ls’ command supports showing
a variety of information about files, sorting on a range of options and recursive listing.
ls -l command which lists the files in the working directory in long format.
ls
12. Basics Commands Theory (Continue...)
‘chmod’ is the command and system call which is used to change the access permissions
of file system objects
In Linux, each file is associated with an owner and a group and assigned with permission
access rights for three different classes of users:
-----------------------------------
The file ‘owner’. -u |
The ‘group’ members. -g |
Others (everybody else). -o |
-----------------------------------
ls -l filename.txt
chmod
r : Permission to read the file.
w : Permission to write (or delete) the file.
x : Permission to execute the file, or, in the case
of a directory, search it.
- : No permission
13. Basics Commands Theory (Continue...)
u - The file owner.
g - The users who are members of the group.
o - All other users.
a - All users, identical to ugo
chmod
- Removes the specified permissions.
+ Adds specified permissions.
= Changes the current permissions to the specified
permissions. If no permissions are specified after
the = symbol, all permissions from the specified
user class are removed.
14. Basics Commands Theory (Continue...)
Permission number:
File permission can be represented in a numeric or symbolic format. In this article, we’ll
focus on the numeric format.
The permission number can consist of three or four digits, ranging from 0 to 7.
When 3 digits number is used, the first digit represents the permissions of the file’s
owner, the second one the file’s group and the last one all other users.
The write, read, and execute permissions have the following number value:
r (read) = 4
w (write) = 2
x (execute) = 1
no permissions = 0
The permissions digit of a specific user class is the sum of the values of the permissions
for that class.
chmod (Method 2)
15. Basics Commands Theory (Continue...)
Each digit of the permissions number may be a sum of 4, 2, 1 and 0:
0 (0+0+0) – No permission.
1 (0+0+1) – Only execute permission.
2 (0+2+0) – Only write permission.
3 (0+2+1) – Write and execute permissions.
4 (4+0+0) – Only read permission.
5 (4+0+1) – Read and execute permission.
6 (4+2+0) – Read and write permissions.
7 (4+2+1) – Read, write, and execute permission.
For example, if the permission number is set to 750 it means that the file’s owner has
read, write and execute permission, file’s group has read and execute permissions, and
other users have no permissions:
Owner: rwx = 4+2+1=7
Group: r-x = 4+0+1=5
Others: --- = 0+0+0=0
chmod (Method 2)
16. Basics Commands Theory (Continue...)
‘ifconfig’ stands for "Interface Configuration" . It is a utility for Linux machines to
configure,assign,add,delete,control and query network interface in Unix/Linux
machine. Common Linux users uses ‘ifconfig’ command to assign ip address and
netmask to an interface or to disable or enable a given interface
ifconfig
‘free’ command displays how much of your computer's memory is in use and how much
is still available for programs to use
free
‘lshw’ (list hardware) which is used to generate the detailed information of the system's
hardware configuration from various files in the /proc directory.
lshw
‘lspci’ is a command on Unix-like operating systems that prints ("lists") detailed
information about all PCI buses and devices in the system
lspci
‘touch’ command is used to create empty files & also changes the timestamps of existing files
touch
17. Basics Commands Theory (Continue...)
‘cat’ command allows us to create single or multiple files, view contain of file,
concatenate files and redirect output in terminal or files.
cat
‘ps’ (Process Status), is a command line utility that is used to display or view information
related to the processes running in a Linux system.
ps
‘kill’ (list hardware) which is used to generate the detailed information of the system's
hardware configuration from various files in the /proc directory.
kill
‘passwd’ command is used to change the password of system users. If the passwd
command is executed by non-root user then it will ask for the current password and
then set the new password of a user who invoked the command. When this command is
executed by super user or root then it can reset the password for any user including root
without knowing the current password.
passwd
18. Basics Commands Theory (Continue...)
‘cat’ command allows us to create single or multiple files, view contain of file,
concatenate files and redirect output in terminal or files.
zip
‘unzip’ command extracts all files from the specified ZIP archive to the current directory
unzip
‘gzip’ is one of the most popular compression algorithms that allow you to reduce the
size of a file.
gzip
‘gunzip’ is a command-line tool for decompressing Gzip files.
gunzip
‘mv’ to move files / folders
mv
‘cp’ to copy files / folders
cp
‘rm’ to remove files
rm
‘rmdir’ empty directory
rmdir
‘mkdir’ to make directory
mkdir
‘cd’ to change directory
cd
19. ● Version Control System(VCS) for tracking changes in computer files,
developed by Linus Torvald in 2005
● Distributed version control/decentralized version control system
● Coordinates work between multiple developers
● who made, what changes and when?
● Revert back at any time
● Local & Remote Repository
Concept of Git
● keep track of code history
● takes "snapshots" of your files
● you decides when to take a snapshot by making a "commit"
● you can visit any snapshot at any time
● you can stage files before commiting
What is Git?
20. ● git init // initalilze local git repository
● git add <file> // add files to index
● git status // check status of working tree
● git commit // commit changes in index
● git push // push to remote repository
● git pull // pull latest from remote repository
● git clone // clone repository into new directory
Basics Commands in git?
21. ● Linux (Debian) OS
sudo apt-get install git
● Linux (Fedora) OS
sudo yum install git
● Mac OS
http://git-scm.com/download/mac
● Windows OS
http://git-scm.com/download/win
How to Install Git?
23. Difference Between Git & GitHub
Repository
Repository
Working Copy Working Copy
Working Copy
Repository
Repository
Distributed Version Control System
Server
push
pull
push
pull
commit
update
commit
update
commit
update
push
pull