Learn Basic Linux in 10 days

 Day No. 1

---------

What is an OS

It is a program which controls hardware

(cpu, ram, hard disk, nic, keyboard, mouse, terminal)

What are the common OS in the market

UNIX (

WIndows (XP, 7, 8, )

2000, 2003, 2008, 2012

MacOS - Mac (Apple) 

OS/400 (IBM) - AS/400

MainFrame (IBM)


Theory : UNIX History

AT &T, Bell Labs, C - 1967

AIX (IBM), 

Solaris (Sub)

HP-UX (HP)

IRIS (Silicon Graphics)

DEC (Digital)

Linux - x86 - Intel, AMD (open source) 

Linux Distros (Red Hat, SuSe, CentOS, Fedora, Ubuntu)

Open Source

License, Subscription


Command : echo

echo "Hello world"

echo 'Hello world'

echo Hello world

echo Hello             world

echo 'Hello             world'

echo -e '\n\nHello\nWorld\n'

echo -e '\n\nHello\tWorld\n'

Command : clear

Command : alias

alias cls='clear'

alias

unalias cls

Note: alias will last only for a session

Shortcuts : ctrl + l 

Command : whoami 

Command : id

Display UID, GID of promary group and GIDs of all seconday groups

Command : date 

date -s to set the time of the server - can be run as root

What is a UNIX date : 01-01-1970

date +%D

date +%Y

date +%m

date +%d

date +%d.%m.%Y

date +%d-%m-%Y

Command : cal

cal

cal 1960

cal 5 2014

Command : uname 

uname

uname -r

uname -a

Note: architecture,64bit/32it,machinename, 

Command : man

man date

man crontab

man 5 crontab

man -k keyword

Command : ifconfig 

ifconfig

Note: ip addr, mac addr, netmask, name of ethernet card given by SA

Command : uptime

Command : who 

Command : w 

Note: JCPU, PCPU, IP Address, What

Command : users 

Command : hostname

hostname -s

Command : history

history -c

export HISTSIZE=5000

Note: These commands are stored in a file named .bash_history

!20 <== execute 20th command from your history

ctrl + r  <== search at the command prompt

Command : exit

Shortcuts : ctrl + d    

Command : ping

ping yahho.com

ping -c2 192.168.0.254

Command : ssh 

ssh aaftab@172.24.0.240

ssh -l aaftab 172.24.0.240

ssh -X aaftab@172.24.0.240 <== For opening graphical commands (firefox)  

Command : last

Command : write 

Command : wall 

Shortcuts : ctrl + shift + n

Shortcuts : ctrl + shift + t

Shortcuts : ctrl + shift + +   

Enlarge font

Shortcuts : ctrl + -

Reduce font

Shortcuts : up arrow

previous command

Shortcuts : down arrow

next command




Day No. 2

---------

Command : pwd 

Command : cd 

cd  <== goes to your home dir

cd .. <== goes to your parent dir

cd . <== . mean current directory

cd ~ <= goes to your home dir

cd ~aaftab <= goes you aaftab's home directory

cd ~aaftab/bin <= goes to bin directory which is under aaftab's home dir

cd / <== go to the top most dir

cd - <== go to previous directory

Theory : Filesystem (Directory structure)

/

/bin

/etc

/home

/sbin

/root

/tmp

/usr/bin

Command : ls

ls -l  <= long listing sorted from a-z

name

time on which the file/dir was last modified

size of a file/dir

group owner

owner/user

no of links

permissions ( owner, members of group owner, others)

file type (- file, d dir, l link, s socket, c char device, b block device)

devcices (mouse, keyboard, disks, disk partition, terminal/window, usb)

ls -a <== all - mean show hidden files (hidden file starts with a .)

ls -t <== list of files sorted by time

ls -r <== list of files sorted by i reverse order

ls -i <== Display inode number of each file


ls -l .

ls -l $HOME

ls -l ~

ls -l ..

ls -l ../..

ls -l ~oracle


ls -ld /home/aaftab <== display the info of the direcrory and not what is inside that directory


Theory : What is inode (index Node). It is structure. A table with info of a file

name, timestamps, owner, group owner, perm, size, 


Symbol : ?

Symbol : *

Command : cat 

cat /home/arununix/dir1/abhi.txt 

cat abhi.txt

cat ./abhi.txt

cat -n abhi.txt

cat -n /etc/passwd


Command : su

su - arununix  <== will ask you arununix's password

su - root <== will ask you root's password

su -   <== will ask you root's password


Command : more

more /etc/passwd 

space bar <== display next page

enter key <== display next line

Command : less

less /etc/passwd 

space bar <== display next page

enter key <== display next line

/aaftab <== search the word 'aaftab' in the file

q <== exit from the file

Command : head 

head /etc/passwd <== display top 10 lines of /etc/passwd file

head -6 /etc/passwd <== display top 6 lines of /etc/passwd file

Command : tail 

tail /etc/passwd <== display last 10 lines of /etc/passwd file

tail -6 /etc/passwd <== display last 6 lines of /etc/passwd file

tail -f /etc/passwd <== display last few lines contineously

tail -n +2 /etc/passwd <== display all lines from bottom except the top two

Command : touch

Command : cp 

cp /etc/passwd /home/aaftab/mypasswd

cp /etc/passwd  ./mypasswd

cp /etc/passwd .  <= . means pwd

cp /etc/passwd ./bin

cp /etc/passwd bin <== same as above because i im in my home dir

cp /etc/passwd /tmp

cp ../../etc/passwd .

cp /etc/passwd $HOME

cp /etc/*.conf $HOME

cp -i /etc/passwd /tmp


cp -r bin binbac

cp -r ./bin ~/binback

cp -r ./bin ~arununix

cp ~oracle/*.sh ~/bin

Theory : What is a shell script & how to execute it

Command : file 

Command : set <== display values of user & system defined variables

Command : env <== display values of system defined variables

Command : stat

Command : wc 

wc -l <== display total number of lines in a file

wc -w <== display total number of words in a file

wc -c <== display total number of characters in a file

Command : mv  <== rename a file or to move a file ( cut paste)

mv a.txt b.txt

mv /home/shekahr/a.txt /home/aaftab/b.txt

mv $HOME/a.txt b.txt

mv ~/a.txt ~aaftab/b.txt

mv ./a.txt ./b.txt

mv a.txt /tmp

mv a.txt /tmp/b.txt

mv ~arununix/.bash_profile ~

mv ~oracle/*.sh ~/bin


mv /home/aaftab/bin /home/shekahr/binbak

mv /home/aaftab/bin/* /home/shekahr


Command : rm 

rm a.txt

rm -i a.txt

rm -f a.txt

rm *.sh

rm $HOME/*.txt

rm ~oracle/*.sh

rm /tmp/*.tmp

rm -r ./bin <==  remove bin directory

rm -r $HOME/bin <==remove bin directory

rm -r /home/aaftab/bin <==  remove bin directory


rm -f /tmp/a.txt

rm -i /tmp/a.txt


Command : mkdir 

mkdir /home/aaftab/newbin

mkdir ~/newbin

mkdir newbin

mkdir ./newbin

mkdir ~oracle/newbin

mkdir $HOME/newbin

mkdir /tmp/aaftab

Command : rmdir 

rmdir /home/aaftab/bin <== remove dir if it is empty

Symbol : ~

Symbol : .

Symbol : ..

Theory : Client Server Concepts

Servers: sshd(22), vsftpd (21), httpd(80) dns(53)

Daemon is a constantly running program in the background

Note:  File related commands (ls, cat, more, less, wc , cp, mv, touch,  

Note:  Dir related commands (ls, 




Day No. 3

---------

Command : man

man -k keyword

SEE ALSO

Command : whatis

whatis ls 

Command : whereis

whereis cp 

Command : which

which cp

Command : tar 

tar -c -f /tmp/aaftab.tar /home/shekahr

tar -x -f /tmp/aaftab.tar -C /tmp/new

tar -t -f /tmp/aaftab.tar

tar -c -z -f /tmp/aaftab.tar.gz /home/shekahr

tar -x -f /tmp/aaftab.tar.gz -C /tmp/aaftab

tar -c -f /tmp/aaftab_26_06_2014.tar $HOME

tar -c -f /tmp/aaftab_26_06_2014.tar ~

Command : gzip 

gzip abcd.txt

gzip /tmp/abcd.tar

Command : gunzip 

gunzip abcd.txt.gz

gunzip abcd.tar.gz

gunzip /tmp/abcd.tar.gz


Command : zip 

zip abcd.txt.zip abcd.txt

Command : unzip

unzip abcd.txt.zip

Command : vi


3 modes - command (Esc) , typing mode (insert) , Ex Mode

Type - insert  (below current line  - o , above current line)

i - insert  before current position

a - insert after the current position

o - below the current line

O - above the current line

delete (word, line, multiple lines, char)

dw - delete a word

dd - delete the current line

9dd - delete 9 lines below the current, including the current line

D - delete from the current position till the end of line

x - delete a current character

copy (word, line, ...)

yw - copy current word

yy - copy current line

9yy - copy 9 lines including the current line

paste (above the current line, below current line, at the end of the line)

p - paste clipboard below current line

P - paste clipboard above current line

undo

u - undo previous changes

search (above the current cursor location, below the current cursor location)

/aaftab  <== search the word aaftab below current position

?aaftab  <== search the word aaftab above current position

n - to goto next occurence of the searched word

replace  

:1,20s/aaftab/peter/ <== replace aaftab by peter from line 1 till 20

  replace only the first occurence of word aaftab 

:1,40s/aaftab/peter/g <== replace aaftab by peter from line 1 till 40

  replace all occurences of word aaftab in these lines

:1,$s/aaftab/peter/g <== replace aaftab by peter in the entire file

  replace all occurences of word aaftab in entire file

:%s/aaftab/peter/g <== replace aaftab by peter in the entire file

  replace all occurences of word aaftab in entire file


r <== replace a current character

cw <== change the current word

redo

. <== redo the previous command

save

:w <== save

:w! <== save even if the file is read only

(you must be the owner of the file)

close/exit/quit - quit without saving

:q <== quit

:q! <== quit without saving

show line numbers

:set nu

:set nonu

goto - begining of file , end of file, to spacific line, 

start of line, end of line

up , dkkkkwn , right, left

gg <== gkkkk to the begining of the file

G <== end kkkkf the file

:5 <== gkkkk to line number 5

^ <== go to start of the current line

$ <== go to the end of the current line

j <== down arrow

k <== up arrow

l <== right arrow

h <== left arrow

page up

ctrl b < ==pageup

page down

ctrl f <== pagedown

bring contents from other file  to the current file

:r a.txt <== bring contents of a.txt into current file at the current cursor location




Day No. 4

---------

Command : sort

cat data.txt

aaftab Pune 99

Sachin Parbhani 9000

Sanyam Satara 888


sort data.txt

sort /home/aaftab/UNIX/data.txt

sort -r /home/aaftab/UNIX/data.txt

sort -k2 /home/student/Desktop/data.txt

sort -r -k2 /home/student/Desktop/data.txt

sort -k2 -r /home/student/Desktop/data.txt

sort -rk2  /home/student/Desktop/data.txt

sort -k3  /home/student/Desktop/data.txt

sort -k3   -n /home/student/Desktop/data.txt

sort -r -n -k3  /home/student/Desktop/data.txt

sort -rnk3  /home/student/Desktop/data.txt

aaftab:Pune:99

Sanyam:Satara:888

Sachin:Parbhani:9000

sort -n -t: -k3 data.txt 

sort -n -t':' -k3 data.txt 

Command : uniq

uniq data.txt

Command : cut

cut -d":" -f1 data.txt

cut -d":" -f2 data.txt

cut -d":" -f1,3 data.txt

cut -d":" -f1-3 data.txt

cut -d'a' -f2 data.txt

cut -d' ' -f3 data.txt 

cut -d' ' -f3 /home/student/data.txt 

File : /etc/passwd

stores user info on your system

1. username

2. password (always x)

3. UID

4. GID

5. Name or info of user

6. home directory of the user

7. login shell <= shell program automatically starts when user logs in 

cut -d':' -f1 /etc/passwd

cut -d':' -f1,6 /etc/passwd

Command : fgrep , grep, egrep

grep aaftab data.txt

grep -i aaftab data.txt

grep -v aaftab data.txt

What is a regular expression :

It is a search pattern used by commands like grep, egrep, sed, etc to search a specific pattern of characters in a file

Regular expressions

. <== any single char

* <== zero or multiple occurances of a previous char

^aaftab <== aaftab word is at the begining of the line

aaftab$ <== aaftab is at the end of the line

[abc] <== either a or b or c

[^p] <== any char other than p

[a-z] <== any char from a to z

[A-Z] <== any char from A to Z

^$ <== blank line

[0-9] <== any single digit

[086] <= either 0 or 8 or 6

[^086] <= neither 0 nor 8 nor 6

Extended Regular expression

egrep '(aaftab|peter)' data.txt <== show all line those contain either aaftab or peter


grep -E '(aaftab|peter)' data.txt <== show all line those contain either she    khar or peter



Command : diff 

Command : tr

echo 'aaftab      Tulshibagwale | tr -s ' '

Command : cmp 

io redirection:   cmd 1> filename 

io redirection:   cmd 1>>  filename

  1> filename <== created a blank file

What is a /dev/null file

There is a file named null in /dev/ directory. Anyone has the write permission on this file. Any data written or redirected to this file is immediately erased. This file, therefore, can be used for collecting garbage.

io redirection: cmd | cmd

cut -d':' -f1 /etc/passwd | sort

ls -l | sort -n -k5 | tail -1

ls -l /etc | sort -n -k5 | tail -1

who | cut -d' ' -f1 | sort | uniq

io redirection: &> 

io redirection: 2>> 

io redirection: 2> 

tar -cvf /tmp/a.tar /etc 1> a.txt

tar -cvf /tmp/a.tar /etc 2> b.txt

tar -cvf /tmp/a.tar /etc &> c.txt


Command that need input

cat, wc, sort, more, less, grep, fgrep, egrep, head, tail, sed  


io redirection: < 

Note: stdout is a virtual file sttting in RAM. You cannot see this file using

ls command. The file descriptor for this file is 1. 


Day No. 5

---------

Ad Practicals : No 1

Ad Practicals : No 2

Ad Practicals : No 3



Day No. 6

---------

Theory : permissions, groups, users

Command : id 

id <= displays uid and gid of currently logged in user

id oracle <==displays uid and gid of user oracle

Command : groups 

groups <== displays all groups that you are a member o (first group is the primary group)

groups oracle <== displays all groups that the user oracle is a member of

FIle : ~/.bash_logout

FIle : ~/.bash_profile

FIle : ~/.bash_history

FIle : ~/.bashrc 

FIle : ~/.vimrc 

File : /etc/group <== list of all groups

Command : chgrp 

chgrp dba a.txt <== changes the group owner of a.txt file to dba

Command : chmod 

Only owner/root can run the chmod command on a file/directory

u=owner/user   g=group   o=other  a=all

-  <== remove the permission

+ <== give the permission

chmod g+x $HOME

chmod go-rwx $HOME

chmod a+rwx $HOME <= be careful when you run this command

chmod a-rwx a.txt

chmod u+rwx,g+rx a.txt


r - 4

w - 2

x - 1


chmod 444 a.txt 

chmod 421 a.txt 

chmod 621 a.txt 

chmod 700 a.txt 

chmod 750 a.txt 

chmod 755 a.txt 

chmod 777 a.txt 

chmod -R 755 $HOME

chown

chown arung a.txt <== chown can be executed by root only

changes the owner of a.txt file to arung

chown arun.dba a.txt <== changes owner to arun and group owner to dba

chown arun:dba a.txt <== changes owner to arun and group owner to dba

chown -R arun:dba /home/aaftab <== changes owner to arun and group owner to dba of all file and subdirectories inside /home/aaftab


Shortcuts : ctrl + d 





Day No. 7

---------

Command : ps

ps

ps -e <== shows everything i.e. all processes on your system

ps -f  <== full listing i.e. give more info of process

ps -ef

ps aux <== give cpu and ram info of each process


IMP fields (owner, pid, ppid, comm, %CPU, %MEM)

Command : pstree <== shows parent child relationships between processes

Command : top 

Command : free 

Swap mean virtual ram. It is not real  ram. It is some space on hard disk

Swap = page file in windows

Swap can be a file on a hard disk or it can be a partition on the harddisk

File : /proc/meminfo

Command : mpstat

File : /proc/cpuinfo

Command : iostat

Command : bg

Command : fg <== bring the background job to foreground. The background job

may be running or stopped.

Status : 

Running & attched to terminal - Running in the foreground

Running in background

Stopped

Command : jobs <== display list of jobs started from the termonal

Command : sleep

Command : kill

kill 8188 <== kill i.e. terminate the process with 8188 PID

kill -9 8188 <== forceful/sure kill if the process cannot be killed by the above command

Command : lsof <== display list of opened files

lsof

lsof -u aaftab <== all files opened by aaftab (can be run by root)

lsof -p 1881 <== shows all files opened by process 1881

Symbol : &

Shortcuts : ctrl + c 

Shortcuts : ctrl + z 





Day No. 8

---------

Command : nslookup

Command : nmap

Command : netstat

Command : bc

Command : dnsdomainname

Command : scp

Command : ftp

Command : lftp

Command : sftp

Command : wget

Command : rsync





Day No. 9

---------


Command : crontab

Note: crontab is a command which interacts with a daemon named crond.

Daemon is a constantly running process in the background. The daemon process

is not attached to the termminal. i.e. TTY is ?. This crond daemon is

automatically started when your server is booted. You can check if this

process is running or not by typing the following command

ps -ef | grep crond 

service crond status


The purpose of this daemon process is to wake up every minute and

check if there are any programs/scripts that need to be executed on behalf of

some user. A program/script scheduled to run at a specific time is called as a

job. In other words crond is reponsible for running jobs on your system. 


The crontab command is the way to tell crond about which

program/script to run at which time and at which interval.


crontab -l <== see the existing job schedule

crontab -r <== remove the existing job schedule (dengerous command)

crontab -l > crontab.backup    <== output of crontab -l is stored in crontab.backup file

crontab < crontab.newfile  <== Schedule eritten in crontab.newfile is sent as an input to the crontab command


Explain each and every entry in crontab file.

       The time and date fields are:


              field          allowed values

              -----          --------------

              minute         0-59

              hour           0-23

              day of month   1-31

              month          1-12 (or names, see below)

              day of week    0-7 (0 or 7 is Sun, or use names)


       A field may be an asterisk (*), which always stands for "first-last".


       Ranges  of  numbers are allowed.  Ranges are two numbers separated with a hyphen.  The speci-

       fied range is inclusive.  For example, 8-11 for an "hours" entry specifies execution at hours

       8, 9, 10 and 11.


       Lists  are  allowed.   A list is a set of numbers (or ranges) separated by commas.  Examples:

       "1,2,5,9", "0-4,8-12".


       Step values can be used in conjunction with ranges.  Following a range with "<number>" speci-

       fies skips of the number’s value through the range.  For example, "0-23/2" can be used in the

       hours field to specify command execution every other hour (the alternative in the V7 standard

       is  "0,2,4,6,8,10,12,14,16,18,20,22").  Steps are also permitted after an asterisk, so if you

       want to say "every two hours", just use "*/2".



Command : find

find command is used to find a file/s in a specific directory (Note: grep is used to find a word/string in a file/s)

find - search for files in a directory hierarchy


Syntax :

     find   which_dir   [criteria]       action 

            ---------   -----------      -------  

A file whose name is a.txt and print it on the terminal

     find   /home       -name a.txt      -print


A file whose name is a.txt, A.txt, A.TXT and print it on the terminal

     find   /home       -iname a.txt      -print



A file whose owner is aaftab and print it on the terminal

     find   /home       -user aaftab   -print



Find in either /home or /etc a file whose owner is aaftab and print it on the terminal

     find   /home /etc  -user aaftab   -print


Find in /home a file whose groupowner is oinstall and list the file details like the ls command

     find   /home       -group oinstall -ls


Find in /home a files whose permission is 777 and list the file details like the ls command

find   /home -perm 777 -ls 2> /dev/null


             +10                          10          -10

<-----------------------------------------|---------------------|

                                          5                     15

                                                              (Today)

Find files in /home whose modification time is exactly 7 days ago

     find   /home       -mtime  7 -print


Find files in /home whose modification time is  before 7 days 

     find   /home       -mtime  +7 -print


Find all log files in /tmp whose modification time is  before 7 days and delete them

     find   /tmp        -mtime  +7  -name '*.log'  -delete


Find files in /home whose modification time is within last  7 days 

     find   /home       -mtime  -7 -print



     find   /home       -atime  <== access time


Find files in /home whose size is 10M   (you can use K M G T)

     find   /home       -size 10M -print

 

Find files in /home whose size is greater than 10M 

     find   /home       -size +10M -print

    find  / -user oracle -size +100M -ls 2> /dev/null


Find files in /home whose size less is 10M 

     find   /home       -size -10M -printo



     find   /home       -newer a.txt       -exec rm {} \;

     find   /home       -newer a.txt       -exec cp {} /tmp  \;

     find   /home       -newer a.txt       -exec mv {} /tmp  \;

     find   /home       -newer a.txt       -exec chmod 700  {} \;

     find   /home       -newer a.txt       -exec chown oracle.oinstall {} \;

     find   /home       -newer a.txt       -exec grep aaftab {} \;

     find   /home       -newer a.txt       -exec wc -l  {} \;

     find   /etc        -name '*.conf'     -exec cp {} /mybakup \;

     find   /etc        -name '*.conf'     -exec cp {} /mybakup/{}.bak \;


    tar -cvf /tmp/a.tar /home/aaftab/a.sh /home/aaftab/b.sh /home/aaftab/c.sh 

    tar -cvf /tmp/a.tar `find  /etc -name '*.conf' -print`


     find   /home       -empty 

     find   /home       -gid  100

     find   /home       -uid  200 



     find   /home       -newer a.txt       -print

     find   /home       -newer a.txt       -ls

     find   /home       -newer a.txt       -delete

     find   /home       -newer a.txt       -ok

     find   /home       -newer a.txt       -ok -exec rm {} \;


     find   /home       -inum 27772       -print



Some examples of find commands :


# touch  file_{1,2,3}


# touch  FILE_{1,2,3}


# touch  file_{pune,mumbai,nagpur}


1>  find /home/aaftab     -name  "file_pune    -print

         ------------      -----------------     ----------- 

where to find      What to find          What action to take on this file


2>  find .   -name  "file_?" 


3>  find $HOME  -name  "file_*"


4>  find /etc  -name  "*.conf"


5>  find /usr  -name  "*.gz"


7>  find /  -user  lp  -name a.txt  2>  /dev/null


8>  find /var -user root -group mail -print  2> /dev/null 


9>  find /var/lib -user rpm -group rpm -ls 2> /dev/null  | less


10> find /etc/httpd -exec file {} \;  


11> find /etc/mail -name "sendmail*" -exec file  {} \; 


12> find /etc -name "*.conf" -exec cp {} {}.bak \; 


13> find /etc -name *.conf.bak -ok rm {} \;  # -ok is like -exec, but asks user for confirmation


14> find /tmp  -type f  -ls  2> /dev/null  


15> find /tmp  -type d  -ls  2> /dev/null


17> find /etc  -type l  -ls  2> /dev/null  | wc -l


18> find /var/lib -user games -ls 2> /dev/null  | less


19> find  /bin  /usr/bin/  /sbin  -perm -u+s  -ls  2> /dev/null


20> find /etc/httpd/conf  -ok file {} \;


21> tar -cvf etc.tar $(find /etc -name  "*.conf" ) 


22> find /etc -name passwd  >  /tmp/output_of_find


23> find /etc -name squid.conf  >>  /tmp/output_of_find  2> /dev/null


24> find $HOME -mtime +7 -print


25> find $HOME -mtime -7 -print




Command : ln

Command : mail

mail <== check the email inbox (1, d 2, d * )

mail  aaftab@gmail.com (. means end of email)

mail -s 'Hello' aaftab@gmail.com < /etc/passwd 

mail -s 'Hello' aaftab@gmail.com -a b.txt < /dev/null








Day No. 10

---------

Command : rpm 

rpm -qa

rpm -qa | grep nmap

rpm -q

rpm -qi

Command : ssh-copy-id

Command : ssh-key-gen

Command : vmstat

Test : No 10

Q: Which command is used to find information about already installed software

rpm -q package_name  (e.g rpm -q nmap)

rpm -q software_name

Q: How to get the detailed info of the vsftpd software/package

rpm -qi vsftpd

Q: What version of httpd software has been installed on your system

rpm -q httpd

Q: How to find all packages installed on your system

rpm -qa   (a means all)

Q: Is perl or python installed on your system

rpm -qa | grep perl

rpm -qa | grep python

Q: What is the version of perl

rpm -qi perl

Q: have you installed 64 bit or 32 bit version of python

rpm -q python <== look for x64

Q: Which command creates publc and private keys

ssh-keygen

Q: In which dir these keys are stored

$HOME/.ssh 

Q: What are the permissions on the private key

rw-------

Q: WHich algorithm is used to encrypt these keys

RSA

Q: How to put your public key in some other user's account

ssh-copy-id  student@192.168.0.2

The above command will copy your public key in student's account 

on 192.168.0.2 machine. The password of student will be asked.

Q: Where is the public key stored in student's account 

~student/.ssh/authorized_keys

Q: How to execute a command on another machine

ssh student@192.168.0.2 'hostname'







Day No. 11

---------

Ad Practicals : No 1

Ad Practicals : No 2

Ad Practicals : No 3



Day No. 12

-----------

Final test (Theory + Practicals)






No comments:

Post a Comment