Thursday, June 3, 2021

XARGS AWK CUT GREP

ls -l . | grep ^d | awk '{print $9}' | xargs rm -rf

ls -al | grep -E '^-.*ml'

ls -l | grep -E '^-.*ml' | awk '{print $9}' |xargs rm -f



https://www.thegeekstuff.com/2011/10/grep-or-and-not-operators/

https://stackoverflow.com/questions/16900945/bash-extract-string-from-text-file-with-space-delimiter/16901235#16901235

https://stackoverflow.com/questions/219402/what-linux-shell-command-returns-a-part-of-a-string

Linux Pending A-Z ::: Sudoers :: Login Shell : Non Login Shell :: Grep Regex :: Alias

sudo visudo

source /etc/sudoers


To put it very simple, it is “who where = (as_whom) what”.

https://medium.com/kernel-space/linux-fundamentals-a-to-z-of-a-sudoers-file-a5da99a30e7f

coraca ALL=ALL:ALL  /usr/bin/cat /etc/shadow



https://www.hostinger.in/tutorials/sudo-and-the-sudoers-file/

https://phpraxis.wordpress.com/2016/09/27/enable-sudo-without-password-in-ubuntudebian/


kk   ALL=(ALL)  NOPASSWD: ALL

user1 ALL=NOPASSWD: /bin/systemctl start vsts, /bin/systemctl stop vsts, /bin/systemctl restart vsts, /bin/systemctl status vsts



Using /etc/sudoers.d #

Instead of editing the sudoers file you can create a new file with the authorization rules in the /etc/sudoers.d directory.


https://www.garron.me/en/linux/visudo-command-sudoers-file-sudo-default-editor.html

https://www.linux.com/training-tutorials/configuring-linux-sudoers-file/

https://toroid.org/sudoers-syntax

https://medium.com/kernel-space/linux-fundamentals-a-to-z-of-a-sudoers-file-a5da99a30e7f

http://www.softpanorama.org/Access_control/Sudo/sudoer_file_examples.shtml

http://www.freekb.net/Article?id=269

https://www.hostinger.in/tutorials/sudo-and-the-sudoers-file/

https://www.tecmint.com/create-alias-in-linux/

https://linuxize.com/post/linux-xargs-command/

https://shapeshed.com/unix-xargs/

https://www.geeksforgeeks.org/alias-command-in-linux-with-examples/

https://www.techrepublic.com/article/linux-101-the-different-types-of-sudo-and-su/

https://www.blogger.com/u/1/blog/posts/2528866210673694202

https://unix.stackexchange.com/questions/384700/what-is-the-difference-between-su-username-and-sudo-su-username

https://unix.stackexchange.com/questions/38175/difference-between-login-shell-and-non-login-shell

https://linuxhint.com/list-only-files-not-directories/

https://medium.com/@rajsek/zsh-bash-startup-files-loading-order-bashrc-zshrc-etc-e30045652f2e

https://www3.ntu.edu.sg/home/ehchua/programming/howto/Regexe.html

https://regex101.com/

https://askubuntu.com/questions/815066/whats-the-difference-between-bashrc-and-etc-bash-bashrc 

Wednesday, June 2, 2021

Linux ENV Setings ---- /etc/profile /etc/bashrc ~/.bashrc ~/.bash_profile

export PATH=$PATH:/usr/local/bin/nodeSetup/

Any Folder Path we put on PATH is scanned for Executables


~/.bash_profile
~/ .bashrc
~/.profile

/etc/sudoers
/etc/yum.conf
/etc/os-release
/etc/hosts
/etc/hosts.allow
/etc/fstab
/etc/shells

/etc/passwd
/etc/group
/etc/shadow

/etc/profile
etc/bashrc      [/etc/profile.d]

/etc/bashrc          # Functions and aliases go in /etc/bashrc
/etc/profile            # System wide environment and startup programs, for login setup + Environment stuff (It sources/executes shell in /etc/profile.d)
/etc/profile.d        # It's much better to create a custom.sh shell script in  /etc/profile.d/ to make custom changes to your environment 

~/.bash_profile    # User specific environment and startup programs    #PATH=$PATH:$HOME/.local/bin:$HOME/bin       #export PATH --- It sources(executes)  ~/.bashrc
~/.bashrc              #Get the aliases and functions                                              

-----------------------------------------------------------------------------
/etc/profile file is used to set system wide environmental variables on users shells. 
/etc/profile is the system wide version of .bash_profile.

/etc/bashrc for Red Hat and /etc/bash.bashrc in Ubuntu is the system wide version of .bashrc.

.bashrc file in your home directory. 
This file is meant for setting command aliases and functions used by bash shell users

.bash_profile or .profile - in  your home directory.
These files are used to set environmental items for a particular user's shell

The difference is simple, 
/etc/profile is executed only for interactive shells 
/etc/bashrc is executed for both interactive and non-interactive shells.
-------------------------------------------------------------------------------


For User specific Stuff, You can put aliases in ~/.bashrc and ~/.bash_profile sources it , but ENV Paths etc should be put in ~/.bash_profile

For Stuff relevant to all , You should put stuff in custom shell inside /etc/profile.d 

https://shreevatsa.files.wordpress.com/2008/03/bashstartupfiles1.png
https://bencane.com/2013/09/16/understanding-a-little-more-about-etcprofile-and-etcbashrc/

The importance of using a login shell is that any settings in /home/user/.bash_profile will get executed.






Linux A-Z Gyaan

 https://www.digitalocean.com/community/tutorials/angular-query-parameters

https://www.concretepage.com/angular-2/angular-2-4-child-routes-and-relative-navigation-example#:~:text=Child%20routes%20can%20have%20their,outlet%2C%20children%2C%20loadChildren%20etc.&text=Router%20supports%20relative%20path%20using%20ActivatedRoute%20.

https://appdividend.com/2019/12/16/angular-form-control-example/

https://malcoded.com/posts/angular-custom-directives/

https://www.redhat.com/sysadmin/alternatives-command

https://access.redhat.com/solutions/505983#:~:text=PS1%20is%20a%20primary%20prompt,the%20%2Fetc%2Fbashrc%20file.

https://unix.stackexchange.com/questions/1373/how-do-i-switch-from-an-unknown-shell-to-bash#:~:text=You%20type%20in%20bash%20.,by%20editing%20%2Fetc%2Fpasswd%20.

https://www.freecodecamp.org/news/linux-command-line-bash-tutorial/

https://itsfoss.com/apt-vs-apt-get-difference/

https://askubuntu.com/questions/1190717/when-to-run-sudo-apt-update-and-when-sudo-apt-update-sudo-apt-upgrade

https://www.freecodecamp.org/news/symlink-tutorial-in-linux-how-to-create-and-remove-a-symbolic-link/

https://www.tecmint.com/remove-package-with-dependencies-using-yum/amp/

https://phoenixnap.com/kb/centos-uninstall-remove-package

https://stackoverflow.com/questions/29964042/how-to-remove-old-version-of-java-and-install-new-version

https://www.thegeekdiary.com/how-to-work-with-multiple-java-versions-under-linux/

https://www.lifewire.com/alternatives-linux-command-4091710

https://linuxize.com/post/how-to-add-directory-to-path-in-linux/

https://kb.iu.edu/d/acec

https://linuxhint.com/update_alternatives_ubuntu/

https://www.redhat.com/sysadmin/alternatives-command

https://www.digitalocean.com/community/tutorials/ssh-essentials-working-with-ssh-servers-clients-and-keys

https://www.ssh.com/academy/ssh/host-key

https://superuser.com/questions/437330/how-do-you-add-a-certificate-authority-ca-to-ubuntu/719047#719047

https://www.google.com/search?q=pem+linux+full+form&client=ms-android-oppo&sxsrf=ALeKk027xsSkCVYclkcJoeq4bbZA0X4big%3A1622683432717&ei=KC-4YK6gK_OM4-EPzOWZmAQ&oq=pem++linux+full&gs_lcp=ChNtb2JpbGUtZ3dzLXdpei1zZXJwEAEYATIGCAAQFhAeMgUIIRCgATIFCCEQoAE6BAgjECc6BggAEAcQHjoICAAQCBANEB46BwghEAoQoAFQrghYoDZgxz5oAHAAeACAAYECiAG_F5IBBjAuMTAuNZgBAKABAcABAQ&sclient=mobile-gws-wiz-serp

https://www.tecmint.com/dpkg-command-examples/amp/

https://en.m.wikipedia.org/wiki/List_of_Linux_distributions

https://www.google.com/search?q=dnf+yum+difference&oq=dnf+yum&aqs=chrome.1.69i57j0l4.7585j0j4&client=ms-android-oppo&sourceid=chrome-mobile&ie=UTF-8

https://github.community/t/the-difference-between-forking-and-cloning-a-repository/10189

https://superuser.com/questions/740219/difference-between-apt-get-and-dpkg

https://www.tecmint.com/20-linux-yum-yellowdog-updater-modified-commands-for-package-mangement/

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/deployment_guide/sec-managing_yum_repositories

https://danielmiessler.com/study/fedora_redhat_centos/

https://itsfoss.com/centos-stream-fiasco/

https://blog.centos.org/2020/12/future-is-centos-stream/

https://unix.stackexchange.com/questions/52707/difference-between-chmod-775-and-chmod-2755

https://www.peachpit.com/articles/article.aspx?p=659655&seqNum=3

https://stackoverflow.com/questions/635869/can-yum-tell-me-which-of-my-repositories-provide-a-particular-package

https://www.cyberciti.biz/tips/how-do-i-find-out-what-shell-im-using.html

https://www.peachpit.com/articles/article.aspx?p=659655&seqNum=4

https://www.linuxfromscratch.org/lfs/view/9.1/chapter06/procps-ng.html

https://dzone.com/articles/how-to-edit-a-yaml-azure-devops-pipeline

https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=example%2Cparameter-schema

https://learnxinyminutes.com/docs/yaml/

https://docs.microsoft.com/en-us/azure/devops/pipelines/customize-pipeline?view=azure-devops

https://docs.microsoft.com/en-us/azure/devops/pipelines/build/ci-build-git?view=azure-devops&tabs=yaml

http://www.mattruma.com/create-a-single-build-release-pipeline-for-multiple-branches/


Monday, May 31, 2021

CHMOD CHOWN

https://stackoverflow.com/questions/35061499/how-to-display-column-headers-for-ls-l-command-in-unix-linux

https://phoenixnap.com/kb/linux-file-permissions

https://opensource.com/article/19/8/linux-chmod-command


[root@az-cvs-li-re-001 rage]# chmod ugo+rwx test

[root@az-cvs-li-re-001 rage]# ls -l|grep test

drwxrwxrwx   2 root root        6 Jun  1 09:53 test


[root@az-cvs-li-re-001 rage]# chmod u+rwx,g-rwx,o+rw-x test

[root@az-cvs-li-re-001 rage]# ls -l|grep test

drwx---rw-   2 root root        6 Jun  1 09:53 test

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

https://phoenixnap.com/kb/linux-chown-command-with-examples

chown [OPTIONS] USER[:GROUP] FILE(s)

[OPTIONS] – the command can be used with or without additional options.

[USER] – the username or the numeric user ID of the new owner of a file.

[:] – use the colon when changing a group of a file.

[GROUP] – changing the group ownership of a file is optional.

FILE – the target file.


[rage@az-cvs-li-re-001 ~]$ ls -la test

total 4

drwx---rw-   2 rage root    6 Jun  1 09:53 .

drwx------. 36 rage rage 4096 Jun  1 09:53 ..


[rage@az-cvs-li-re-001 ~]$ chown :rage test

[rage@az-cvs-li-re-001 ~]$ ls -la test

total 4

drwx---rw-   2 rage rage    6 Jun  1 09:53 .

drwx------. 36 rage rage 4096 Jun  1 09:53 ..

Friday, May 28, 2021

Full YAML Tutorial - Nested Array - Nested JSON

https://codebeautify.org/yaml-to-json-xml-csv/cb162ac2?restoreDataAfter=true       [VImp]

https://www.cloudbees.com/blog/yaml-tutorial-everything-you-need-get-started/

https://www.json2yaml.com/


Array, List, Map, Scalar, Boolean , Number
Quotes are optional
It automatically converts Data type to Boolean, String
List has dash followed by space


--- 3 Dash means separate YAML Document
Multiline with Formatting Preserved -    Use    Pipe    |
Multiline with Formatting Ignored -    Use   Redirection Operator  >


Chomp Modifiers

Multiline values may end with whitespace, and depending on how you want the document to be processed you might not want to preserve it. YAML has the strip chomp and preserve chomp operators. To save the last character, add a plus to the fold or block operators.



 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
friends:
    - Karan
    - Sahil
    - Ashish
    - Rahul
    - GodGoddess:
        Brahma: Saraswati
        Vishnu: Lakshmi
        Mahesh: Parvati
school: Model Academy
place: Jammu
VitalStats:
    Length: 5 Foot
    Attributes:
        - Black Complexion
        - Tall
        - curly Hair
        - Intelligence:
            IQ: 150
            EQ: 100
        - Hobbies: [Hollywood, "Pranks", "Comics"]
LongStringNoFormatting: |
    All right!
    Okay!
    Fine!
LongStringPreseveFormatting: >
    All right!
    Okay!
    Fine!
{
  "array": [
    {
      "description": "work"
    },
    "Hola",
    123,
    [
      "karan",
      "sumit"
    ],
    {
      "description": "work",
      "URL": "https://www.digitalocean.com/"
    },
    [
      {
        "description": "work",
        "URL": "https://www.digitalocean.com/"
      }
    ],
    [
      {
        "desciption": "tutorials"
      },
      {
        "URL": "www.digitalocean.com"
      }
    ]
  ]
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
---
array:
- description: work
- Hola
- 123
- - karan
  - sumit
- description: work
  URL: https://www.digitalocean.com/
- - description: work
    URL: https://www.digitalocean.com/
- - desciption: tutorials
  - URL: www.digitalocean.com

Azure - Pipeline - Add Approver for Stage

https://learn.microsoft.com/en-us/azure/devops/pipelines/process/approvals?view=azure-devops&tabs=check-pass