git rm test.txt –dry-run git rm -f test.txt –dry-run1 mkdir dir2 git add . fit commit -m “3 commit” git commit -m “3 commit” ls cd dir2/ ls vim a.txt ls git rm -f a.txt git add . git commit -m “test” git push origin main ls cat > file.txt git rm -f file.txt ls git rm -f a.txt ls git log git log -2 git log –graph –decorate –oneline git log –pretty=format:”%h – %cd – %B” git log –graph –pretty=format:”%h – %cd gitz git z gitg git clone https://github.com/hashicorp/terraform cd .. ls cd collaborative-project/ ls git status git add . git status git push origin main cd .. ls cd Project2 ls ls -lrt git mv aug.txt sep.txt ls -lrt git status mv sample.py sample2.py ls -lrt git status ls ls -rlt git mv -nf test2.py test3.py –dryrun git mv -nf test2.py test3.py ls -l git mv -f test2.py test3.py ls -l git status git mv –help git mv -k sep.txt oct.txt ls -l git mv –help git mv -v test3.py test4.py ls-l ls -l git mv -q oct.txt nov.txt git commit -m “git mv test” git push origin main git log –oneline git show ceb942a git show –pretty=oneline ceb942a git show –pretty=short ceb942a git show –pretty=medium ceb942a git show –pretty=full ceb942a git show –pretty=fuller ceb942a git show –pretty=raw ceb942a echo hello > file1.txt git add file1.txt git commit -m “test commit” echo secondline >> file2.txt git diff ls git diff ls git tag git tag v1.0 git tag v2.0 git tag git tag -a v3.0 -m “my version” git tag git tag -n git log –oneline git tag -a v4.0 1e72c3f -m “my version v4.0” git tag -a v4.0 -m “my version v4.0” git tag git tag -n git push –tags git log –oneline git tag -d v4.0 ls -al cd .git ls cd config vim config cd .. ls cat > sam.txt git add . fit commit -m “passwordless” git commit -m “tpass” git push origin main ls ls -al cd .. ls a-l ls -al vim git-credentials git config –unset credential.helper pwd git config git config –global credential.helper “cache –timeout=3600 ls a-l ls -al ls -lrt vim `/.git-credentials vim ~/.git-credentials git config –global credential.helper “cache –timeout=3600 cd Project3 ls cat >test.txt git commit -m “test” git add . git commit -m “test” git push origin main cd .. ls -lrt git config –global credential.helper store ls -rlt ls -lrt ls ls -rlt ls -al ls -al .git* cd Project3 ls git push origin main cd .. ls ls -rlt cd dev-repo1 ls git commit -m “dev” git push origin main git config –global –unset credential.helper cd .. cat .gitconfig cd dev-repo1/ ls cat > test2.txt git commit -m “test2” git commit -m “test2commit” git add . git status git commit -m “test2commit” git push origin main cd .. git config –global –unset credential.helper ls a-l ls -al ls -al .git* cat .git-credentials cd dev_repo ls cd dev-repo1 ls git push origin main cd .. git config –global credential.helper “cache –timout=3600” git config –global credential.helper store cd dev-repo1 ls git push origin main history
git clone “https://github.com/brindhasd/Project_pull.git” cd Project_pull git init git status cat >test2.py cat >file1.txt git status git add . git status git commit -m “commit” git status git pugh origin main git push origin main ls vi file2.txt git pull git status git add . git status git diff ls vi file2.txt git pull git diff git commit -m “Third test” git push origin main ls ls lrt ls -lrt git status git add . git status git commit git commit “add” git commit -m “add” git push origin main git mv file2.txt brindha.txt git status git diff git add . git commit git commit -m “file renamed” git push origin main git rm file2.txt ls git rm brindha.txt git status git commit -m “file deleted” git push origin main git log ls git checkout ls git diff git checkout main ls git checkout 6337e83982f922d70488285f4443cd1e645d9a14 git reset –hard git checkout HEAD git log git checkout main ls git checkout 14eb4ea31658fe2264e5b93c3779484265f3cd1e git checkout main ls cat file1.txt
get the Token Settings->Developer Settings->Personal access Tokens ->Tokens(classic) ->Generate New Token->Generate New Token Classic-> Copy the passcode to have it in the notepad for Git push login
evops@kaniyam:~$ sudo apt install emacs -y Reading package lists… Done Building dependency tree… Done Reading state information… Done emacs is already the newest version (1:27.1+1-3ubuntu5). 0 upgraded, 0 newly installed, 0 to remove and 433 not upgraded.
emacs emacstext.txt
File Edit Options Buffers Tools Text Help This is Line number 1 This is Line number 2 This is Line number 3 This is Line number 4 This is Line number 5
To find and replace
ESC SHIFT+x replace-string hai enter hello enter
devops@kaniyam:~$ cat emacstext.txt
Adding new lines This is Line number 1
This is Line number 2
This is Line number 3
This is Line number 4
This is Line number 5
devops@kaniyam:/etc/sudoers.d$ ls 0pwfeedback mintdrivers mintupdate README zfs devops@kaniyam:/etc/sudoers.d$ vim devops devops@kaniyam:/etc/sudoers.d$ groups devops adm cdrom sudo dip plugdev lpadmin sambashare devops@kaniyam:/etc/sudoers.d$ sudo vim devops [sudo] password for devops: devops@kaniyam:/etc/sudoers.d$ ls 0pwfeedback devops mintdrivers mintupdate README zfs devops@kaniyam:/etc/sudoers.d$ cat devops devops ALL=(ALL:ALL) NOPASSWD: ALL devops@kaniyam:/etc/sudoers.d$ sudo vim sam.txt devops@kaniyam:/etc/sudoers.d$ su – frappe su: user frappe does not exist or the user entry does not contain all the required fields devops@kaniyam:/etc/sudoers.d$ users devops devops@kaniyam:/etc/sudoers.d$ groups devops adm cdrom sudo dip plugdev lpadmin sambashare devops@kaniyam:/etc/sudoers.d$ su – frappe su: user frappe does not exist or the user entry does not contain all the required fields
devops@kaniyam:/etc/sudoers.d$ ulimit unlimited devops@kaniyam:/etc/sudoers.d$ enable enable . enable : enable [ enable alias enable bg enable bind enable break enable builtin enable caller enable cd enable command enable compgen enable complete enable compopt enable continue enable declare enable dirs enable disown enable echo enable enable enable eval enable exec enable exit enable export enable false enable fc enable fg enable getopts enable hash enable help enable history enable jobs enable kill enable let enable local enable logout enable mapfile enable popd enable printf enable pushd enable pwd enable read enable readarray enable readonly enable return enable set enable shift enable shopt enable source enable suspend enable test enable times enable trap enable true enable type enable typeset enable ulimit enable umask enable unalias enable unset enable wait dvops@kaniyam:~$ at 22:05 warning: commands will be executed using /bin/sh at Fri Jul 28 22:05:00 2023 at> Hello at> ^Cdevops@kaniyam:~$ at 22:06 warning: commands will be executed using /bin/sh at Fri Jul 28 22:06:00 2023 at> df -h > disk.txt at> job 2 at Fri Jul 28 22:06:00 2023 devops@kaniyam:~$ ls dir1/ dir2 devops@kaniyam:~$ at 22:08 warning: commands will be executed using /bin/sh at Fri Jul 28 22:08:00 2023 at> df -h > disk.txt at> job 3 at Fri Jul 28 22:08:00 2023 devops@kaniyam:~$ date Fri 28 Jul 2023 10:06:02 PM EDT devops@kaniyam:~$ ls disk.txt disk.txt devops@kaniyam:~$ cat disk.txt Filesystem Size Used Avail Use% Mounted on tmpfs 785M 2.1M 783M 1% /run /dev/sda5 82G 11G 67G 15% / tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs 5.0M 4.0K 5.0M 1% /run/lock /dev/sda1 96M 34M 63M 35% /boot/efi tmpfs 785M 108K 785M 1% /run/user/1000 devops@kaniyam:~$ atq 3 Fri Jul 28 22:08:00 2023 a devops
devops@kaniyam:~$ vim sample.sh devops@kaniyam:~$ ls -l sample. ls: cannot access ‘sample.’: No such file or directory devops@kaniyam:~$ ls -l sample.sh -rw-rw-r– 1 devops devops 132 Jul 28 22:16 sample.sh
evops@kaniyam:~$ cat sample.sh
!/bin/bash/
echo “This is free space” free -h echo “This is disk usage” df -h echo $user echo “The Script completed successfully”
devops@kaniyam:~$ chmod 755 sample.sh devops@kaniyam:~$ ./sample.sh devops@kaniyam:~$ vim sample.sh devops@kaniyam:~$ chmod +x sample.sh devops@kaniyam:~$ ./sample.sh bash: ./sample.sh: /bin/bash/: bad interpreter: Not a directory devops@kaniyam:~$ sh sample.sh This is free space total used free shared buff/cache available Mem: 7.7Gi 1.9Gi 3.8Gi 517Mi 2.0Gi 5.0Gi Swap: 13Gi 0B 13Gi This is disk usage Filesystem Size Used Avail Use% Mounted on tmpfs 785M 2.1M 783M 1% /run /dev/sda5 82G 11G 67G 15% / tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs 5.0M 4.0K 5.0M 1% /run/lock /dev/sda1 96M 34M 63M 35% /boot/efi tmpfs 785M 108K 785M 1% /run/user/1000
The Script completed successfully devops@kaniyam:~$
devops@kaniyam:~$ man df devops@kaniyam:~$ man kill devops@kaniyam:~$ man chpasswd devops@kaniyam:~$ man netstat devops@kaniyam:~$ man init devops@kaniyam:~$ man run level No manual entry for run No manual entry for level devops@kaniyam:~$ man runlevel devops@kaniyam:~$ runlevel N 5 devops@kaniyam:~$
devops@kaniyam:~$ ps -fp 1232 UID PID PPID C STIME TTY TIME CMD devops 1232 1223 8 21:02 ? 00:01:56 /usr/bin/pulseaudio –daemon devops@kaniyam:~$ ps -fp 1990 UID PID PPID C STIME TTY TIME CMD devops 1990 1873 4 21:02 ? 00:01:01 /usr/lib/firefox/firefox-bin devops@kaniyam:~$ sudo apt install htop [sudo] password for devops: Reading package lists… Done Building dependency tree… Done Reading state information… Done htop is already the newest version (3.0.5-7build2). htop set to manually installed. 0 upgraded, 0 newly installed, 0 to remove and 359 not upgraded. devops@kaniyam:~$ htop devops@kaniyam:~$ htop devops@kaniyam:~$
devops@kaniyam:~$ man df devops@kaniyam:~$ man kill devops@kaniyam:~$ man chpasswd devops@kaniyam:~$ man netstat devops@kaniyam:~$ man init devops@kaniyam:~$ man run level No manual entry for run No manual entry for level devops@kaniyam:~$ man runlevel devops@kaniyam:~$ runlevel N 5 devops@kaniyam:~$
-rw-rw-r– 1 devops devops 1455 Jul 19 21:21 demo.txt devops@kaniyam:~$ echo “This is demo msg” | tee -a demo1.txt This is demo msg
devops@kaniyam:~$ df -Th | tee sample.txt > /dev/null devops@kaniyam:~$ cat sample.txt Filesystem Type Size Used Avail Use% Mounted on tmpfs tmpfs 785M 2.0M 783M 1% /run /dev/sda5 ext4 82G 11G 68G 14% / tmpfs tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs tmpfs 5.0M 4.0K 5.0M 1% /run/lock /dev/sda1 vfat 96M 34M 63M 35% /boot/efi tmpfs tmpfs 785M 104K 785M 1% /run/user/1000 devops@kaniyam:~$ free -h | tee demo2.txt demo3.txt demo4.txt total used free shared buff/cache available Mem: 7.7Gi 1.6Gi 4.1Gi 584Mi 1.9Gi 5.2Gi Swap: 13Gi 0B 13Gi devops@kaniyam:~$ cat demo3.txt total used free shared buff/cache available Mem: 7.7Gi 1.6Gi 4.1Gi 584Mi 1.9Gi 5.2Gi Swap: 13Gi 0B 13Gi
evops@kaniyam:~$ cat > grep_example.txt This is line number onw THis is line number two This is line number three this is line 4 This is line 5This is line number one This is line number tow ^C devops@kaniyam:~$ cat grep_example.txt This is line number onw THis is line number two This is line number three this is line 4 This is line 5This is line number one This is line number tow devops@kaniyam:~$ grep “three” grep_example.txt This is line number three devops@kaniyam:~$ grep “two” grep_example.txt THis is line number two devops@kaniyam:~$ devops@kaniyam:~$ grep “5” grep_example.txt This is line 5This is line number one devops@kaniyam:~$
devops@kaniyam:~$ grep -i “4” grep_example.txt this is line 4 devops@kaniyam:~$ grep “one” grep_example.txt grep.txt grep_example.txt:This is line 5This is line number one grep: grep.txt: No such file or directory devops@kaniyam:~$ grep -iw “is” grep_example.txt This is line number onw THis is line number two This is line number three this is line 4 This is line 5This is line number one This is line number tow devops@kaniyam:~$ grep -r “grep” *
devops@kaniyam:~$ grep -r “grep” * grep: Downloads/VMware-Horizon-Client-2306-8.10.0-21964631.x64.bundle: binary file matches grep: Downloads/VMware-Horizon-Client-2306-8.10.0-21964631.x64(3).bundle: binary file matches grep: Downloads/VMware-Horizon-Client-2306-8.10.0-21964631.x64(2).bundle: binary file matches grep: Downloads/VMware-Horizon-Client-2306-8.10.0-21964631.x64(1).bundle: binary file matches grep: Downloads/VMware-Horizon-Client-2306-8.10.0-21964631.x64(4).bundle: binary file matches July19:evops@kaniyam:~$ cat > grep_example.txt July19:devops@kaniyam:~$ cat grep_example.txt July19:devops@kaniyam:~$ grep “three” grep_example.txt July19:devops@kaniyam:~$ grep “two” grep_example.txt July19:devops@kaniyam:~$ grep “5” grep_example.txt July19:devops@kaniyam:~$ grep -i “4” grep_example.txt July19:devops@kaniyam:~$ grep “one” grep_example.txt grep.txt July19:grep_example.txt:This is line 5This is line number one July19:grep: grep.txt: No such file or directory July19:devops@kaniyam:~$ grep -iw “is” grep_example.txt
vops@kaniyam:~$ cat grep_example.txt This is line number onw THis is line number two This is line number three this is line 4 This is line 5This is line number one This is line number tow devops@kaniyam:~$ grep -c this grep_example.txt 1 devops@kaniyam:~$ grep -c is grep_example.txt 6 devops@kaniyam:~$ grep -c number grep_example.txt 5 devops@kaniyam:~$ grep -c This grep_example.txt 4
devops@kaniyam:~$ grep -n “this” grep_example.txt 4:this is line 4 devops@kaniyam:~$
devops@kaniyam:~$ ping google.com PING google.com(yyz12s07-in-x0e.1e100.net (2607:f8b0:400b:807::200e)) 56 data bytes 64 bytes from yyz12s07-in-x0e.1e100.net (2607:f8b0:400b:807::200e): icmp_seq=1 ttl=118 time=16.2 ms 64 bytes from yyz12s07-in-x0e.1e100.net (2607:f8b0:400b:807::200e): icmp_seq=2 ttl=118 time=16.1 ms 64 bytes from yyz12s07-in-x0e.1e100.net (2607:f8b0:400b:807::200e): icmp_seq=3 ttl=118 time=12.4 ms ^Z (ctrl+Z) [1]+ Stopped ping google.com devops@kaniyam:~$ man ls
[2]+ Stopped man ls devops@kaniyam:~$ jobs %p [1]- Stopped ping google.com devops@kaniyam:~$ jobs -p 5826 5828 devops@kaniyam:~$ jobs -l [1]- 5826 Stopped ping google.com [2]+ 5828 Stopped man ls devops@kaniyam:~$
devops@kaniyam:~$ man ls
[4]+ Stopped man ls devops@kaniyam:~$ fg %2 man ls devops@kaniyam:~$ man free
[5]+ Stopped man free devops@kaniyam:~$ jobs -l [1] 5826 Stopped ping google.com [3] 5908 Stopped ping google.com [4]- 5915 Stopped man ls [5]+ 5930 Stopped man free devops@kaniyam:~$ fg %1 ping google.com 64 bytes from yyz12s07-in-x0e.1e100.net (2607:f8b0:400b:807::200e): icmp_seq=4 ttl=118 time=15.6 ms 64 bytes from yyz12s07-in-x0e.1e100.net (2607:f8b0:400b:807::200e): icmp_seq=5 ttl=118 time=21.6 ms 64 bytes from yyz12s07-in-x0e.1e100.net (2607:f8b0:400b:807::200e): icmp_seq=6 ttl=118 time=14.2 ms 64 bytes from yyz12s07-in-x0e.1e100.net (2607:f8b0:400b:807::200e): icmp_seq=7 ttl=118 time=21.6 ms 64 bytes from yyz12s07-in-x0e.1e100.net (2607:f8b0:400b:807::200e): icmp_seq=8 ttl=118 time=20.1 ms ^Z [1]+ Stopped ping google.com devops@kaniyam:~$ fg %4 man ls
[4]+ Stopped man ls devops@kaniyam:~$ fg %5 man free
[5]+ Stopped man free devops@kaniyam:~$ fg %3 ping google.com 64 bytes from yyz12s07-in-x0e.1e100.net (2607:f8b0:400b:807::200e): icmp_seq=3 ttl=118 time=15.7 ms 64 bytes from yyz12s07-in-x0e.1e100.net (2607:f8b0:400b:807::200e): icmp_seq=4 ttl=118 time=17.8 ms 64 bytes from yyz12s07-in-x0e.1e100.net (2607:f8b0:400b:807::200e): icmp_seq=5 ttl=118 time=15.1 ms 64 bytes from yyz12s07-in-x0e.1e100.net (2607:f8b0:400b:807::200e): icmp_seq=6 ttl=118 time=16.0 ms 64 bytes from yyz12s07-in-x0e.1e100.net (2607:f8b0:400b:807::200e): icmp_seq=7 ttl=118 time=14.3 ms ^Z [3]+ Stopped ping google.com devops@kaniyam:~$
sed – stream editor for filtering and transforming text
devops@kaniyam:~$ echo “indian linux user group”| sed ‘s/indian/kanchi/’ kanchi linux user group devops@kaniyam:~$ echo “indian python user group” | sed ‘s/python/php/’ indian php user group devops@kaniyam:~$ cat linux.txt linux is a very popular os. linux is easy to use.linux is easy to learn. linux is a versatile os
devops@kaniyam:~$ sed ‘s/linux/python/g’ linux.txt python is a very popular os. python is easy to use.python is easy to learn. python is a versatile os devops@kaniyam:~$ sed ‘s/linux/unix/gi’ linux.txt unix is a very popular os. unix is easy to use.unix is easy to learn. unix is a versatile os
devops@kaniyam:~$ sed ‘s/linux/unix/g2’ linux.txt linux is a very popular os. linux is easy to use.unix is easy to learn. linux is a versatile os devops@kaniyam:~$ sed ‘$d’ example.txt Powerful successfull devops@kaniyam:~$ sed ‘$d’ linux.txt linux is a very popular os. linux is easy to use.linux is easy to learn. devops@kaniyam:~$ cat > name apache nginx mysql ftp jenkins ^C
Paste: paste – merge lines of files
=========================================== devops@kaniyam:~$ cat > server webserver webserver db server file server integration server^C devops@kaniyam:~$ paste name server apache webserver nginx webserver mysql db server ftp file server jenkins evops@kaniyam:~$ paste name server apache webserver nginx webserver mysql db server ftp file server jenkins devops@kaniyam:~$ paste -d “|” name server > paste_output.txt devops@kaniyam:~$ paste -d “|” name server apache|webserver nginx|webserver mysql|db server ftp|file server jenkins| devops@kaniyam:~$ paste -d “\n” name server apache webserver nginx webserver mysql db server ftp file server jenkins devops@kaniyam:~$ paste -s name server apache nginx mysql ftp jenkins webserver webserver db server file server devops@kaniyam:~$ paste -s -d “:” name server apache:nginx:mysql:ftp:jenkins webserver:webserver:db server:file server
Join – join – join lines of two files on a common field
evops@kaniyam:~$ cat demo.txt redhat debian ubuntu centos ubuntu centos fedora fedora fedora devops@kaniyam:~$ uniq -u demo.txt redhat debian ubuntu centos ubuntu centos devops@kaniyam:~$ cat > file1.txt A is first line B is second line C is third lne D is fourth line^C devops@kaniyam:~$ cut -c2 file1.txt
sevops@kaniyam:~$ head -5 /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 78 model name : Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz
devops@kaniyam:~$ tail -5 /proc/cpuinfo clflush size : 64 cache_alignment : 64 address sizes : 39 bits physical, 48 bits virtual power management: 112 devops@kaniyam:~$ head -5 /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 78 model name : Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz devops@kaniyam:~$ tail -5 /proc/cpuinfo clflush size : 64 cache_alignment : 64 address sizes : 39 bits physical, 48 bits virtual power management:
devops@kaniyam:~$ tail -f file1.txt A is first line B is second line C is third lne devops@kaniyam:~$ cat > example.txt This is first line 1 This is second line 2 This is Third line 3 This is fourth line 4 This is fifth line 5^C devops@kaniyam:~$ tac example.txt This is fourth line 4 This is Third line 3 This is second line 2 This is first line 1 devops@kaniyam:~$ cat example.txt This is first line 1 This is second line 2 This is Third line 3 This is fourth line 4 evops@kaniyam:~$ cat example.txt This is first line 1 This is second line 2 This is Third line 3 This is fourth line 4 This is Line 1 This is line 2 This is line 3 This is line 4 This is line 5 rw-rw-r– 1 devops devops 60 Jul 17 22:12 xab -rw-rw-r– 1 devops devops 101 Jul 17 22:12 xaa devops@kaniyam:~$ cat xaa This is first line 1 This is second line 2 This is Third line 3 This is fourth line 4 This is Line 1 devops@kaniyam:~$ cat xab This is line 2 This is line 3 This is line 4 This is line 5