Linux Class
Linux Class
===========
1.free account - 750hrs - 1 yrs
Debit/credit - 2/-rs
AWS
Optional - Puttygen
Linux - OS
=========
Server
Linux - command line
Linux Server
==========
Launch server
EC2 instnace/service/server
EC2 - Instance
==============
7 steps
linux20april.pem
21/04
=========
Linux
========
linux OS, Free open source os
Unix - paid one, os
Linux
========
CentOS -
Ubuntu
SUSE Linux
Windows
=========
what is sudo -i?
=============
Sudo(Superuser do) allows a system administrator to give certailn users(or group of
user) the ability to rum domr(or all) commands as root while logging all commnads
and arguments
what is Root?
=============
Primary Hierarchy root and root directory of the entire file system hirerachy
1. Each single file and directory starts from the root directory
2. Only root user has the right to write under this directory
3. /root is toot user's home directory, which is not same as /
Linux
========
FSH - File System Hierarchy
=========
The Linux FSH defines the directory structure
Folder/ Directory
mkdir linux
ls
cd linux-demo
file -creation
================
touch file1
Note :
=====
In side directory you may have 100 files - directories are difined with "blue
color"
In side file there no directories - files are defined with "white color"
Delete/Remove directory/folder
=============================
rm -rf dirname
or
rm -r firectory (type - y)
Delete/Remove files
============
rm -f filename
2 levels
1. Ownership
2. Pemission
How to change the ownership for file level
========================================
The chown command change ownership of files and directories in a linux filesystem
to change the owner of a files/directory
1.chown ec2-user
-rw-r--r-- 1
Group:
=====
chown commands is also used to change group name of a file like, "chgrp" commands
mkdir test
mkdir test
chown -R ec2-user:ec2-user test
syntax: ls -lha
1. r: Read =4
2. w: Write =2
3. x: Execution =1
Permissions
==============
Read - r - - 4
Write - w - - 2
Execution - x - - 1
====
7
Synatx: ls -lha
Example
===========
d rwx r-x r-x
task:
======
file.txt rrw
mkdir dir5
cd dir5
touch file6 file7
dir5 - rwx
7 0 0
700 --(user)--(group)--(others)
file2 r r w
5 5 5
if you want give the permissions directory level(you should not entire inside the
directory)
Linux/Unix Command
=========
1. File commands
2. Process managemnet
3. File Permissions
chmod octal file - chnage the permisiions of file of octal, which can be found
separately for user, groups and world by adding
4 - read(r)
2 - write(w)
1 - Execution(x)
Exmaple:
-
chmod 777
chmod 755
4. SSH
ssh user@host - connect to host as user
ssh -p port uset@host - connect to host on port port as user
VIM Editor:
==========
Vim is powerfull text editor used in CLI(Command Line Interface).
Linux uses a lot of configuration files.
if you edit them and vim is a great tool do so, aletrnatively VIM is a command line
editor
vim flie.txt
50 lines
50 lines
vi editor
vim editor
It has 3 modes:
----
1. Command Mode
2. Insert Mode -i
3. Extended Mode -
Note: when you open the vim editor , it will be in the command mode by default.
Insert Mode - i
Extended mode
----
save - esc:wq!
withoutsave- esc:q!
Command Mode
+++++++++++++++++
gg - to go to the beginning of the page
Shift+g - go to the end of the page
w - to move the cursor forward, word by word
b - to move the cursor backword, word by word
nw - to move the cursor forward to n words(5W)
nb - to move the cursor backend to n words(5W)
u - to undo last change(word)
Ctrl+u - to undo previous chnages (entire line)
Ctrl+r - to redo changes
yy - to copy a line
nyy - to copy n lines (5yy or 4yy)
p - to past line below the cursor position
P - to past line above the cursor positio
dw - delete the word letter by letter(like Backspace)
x - to delete the word letter by letter( delete key)
dd - to delete entire line
ndd - to delete n no.of positions from cursor positions(5dd)
/ - To search a word in the file
Monitoring:
+++++++++++++++++++
- when you needs to see the running process on your linux in real time, you can
have top as your tool that.
PID - ProcessID
USER - Effective UserID
PR - Dynamic Prority
NI - nice Value, also known as base priority
VIRT - Vitrual size of the task. This includes size of process executable binary,
the data area and all the loaded shared libraries
RES - The size of RAM Currently consumed by the task, Swapped out portion of the
task is not included
SHR - Shared memory ares clould be shared b/w two or more task, this fileds
reflects the shared area.
S - Task status
%CPU - the %CPU time dedicated to run the task since the last top's screen update
%MEM - the %Mem of RAM currently consumed by the task
TIME + - The total CPU time and task has been used since it started "+"sign means
is displayed wih hundredth of second granularity.
BY default, TIME/TIME+ desont account CPU Time used by the task's dead children
COMMAND- Showing program names.
Kill userdetails
-------------
kill -9 PID
Ping commnad
===========
packet internet Groper
what is /etc
===========
This is the nerve center of linux system, its contains all system related
configuration files in here or in this sub-directories.
A configuration file isdfines as a local files used to control the operations of a
program.
Software Management
====================
its important role in installaling and configuring the softwares.
Ubuntu - apt-get
RPM:
========
RPM is a package managing system(collection of tools to manage software packages) -
ex- git, maven, jenkins, python, java
RPM is powerful software mangement tools for installing, uninstall, verifying,
querying and updating software packages.
RPM straight forward program to perform the above s/w management tasks.
synatx:
installion syntax:
====
rpm -ivh package name
Repo:
clean
list
Networking:
==============
It is a connection between two or more machines to communicate with ach other
Networking Commands:
======================
Linux Networking Commands
ifconfig.
ip.
traceroute.
tracepath.
ping.
netstat.
ss.
dig.
#/etc/sysconfig/network
======================
is a file which keep the information abot the hostname assigned to the system
if you want to change the hostname permannetly.
#/etc/sysconfig/network-scripts/
ls /etc/sysconfig/network-scripts/
cat /etc/sysconfig/network:
---------------------
is a file whiich keep the information about the hostname assigned to the system.
if you want to change the hostname permenently , you need to change the hostname in
this file.
DNS
----
Domain Name spacific
nslookup ipaddress/hostname
nslookup