DEV Community

Ranjith srt
Ranjith srt

Posted on • Edited on

SRTechOps Note's

os haven't not communicate apps and hardware's.

os use running applications and perform some tasks.

application developed by program.

humans can't communicate with directly hardware's. EX (speakers)
hardware's understand to 0 and 1s
os is a program. (c,c++,python, shell ...)
humans communicate to hardwares with help of os.

Different type os :

windows os, Linux,mac,unix

windows :

GUI - BUILD in program - user friendly - paid os - virus attacks possible - not open source - not secure
CLI - Bulid in program

Linux:

512 gb - 4 cpu - 120gb

Linus is free and open source.
secure
Linux famous for CLI. and little bit basic GUI
created by linus Torvalds ;
unix paid.
unix have some drop backs that resolved made Linux

Linux has been lot of distributions.

Linux foundation - non profits organization

file system:


Basic commends

date - Today date
cal - month calendar

whoami - login user srtechops
pwd - print working directory - /home/srtechops

mkdir sample - make directory (folder)
mkdir sample/ - represent / directory
rmdir sample - remove directory

ls - list files and directories ( present directory)

mkdir - devops aws azure gcp ai - create multiple directory
rmdir - devops aws azure gcp ai - remove multiple directory

touch file.txt - create empty file
rm file.txt - remove empty file

cat :

cat commend used to read and write file can't update lines.

cat file.txt - show file content

cat - write file

cat > file.txt
html
css
js
git

ctrl+d save and exit

cat > file.txt over ride exacting content dlt old line add new lines (override)
python
Django

cat >> file.txt append lines
python
Django

cat -n sample.txt - number of lines (1 2 3)
tac sample.txt - revere order

CLI Text Editor

nano text editor

vi
vim

nano sample.txt

ctrl + o - save and write out
ctrl + exit -exit

vi text editor

vi sample.txt

i - insert mood

Escape

:wq! - save and quit
q - quit
q! - quit not save

echo :
print terminal

echo"welcome to devops class"

echo 'welcome to devops class'

echo"welcome to devops class" >> sample.txt - save content sample.txt

history:

history - show all commend history
history -d 55 - particular commend select and dlt
history -c - clear all history

history >> commends.txt - if not file ..this situation automatically create file.

nano sample.txt - if not file ..this situation automatically create file.

echo"welcome to devops class" >> sample.txt - if not file ..this situation automatically create file.

ls :

ls - list files and directories
ls -l - list detail information
ls -a - list hidden files
ls -l -r -reverse order
ls -l -t - list time based
ls -ltr - order reverse time
ls -F -file types - aws.txt sample/
ls Aws/ - list awa dir files

mv :

mv - multiple purposes rename,move,unhide files

mv js java - rename

mv srtech .srt1 - hide dir
mv .srt1 srtech - unhide dir

mv sample,txt .s1.txt - hide file
mv .s1.txt sample.txt - unhide filles

mv sample.txt aws/s1 -move files

mv sample.txt aws/ - move file ..if file name not mention same name create file automatically

mv aws/document - move dir

cd

cd aws - change dir
cd .. - backward
cd . - current dir
cd - - previous dir
cd ~ - home dir
cd ../../ - backward 2 dir
cd aws/ai/azure/gcp - absolute path

rmdir

rmdir aws/ - dlt empty dir

rm -r aws/ - recoersovely remove files

rm -rf aws/ - force perement delete

rm *.txt - select all ,txt files and remove

rm * - remove all files (global)

rm f* - remove starting letter f files. f1. txt, f3.txt

copy

cp sample.txt s1 - copy contents

cp sample.txt documents/ - copy file and create same name (documents/sample.txt)

cp sample.txt documents/s1.txt - cp destinations s1.txt

cp -r documents/ aws - copy directory

head

head sample.txt - top 10 lines

head -n 5 sample.txt - top 5 lines

tail

tail -f audit.log - monitoring live logs

tail sample.txt - last 10 lines

tail -n 2 sample.txt - last 2 lines

grep - search text

grep "git" sample.txt

grep -i "g" sample.txt - ignore k senstive (upper or lower)

grep -i -c "g" sample.txt - count

grep -i -n "g" sample.txt - numbers

grep -i -v "g" sample.txt - list not matching content

history | grep -i "ls" - list ls

history | grep -i -c "ls" - list ls count

Sed

With out opening nano vi text editor you can delete update or what you are want.

sed "s/c/c++" - c replace c++ not affect original file. Just display temporary.

sed -i "s/py/python programming"sample.txt

Affect original file

sed -i "s/py/python programming/I"sample.txt -
Affect Case sensitive

sed -i '$d' sample.txt _ dlt last one line

sed -i '2d' sample.txt _ dlt specific one line

sed -i '6,$d' sample.txt _ dlt set of lines 6 to last one line

Zip compress and archive

File size Compress panna, archive oru single folder Ullara files pottu veikka

zip devopstools.zip *. txt - compress file

zip -sf devopstools.zip - show files without unzip files.

Note you not unzip file.. Add or delete files in possible.

zip devopstools.zip sample - adding new file to already existing zip file

zip -d devopstools.zip sample

Dlt particular file in zip

Unzip devopstools.zip - extracting files

Set password

zip -e file.zip *.txt

tar archive

tar -cf myfiles.tar *.txt - create archive

tar -cvf myfiles.tar *.txt - bg archive apoo enna nadakuthunu paakalam.

tar -tf myfiles.tar - view files without extract

tar -tvf myfiles.tar - view files full details without extract

extract

tar -xf myfiles.tar - extract file

tar -xvf myfiles.tar - full details

dowload links:

wget

ssh protocol :

ipconfig - machine ip address
ssh srtchops@gmail.com
password: srt123

tar —czvf compressedfile.tar.gz *.txt

gpg —c myfiles .tar - ser pssword

gpg —d myfiles.tar.gpg > myfiles.tar -dlt passw

user management :

$ - normal user

-root user

su root
password: ____

user :

adduser ak - create user
passwd - set password ak

cat/etc/passwd- verify user account create or not

su ak - switch to ak user

group :

cat/etc/group- verify user account create or not

home dir :

cd ~ - /home/ak

deluser ak - dlt user group / user dlt agum..home dir dlt agathu

delt home dir
rm —r ak
rm —rf ak

userdel sangavi --remove - delt all home/userac/group

user name modification :

usermod -l ak ajith - ak to ajith rename

dir name change :

mv ak/ ajith/

grop rename:

groupmod -n ak ajith

password:
sudo su
passwd ak

top

kill 2693

kill -9 2693 force kill

logout

Group management:

create group - groupadd DevTeam

verify group - cat/etc/group

gpasswd -a ranjith DevTeam - add user to group

usermod -aG DevTeam ranjith - add user to group another way

gpasswd -d ranjith DevTeam - dlt user

groupdel DevTeam - dlt group

cat /etc/group - check group

lid -g DevTeam - list group numbers

search files - ls /etc/ | grep "g*”

log files :

cat /var/log/audit/audit.log

tail —n 1 /var/log/audit/audit.log

how to see group numbers :

lid -g DevTeam list group id

gpasswd —a ak devTeam - add group
gpasswd —a vk devTeam

usermod —aG devTeam prem - add group

gpasswd —d ak devTeam - dlt group
gpasswd —d vk devTeam

groupdel devTeam - dlt group

file permission:

change permission

chmod u+x welcome.txt user

chmod u+r welcome.txt

chmod u+w welcome.txt

chmod u+rwx welcome.txt add all permissions

remove permission:

chmod u-x welcome.txt user

chmod u-r welcome.txt

chmod u-w welcome.txt

chmod u-rwx welcome.txt remove all permissions

chmod g+x welcome.txt group

chmod g+r welcome.txt

chmod g+w welcome.txt

chmod g+rwx welcome.txt

remove permission:

chmod g-x welcome.txt group

chmod g-r welcome.txt

chmod g-w welcome.txt

chmod g-rwx welcome.txt

chmod o+x welcome.txt others

chmod o+r welcome.txt

chmod o+w welcome.txt

chmod o-rwx welcome.txt

remove permission:

chmod o-x welcome.txt others

chmod o-r welcome.txt

chmod o-w welcome.txt

chmod +x welcome.txt - Add all users permission execute

-rx-x-x

chmod -x welcome.txt - Add all users permission execute

number permission:

chmod 000 welcome.txt - no access rwe

chmod 777 welcome.txt - all access rwe

chmod 444 welcome.txt - rrr

chmod 111 welcome.txt - xxx

chmod 222 welcome.txt -www

chmod 41 welcome.txt - rx

chown harini hello.txt - change group owner

devTeam members access allowed hello.txt

user owner ownership change at time :

change dir ownership:

packeage manager

redhat os - yum ( yellow dog updater & modified)

ubuntu os - apt ( advanced package tool )

yum install git
yum remove git

rpm -qa show sys install apps

rpm -qa git - git install or not

rpm -q git - search git o or not

yum update

lat version net laa irunthu dowload pannum

sudo yum update os softwares repo ellam update agum

yum upgrade

andha download panna ella filesyum install pannum.

sudo yum upgrade ella software update agum


rpm - redhat package manager

which firebox - firebox file location

rpm -qa show sys install apps

rpm -q - particular app i or not

rpm -q -f /user/bin/firebox - firebox executable file path

rpm -q -l firebox - firebox i location all list files

ls /user/bin/firebox

ls -l /user/bin/firebox

rpm -e firebox - uninstall

rpm install firebox - install

yum install firebox - install

yum remove firebox - uninstall

dnf install git - yum advance future

file sudoers : user permissions

sudoers behave like root ..neccssary to user in sudo group

tail -f audit. log - see live log

tail -n 1 audit. log - live last log

how to give root power sudo power to normal user?

useradd anu

su - anu

visudo file :

cat /etc/sudoers

visudo - edit file

anu ALL=(ALL) ALL - all access

anu ALL=(ALL) /usr/bin/yum - update.dlt apps

anu ALL=(ALL) /usr/bin/yum install git - particular access

anu ALL=(ALL) /usr/bin/yum install * - i all apps

wheel:

cat /etc/group

wheel ALL=(ALL) ALL /usr/bin/yum

lid -g wheel - show wheel group

gpasswd -a anu wheel

sudo lid -g wheel - display wheel group members

os details:

cat/etc/os-release - os info

whereis git - git location

find -name f1.txt - location

find -type f - empty - list empty files

find / -name srtech -

find —type d —empty —delete

soft links and hard links :

shortcut's

ln sample.txt hardlink.txt

original file laa dlt ,edit vela nadantha shortcut filelyum affect agum.

hardlink laa orginal file dlt pannalayum shortcut file orginal file aa ran aagum.

ln -s sample.txt softlink.txt

original file laa dlt ,edit vela nadantha shortcut filelyum affect agum.

orignal file dlt panna softlink work agathu

process management:

ps - process status

ps -ef -

top

kill 786

kill -9 2569

✅ 1. Shutdown Immediately

sudo poweroff

sudo shutdown now

✅ 2. Shutdown After 1 Minute

sudo shutdown

(Default is 1-minute delay)
✅ 3. Shutdown at a Specific Time

sudo shutdown 22:00

(This shuts down at 10:00 PM)
✅ 4. Restart Instead of Shutdown

sudo reboot

✅ Cancel Scheduled Shutdown

sudo shutdown -c

https://youtu.be/kozgg-jUmZI?si=NN0ZPuNMaZHdsl7H

https://youtu.be/ugyNu96k5_Q?si=WPb2glcsFTZqWsGR

https://youtu.be/MQmA1TmR35c?si=yjCpQkm-j9bvSmbu

https://youtu.be/knYTByoBjPE?si=h2Yy3tAgHlpCxMlq

Top comments (0)