├── user_and_group_management ├── README.md ├── dd_backup.sh ├── change.sh ├── users.sh ├── passwordgen.sh ├── edit.sh └── sysbackup.sh ├── loops ├── while04.sh ├── for01.sh ├── for02.sh ├── for03.sh ├── while01.sh ├── for04.sh ├── while02cpy.sh ├── while02.sh ├── while03.sh ├── colour_cpy.sh └── colour.sh ├── echo └── first.sh ├── networking ├── ScanResults2 ├── bestscan.sh ├── nmap_net_cpy.sh ├── findhosts.sh ├── nmap_net.sh └── ScanResults ├── functions ├── echo.sh ├── colour.sh ├── concat.sh ├── for ├── drive.sh └── while ├── REGEX └── uniq │ ├── names1.txt │ ├── names3.txt │ ├── names6.txt │ ├── names2.txt │ ├── names4.txt │ ├── names5.txt │ ├── n1 │ └── most_common_pws.txt ├── sed ├── names.txt ├── emails.txt └── sed.txt ├── README.md ├── var ├── var2.sh ├── var3.sh ├── var1.sh ├── 3.sh └── varex.sh ├── File_Globbing ├── touch.sh ├── n1 ├── file_globbing.txt └── globs ├── dailyscripts ├── fast.sh └── red.sh ├── regex ├── touch.sh ├── vimtrix ├── awk.txt ├── regex.txt ├── regex_cp.txt ├── file_globbing.txt ├── sed.txt ├── globs └── regawk.txt ├── strs └── concat.sh ├── dd_backup.sh ├── all_commands ├── CMDS02.txt ├── CMDS_EASY.txt ├── CMDS_OVERFVIEW.txt ├── vim_tutor_notes.txt ├── uniq.txt ├── RegexAndcmds.txt └── cmds.txt ├── the_ultimate_vimrc ├── Course_Resources └── course_resources.txt ├── change_permissions ├── LICENSE ├── instant.sh ├── random_bash_trix.txt ├── .bashrc ├── extended.vim └── vimrc_basic /user_and_group_management/README.md: -------------------------------------------------------------------------------- 1 | Bash scripts for Sys Admin tasks. 2 | -------------------------------------------------------------------------------- /loops/while04.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # While loop withh a break 4 | n=1 5 | 6 | while [] 7 | -------------------------------------------------------------------------------- /echo/first.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "ANYTHING WILL PRINT TO THE SCREEN THAT IS IN THE ECHO QUOTES!!" 4 | 5 | -------------------------------------------------------------------------------- /loops/for01.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for i in {1..30}; do 4 | sleep 0.05 5 | echo $i 6 | 7 | done 8 | -------------------------------------------------------------------------------- /loops/for02.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for i in {0..90..3} 4 | do 5 | sleep 0.05 6 | echo "$i" 7 | 8 | done 9 | -------------------------------------------------------------------------------- /networking/ScanResults2: -------------------------------------------------------------------------------- 1 | 192.168.50.1 Up 2 | 192.168.50.71 Up 3 | 192.168.50.227 Up 4 | 192.168.50.245 Up 5 | 192.168.50.96 Up 6 | -------------------------------------------------------------------------------- /networking/bestscan.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Enter the IP address you want scanned: " 4 | read IP 5 | 6 | nmap -p- -sS -sV -T4 -A $IP 7 | -------------------------------------------------------------------------------- /functions/echo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | def_echo() { 4 | 5 | echo "Print words to the screen." 6 | 7 | } 8 | 9 | def_echo 10 | def_echo 11 | def_echo 12 | 13 | 14 | -------------------------------------------------------------------------------- /REGEX/uniq/names1.txt: -------------------------------------------------------------------------------- 1 | Bethany Carr 2 | Lana Steele 3 | Sophie Wolfe 4 | Tami Hawkins 5 | Andre Mccoy 6 | Alton Hunter 7 | Kay Evans 8 | Duane Bailey 9 | Jean Torres 10 | Darrin Romero 11 | -------------------------------------------------------------------------------- /loops/for03.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # init i with 0, evals i's value 4 | for (( i=1; i<50; i++ )); 5 | do 6 | 7 | sleep 0.05 8 | i=$((i + 1)) 9 | echo $i 10 | 11 | done 12 | -------------------------------------------------------------------------------- /sed/names.txt: -------------------------------------------------------------------------------- 1 | Lloyd Maldonado 2 | Curtis Holt 3 | Craig Munoz 4 | Edwin Rhodes 5 | Myrtle Erickson 6 | Jane Schmidt 7 | Angel Barker 8 | Iris Washington 9 | Lynda Pope 10 | Kelly Fulle 11 | -------------------------------------------------------------------------------- /REGEX/uniq/names3.txt: -------------------------------------------------------------------------------- 1 | Rafael Reed 2 | Guadalupe Clarke 3 | Sergio Briggs 4 | Kelley Collier 5 | Rufus Cox 6 | Mattie Perez 7 | Lorena Summers 8 | Ross Stewart 9 | Lynn Sims 10 | Teri Vega 11 | -------------------------------------------------------------------------------- /REGEX/uniq/names6.txt: -------------------------------------------------------------------------------- 1 | Lloyd Maldonado 2 | Curtis Holt 3 | Craig Munoz 4 | Edwin Rhodes 5 | Myrtle Erickson 6 | Jane Schmidt 7 | Angel Barker 8 | Iris Washington 9 | Lynda Pope 10 | Kelly Fulle 11 | -------------------------------------------------------------------------------- /REGEX/uniq/names2.txt: -------------------------------------------------------------------------------- 1 | Kimberly Daniels 2 | Anthony Farmer 3 | Rosa Pierce 4 | Lynda Weber 5 | Homer Turner 6 | Bessie Mack 7 | Brett Hoffman 8 | Matt Salazar 9 | Alberta Higgins 10 | Santos Schultz 11 | -------------------------------------------------------------------------------- /REGEX/uniq/names4.txt: -------------------------------------------------------------------------------- 1 | Carmen Padilla 2 | Mandy Martinez 3 | Isabel Bradley 4 | Lawrence Gibbs 5 | Muriel Santiago 6 | Neal Boyd 7 | Anita Parker 8 | Andy Richards 9 | Brittany Cruz 10 | Pearl Jame 11 | -------------------------------------------------------------------------------- /REGEX/uniq/names5.txt: -------------------------------------------------------------------------------- 1 | Rosa Taylor 2 | Isabel Maldonado 3 | Jessie Hoffman 4 | Julie Pearson 5 | Earl Ruiz 6 | Michael Burke 7 | Barbara King 8 | Cassandra Page 9 | Christie Evans 10 | Terry Mcdonald 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Shell-Scripting-with-Bash 2 | Shell Scripting with Bash, by EC-Council 3 | This repository contains links to all course resources and lists of all commands and copies of Bash Scripts from the course. 4 | -------------------------------------------------------------------------------- /functions/colour.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | def_colour() { 4 | 5 | for c in 90 31 91 32 33 34 35 95 36 97; do 6 | echo -en "\r \e[${c}m LOVE \e[0m " 7 | sleep 1 8 | done 9 | 10 | } 11 | 12 | def_colour 13 | -------------------------------------------------------------------------------- /loops/while01.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # While loop. Example 1 4 | n=1 5 | 6 | while [ $n -le 30 ] 7 | do 8 | 9 | echo n is now $i 10 | (( i=+1 )) 11 | sleep 0.05 12 | 13 | 14 | done 15 | 16 | -------------------------------------------------------------------------------- /loops/for04.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #Set an arrary 4 | for i in {1..100} 5 | do 6 | 7 | # break the loop 8 | sleep 0.05 9 | if [[ $i -gt 60 ]] 10 | then 11 | break 12 | 13 | fi 14 | echo "$i" 15 | 16 | done 17 | -------------------------------------------------------------------------------- /functions/concat.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | def_string(){ 4 | 5 | string1="This is an example of catting out strings " 6 | string2="in Bash Scripting." 7 | 8 | echo "$string1$string2" 9 | 10 | 11 | } 12 | 13 | def_string 14 | -------------------------------------------------------------------------------- /loops/while02cpy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # While loop. Example 1 4 | # -le less than or equal to lt is less than = to 5 | n=1 6 | 7 | while [ $n -le 30 ] 8 | do 9 | echo n is now $i 10 | (( i=+1 )) 11 | sleep 0.05 12 | 13 | done 14 | -------------------------------------------------------------------------------- /functions/for: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | def_for() { 4 | 5 | for i in {1..100} 6 | do 7 | sleep 0.05 8 | if [[ $i -gt 25 ]] 9 | then 10 | break 11 | 12 | fi 13 | echo "$i" 14 | 15 | done 16 | 17 | } 18 | 19 | def_for 20 | def_for 21 | def_for 22 | -------------------------------------------------------------------------------- /networking/nmap_net_cpy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | IFS=$'\n\t' 5 | 6 | nmap 192.168.50.1-254 -sn -f -vv -n >/dev/null -oG ScanResults 7 | 8 | awk '{print $2, $5}' ScanResults | grep -i up > ScanResults2 9 | 10 | cat ScanResults2 11 | 12 | -------------------------------------------------------------------------------- /networking/findhosts.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #### Script finds UP hosts and its HOSTNAME 3 | #### Usage: 4 | #### sh nmap_find_hostname.sh IP/MASK 5 | #### eg.: sh nmap_find_hostname.sh 192.168.0.0/16 6 | 7 | nmap -sn $1 -oG - | awk '$4=="Status:" && $5=="Up" {print $2, $3}' 8 | -------------------------------------------------------------------------------- /var/var2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Got Root?? 4 | echo "Your UID is ${UID}" 5 | 6 | # Using {braces} to display the var contents 7 | # is an alternative syntax 8 | if [[ $UID -ne 0 ]] 9 | then 10 | 11 | echo "You are NOT ROOT!" 12 | 13 | fi 14 | 15 | 16 | -------------------------------------------------------------------------------- /loops/while02.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # While loop. 4 | #Needs a break to prevent infinite looping 5 | n=1 6 | while [ ${n} -lt 30 ] 7 | do 8 | echo n is now ${n} 9 | (( n++ )) 10 | sleep 0.05 11 | 12 | if [[ ${n} -eq 16 ]] 13 | then 14 | break 15 | 16 | fi 17 | done 18 | -------------------------------------------------------------------------------- /REGEX/uniq/n1: -------------------------------------------------------------------------------- 1 | Bethany Carr 2 | Lana Steele 3 | Sophie Wolfe 4 | Tami Hawkins 5 | Andre Mccoy 6 | Alton Hunter 7 | Kay Evans 8 | Duane Bailey 9 | Jean Torres 10 | Darrin Romero 11 | Alton Hunter 12 | alton hunter 13 | Kay Evans 14 | kay evans 15 | 16 | sophie wolfe 17 | tami hawkins 18 | andre mccoy 19 | 20 | -------------------------------------------------------------------------------- /functions/drive.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | def_drive() { 4 | 5 | echo -n "Your age? " 6 | read AGE 7 | 8 | if [[ $AGE -gt 16 ]] 9 | then 10 | echo "You may drive." 11 | 12 | elif [[ $AGE -lt 16 ]] 13 | then 14 | echo "You may not drive" 15 | exit 1 16 | 17 | fi 18 | 19 | } 20 | 21 | def_drive 22 | -------------------------------------------------------------------------------- /loops/while03.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # While loop. Example 1 4 | n=1 5 | # -le less than or equal to lt is less than = to 6 | while [ ${n} -lt 30 ] 7 | do 8 | echo n is now ${n} 9 | (( n++ )) 10 | sleep 0.05 11 | 12 | if [[ ${n} -eq 15 ]] 13 | then 14 | break 15 | 16 | fi 17 | done 18 | 19 | -------------------------------------------------------------------------------- /File_Globbing/touch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | touch README.md 4 | touch requirements.txt 5 | touch MAKE 6 | touch install.sh 7 | touch run.py 8 | touch data{1..5}.txt 9 | touch script.php 10 | touch file.js 11 | touch image.jpg 12 | touch image.IMG 13 | touch cv.tx 14 | touch nam3 15 | touch m1ke 16 | touch 12345 17 | -------------------------------------------------------------------------------- /dailyscripts/fast.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo '' 4 | echo -e 'Increase cursor speed. Press 1 for Yes, or 2 for No.' 5 | read sel 6 | 7 | # ON 8 | if [[ $sel -eq 1 ]]; 9 | then 10 | xset r rate 360 70 11 | 12 | # OFF 13 | elif [[ $sel -eq 2 ]]; 14 | then 15 | xset r rate 320 40 16 | 17 | fi 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /dailyscripts/red.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo '' 4 | echo -e "Redshift: ON 1. OFF 2.\n1 = ON\n2 = Off\n" 5 | read sel 6 | 7 | # Turn on redshift 8 | if [[ $sel -eq 1 ]] 9 | then 10 | redshift -O 4700K 11 | 12 | # Turn OFF 13 | elif [[ $sel -eq 2 ]] 14 | then 15 | redshift -x 16 | 17 | echo '' 18 | 19 | fi 20 | -------------------------------------------------------------------------------- /var/var3.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # User defined Vars & Integer Comparison 4 | echo -n "How old are you? " 5 | read AGE 6 | 7 | if [[ $AGE -gt 16 ]] 8 | then 9 | echo "You may drive." 10 | 11 | elif [[ $AGE -lt 16 ]] 12 | then 13 | echo "You are not old enough to drive." 14 | exit 1 15 | 16 | fi 17 | 18 | -------------------------------------------------------------------------------- /regex/touch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | touch file{1..9}.txt 4 | 5 | touch README.md 6 | touch requirements.txt 7 | touch MAKE 8 | touch install.sh 9 | touch run.py 10 | touch data{1..5}.txt 11 | touch script.php 12 | touch file.js 13 | touch image.jpg 14 | touch image.IMG 15 | touch cv.tx 16 | touch nam3 17 | touch m1ke 18 | touch 12345 19 | -------------------------------------------------------------------------------- /functions/while: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | while_func() { 4 | n=1 5 | 6 | while [ $n -lt 30 ] 7 | do 8 | echo n is now ${n} 9 | (( n++ )) 10 | sleep 0.05 11 | 12 | if [[ ${n} -eq 16 ]] 13 | then 14 | break 15 | 16 | fi 17 | done 18 | 19 | } 20 | 21 | while_func 22 | while_func 23 | while_func 24 | while_func 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /strs/concat.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #Initialize the first string variable 4 | string1="We are learning scripting with Bash! " 5 | 6 | #Init the second string variable 7 | string2="and having a good time." 8 | 9 | string3="BASH and LInx random string here." 10 | 11 | #Print after combining both strings 12 | echo "$string1$string2$string3 " 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /networking/nmap_net.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euo pipefail 4 | IFS=$'\n\t' 5 | 6 | echo 'Enter the IP range to scan: ' 7 | read IP 8 | 9 | nmap $IP -sn -f -vv -n >/dev/null -oG ScanResults 10 | #nmap 192.168.50.1-254 -sn -f -vv -n >/dev/null -oG ScanResults 11 | 12 | awk '{print $2, $5}' | grep -i up > ScanResults2 13 | 14 | cat ScanResults2 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /regex/vimtrix: -------------------------------------------------------------------------------- 1 | 2 | 3 | To Force Quit: 4 | 5 | :q! 6 | 7 | shift Z F 8 | 9 | ---------------------------------------- 10 | WRITE QUIT SHORTCUT 11 | 12 | esc : x 13 | 14 | -or- 15 | 16 | esc shift ZZ 17 | 18 | esc , then hold down shift, and press Z twice ZZ 19 | 20 | 21 | 22 | ------------------------------------------------ 23 | 24 | -------------------------------------------------------------------------------- /var/var1.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Var & conditional example 4 | object=z 5 | 6 | if [[ $object == "y" ]] 7 | then 8 | echo "no" 9 | 10 | elif [[ $object == "z" ]] 11 | then 12 | echo "yes" 13 | 14 | fi 15 | 16 | # Assigning vals to vars. 17 | # Just keep it simple and use the fail-safe method 18 | # use either upper or lowercase, dont mess around with numbers and 19 | # special chars 20 | -------------------------------------------------------------------------------- /user_and_group_management/dd_backup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Flash OS and all data to an external gard drive. 4 | # Schedule this in crontab. 5 | echo ' ' 6 | echo -e " Run lsblk first? Hit 1 for Yes. Hit 2 for No: \n1 yes\n2 no\n" 7 | read sel 8 | 9 | # Hit 1 for lsblk. 10 | if [[ $sel -eq 1 ]]; 11 | then 12 | lsblk 13 | echo '' 14 | 15 | # Hit 2 for no. 16 | elif [[ $sel -eq 2 ]]; 17 | then 18 | true 19 | 20 | fi 21 | 22 | dd if=/dev/sda of=/dev/sdb 23 | -------------------------------------------------------------------------------- /loops/colour_cpy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | def_colour() { 4 | 5 | 6 | for c in 90 31 91 32 33 34 35 95 36 97; 7 | do 8 | echo -en "\r \e[${c}m SCRIPTING WITH BASH \e[0m " 9 | sleep 0.05 10 | 11 | done 12 | 13 | } 14 | 15 | 16 | def_colour 17 | 18 | 19 | 20 | 21 | 22 | 23 | # 24 | #c='90 31 91 32 33 34 35 95 36 97' 25 | # 26 | #while [ c == c ] 27 | #do 28 | # echo -en "\r \e[${c}m SCRIPTING WITH BASH \e[0m " 29 | # 30 | # sleep 0.05 31 | # 32 | #d 33 | -------------------------------------------------------------------------------- /dd_backup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Flash OS and all data to an external gard drive. 4 | # Comment out all lines but 22 if you plan to automate backups via crontab. 5 | # Leave as is to run script manualy. 6 | echo ' ' 7 | echo -e " Run lsblk first? Hit 1 for Yes. Hit 2 for No: \n1 yes\n2 no\n" 8 | read sel 9 | 10 | # Hit 1 for lsblk. 11 | if [[ $sel -eq 1 ]]; 12 | then 13 | lsblk 14 | echo '' 15 | 16 | # Hit 2 for no. 17 | elif [[ $sel -eq 2 ]]; 18 | then 19 | true 20 | 21 | fi 22 | 23 | dd if=/dev/sda of=/dev/sdb 24 | -------------------------------------------------------------------------------- /sed/emails.txt: -------------------------------------------------------------------------------- 1 | GOAL: 2 | ISOLATE THE PASSWORDS USING JUST ONE SED COMMAND 3 | And REMOVE ALL OTHER CHARS. 4 | 5 | ========================================// ========== 6 | HACKED By: : ///L5C4S\\\ =// 21/02/2015 = 7 | ========================================// 02:24 ========== 8 | abarrene@umw.edu:antonio4 9 | abedur.rasul@yahoo.com:a1b1c1d1 10 | abellanger@gt.rr.com:mom7227691 11 | abby@emery.co.uk:maemae23 12 | abhayvc@hotmail.com:abhay190479 13 | abeandryan@centurytel.net:malachi1 14 | aaronsouthern@gmail.com:modem916 15 | -------------------------------------------------------------------------------- /loops/colour.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | def_colour() { 4 | 5 | 6 | for c in 90 31 91 32 33 34 35 95 36 97; 7 | do 8 | echo -en "\r \e[${c}m SCRIPTING WITH BASH \e[0m " 9 | sleep 0.05 10 | 11 | done 12 | 13 | } 14 | 15 | 16 | def_colour 17 | 18 | 19 | 20 | ###################################################### 21 | # 22 | #Infinite loop?? 23 | 24 | #c='90 31 91 32 33 34 35 95 36 97' 25 | # 26 | #while [ c == c ] 27 | #do 28 | # echo -en "\r \e[${c}m SCRIPTING WITH BASH \e[0m " 29 | # 30 | # sleep 0.05 31 | # 32 | ######################################################### 33 | -------------------------------------------------------------------------------- /all_commands/CMDS02.txt: -------------------------------------------------------------------------------- 1 | Linux CMDS VID 2 2 | 3 | 4 | THE THREE AREAS: 5 | network 6 | cp 7 | mv 8 | 9 | 10 | NETWORK RELATED 11 | ifconfig 12 | netstat -tulpn 13 | netstat -ant 14 | watch ss -tp (ntwrk conns) 15 | netstat -tulpn conns with PIDs 16 | 17 | 18 | 19 | 20 | COPY 21 | cp file1.txt file_cpy.txt <---- copy in place 22 | cp -r filei.txt /root <-----copy to another location 23 | 24 | MOVE 25 | change the file name 26 | mv file1.txt f1.txt 27 | 28 | moving files around: 29 | mv file1.txt -t Documents 30 | 31 | 32 | 33 | --------------------------------- 34 | 35 | Vid 3 36 | 37 | regex and wildcards 38 | 39 | ---------------------------------- 40 | vid 4 41 | 42 | scripting 43 | -------------------------------------------------------------------------------- /all_commands/CMDS_EASY.txt: -------------------------------------------------------------------------------- 1 | Linux CMDS VID 2 2 | 3 | 4 | THE THREE AREAS: 5 | network 6 | cp 7 | mv 8 | 9 | 10 | NETWORK RELATED 11 | ifconfig 12 | netstat -tulpn 13 | netstat -ant 14 | watch ss -tp (ntwrk conns) 15 | netstat -tulpn conns with PIDs 16 | 17 | 18 | 19 | 20 | COPY 21 | cp file1.txt file_cpy.txt <---- copy in place 22 | cp -r filei.txt /root <-----copy to another location 23 | 24 | MOVE 25 | change the file name 26 | mv file1.txt f1.txt 27 | 28 | moving files around: 29 | mv file1.txt -t Documents 30 | 31 | 32 | 33 | --------------------------------- 34 | 35 | Vid 3 36 | 37 | regex and wildcards 38 | 39 | ---------------------------------- 40 | vid 4 41 | 42 | scripting 43 | -------------------------------------------------------------------------------- /all_commands/CMDS_OVERFVIEW.txt: -------------------------------------------------------------------------------- 1 | Linux CMDS VID 2 2 | 3 | 4 | THE THREE AREAS: 5 | network 6 | cp 7 | mv 8 | 9 | 10 | NETWORK RELATED 11 | ifconfig 12 | netstat -tulpn 13 | netstat -ant 14 | watch ss -tp (ntwrk conns) 15 | netstat -tulpn conns with PIDs 16 | 17 | 18 | 19 | 20 | COPY 21 | cp file1.txt file_cpy.txt <---- copy in place 22 | cp -r filei.txt /root <-----copy to another location 23 | 24 | MOVE 25 | change the file name 26 | mv file1.txt f1.txt 27 | 28 | moving files around: 29 | mv file1.txt -t Documents 30 | 31 | 32 | 33 | --------------------------------- 34 | 35 | Vid 3 36 | 37 | regex and wildcards 38 | 39 | ---------------------------------- 40 | vid 4 41 | 42 | scripting 43 | -------------------------------------------------------------------------------- /all_commands/vim_tutor_notes.txt: -------------------------------------------------------------------------------- 1 | vimtutor 2 | 3 | 4 | To save and exit: you have two options 5 | 6 | :wq 7 | 8 | -or- 9 | 10 | Hold shift + zz 11 | 12 | 13 | To quit without saving: 14 | 15 | :q! 16 | 17 | COPY - PASTE 18 | 19 | 1. Place the cursor infront of what you want to paste 20 | 21 | 2. enter Visual mode 22 | 23 | 3. using the -> highlight the text 24 | 25 | 4. hit y to copy 26 | 27 | 5. scroll to where you want to paste the text 28 | 29 | 6. make sure you are in Visual mode and hit p 30 | 31 | (if you need to go into Insert mode to navigate to the location, just be sure to return to Visual before pasting) 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /the_ultimate_vimrc: -------------------------------------------------------------------------------- 1 | https://github.com/LinuxUser255/vimrc 2 | 3 | How to install the Basic version? 4 | The basic version is just one file and no plugins. Just copy basic.vim and paste it into your vimrc. 5 | 6 | The basic version is useful to install on remote servers where you don't need many plugins, and you don't do many edits. 7 | 8 | git clone --depth=1 https://github.com/amix/vimrc.git ~/.vim_runtime 9 | sh ~/.vim_runtime/install_basic_vimrc.sh 10 | 11 | 12 | How to install the Awesome version? 13 | Install for your own user only 14 | The awesome version includes a lot of great plugins, configurations and color schemes that make Vim a lot better. To install it simply do following from your terminal: 15 | 16 | git clone --depth=1 https://github.com/amix/vimrc.git ~/.vim_runtime 17 | sh ~/.vim_runtime/install_awesome_vimrc.sh 18 | -------------------------------------------------------------------------------- /File_Globbing/n1: -------------------------------------------------------------------------------- 1 | Bethany Carr 2 | Lana Steele 3 | Sophie Wolfe 4 | sam yeeeeee 5 | Chaim Baruch 6 | Sayyed Hossien 7 | Tami Hawkins 8 | Gopi Kotoor 9 | Andre Mccoy 10 | Esfahān 11 | Alton Hunter 12 | Kay Evans 13 | Khaadm Boraazjaanii 14 | Duane Bailey 15 | Jean Torresi 16 | Albert Bronstien 17 | Darrin Romero 18 | Alton Hunter 19 | alton Hunter 20 | Kay Evans 21 | Khaadm Borāzjāni 22 | Henry Morganthau 23 | kay evanns 24 | Ke Yan 25 | Abbas Al-Tonsii 26 | Emily Loomer 27 | Laura Looomer 28 | Bonniee Michaels 29 | Victor Coolidge 30 | Hassan Musavi 31 | Hassan Muuusavi 32 | Hassaan Muuuuuuusavi 33 | Gleen Greenwald 34 | Hannah Hill 35 | Jaaberi Esfahaani 36 | Yuuto Itsuki 37 | Aaron Blake 38 | Samira Ali 39 | Qian Zhingshu 40 | Giosuè Carducci 41 | Alexander Izmaylov 42 | Paul Scarron 43 | Abu Salaam 44 | Atlanta 45 | Toronto 46 | Tokyo 47 | 48 | Er1c 49 | Thr3d 50 | -------------------------------------------------------------------------------- /Course_Resources/course_resources.txt: -------------------------------------------------------------------------------- 1 | 2 | Debian's main website 3 | https://www.debian.org/ 4 | 5 | Debian Linux iso download 6 | https://cdimage.debian.org/cdimage/unofficial/non-free/cd-including-firmware/current-live/amd64/iso-hybrid/ 7 | 8 | Virtual Box Hypervisor 9 | https://www.virtualbox.org/ 10 | 11 | Virtual Box Extension Pack. 12 | The extension pack is not absolutely necessary, though it can be helpful if you want to code along when mounting external devices to a VM. 13 | https://phoenixnap.com/kb/install-virtualbox-extension-pack 14 | 15 | Vim tips 16 | https://vim.fandom.com/wiki/Copy,_cut_and_paste 17 | 18 | Basic Vimrc file 19 | https://vim.fandom.com/wiki/Example_vimrc 20 | 21 | The ultimate Vimrc 22 | https://github.com/amix/vimrc 23 | in the command line do: 24 | git clone --depth=1 https://github.com/amix/vimrc.git ~/.vim_runtime 25 | sh ~/.vim_runtime/install_awesome_vimrc.sh 26 | 27 | 28 | -------------------------------------------------------------------------------- /change_permissions: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # You must be root to run this script. 4 | if [[ "${UID}" -ne 0 ]] 5 | then 6 | echo 'You must be root to run this script.' 7 | exit 1 8 | fi 9 | 10 | # Begin user and file ownership selection 11 | echo "What do you want to do? " 12 | echo "1) Change file ownership of just one user? " 13 | echo "2) Change all at once? " 14 | read -p "> " choice 15 | 16 | case $choice in 17 | 18 | 1) read -p "Change file ownership to which user? " USER 19 | read -p "File name: " FILE 20 | chown ${USER} ${FILE} 21 | [ $? -eq 0 ] && { echo "File ownership has been changed. " "${FILE}"; exit 0; } 22 | ;; 23 | 24 | 25 | 2) read -p "New owner: " OWNER 26 | read -p "Group: " GROUP 27 | read -p "File: " FILE 28 | chown ${OWNER}:${GROUP} ${FILE} 29 | [ $? -eq 0 ] && { echo "Owner, group and file ownership been changed." "${FILE}"; exit 0; } 30 | ;; 31 | 32 | 33 | esac 34 | 35 | -------------------------------------------------------------------------------- /user_and_group_management/change.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Quickly edit text files 4 | # You must be root to execute this script. 5 | if [[ "${UID}" -ne 0 ]] 6 | then 7 | echo 'You must be root to run this script.' 8 | exit 1 9 | fi 10 | 11 | echo "What do you want to do? " 12 | echo "1) Change file ownership of just one user? " 13 | echo "2) Change all at once? " 14 | read -p "> " choice 15 | 16 | case $choice in 17 | 18 | 1) read -p "Change file ownership to which user? " USER 19 | read -p "File name: " FILE 20 | chown ${USER} ${FILE} 21 | [ $? -eq 0 ] && { echo "File ownership has been changed. " "${FILE}"; exit 0; } 22 | ;; 23 | 24 | #ls -lt ${FILE} 25 | 26 | 2) read -p "New owner: " OWNER 27 | read -p "Group: " GROUP 28 | read -p "File: " FILE 29 | chown ${OWNER}:${GROUP} ${FILE} 30 | [ $? -eq 0 ] && { echo "Owner and file have both been changed." "${FILE}"; exit 0; } 31 | ;; 32 | 33 | #ls -lt ${FILE} 34 | 35 | esac 36 | -------------------------------------------------------------------------------- /var/3.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Integer Comparison 4 | echo -n "How old are you? " 5 | read age 6 | 7 | # Use "${age}" ? Or just $age ? 8 | if [[ $age -gt 16 ]] 9 | then 10 | echo "You may drive." 11 | 12 | elif [[ $age -lt 16 ]] 13 | then 14 | echo "You are not old enough to drive." 15 | exit 1 16 | fi 17 | 18 | # single quote prvent vars from expansion and specificity and no changes 19 | # Use double quotes with variables for expansion 20 | #Curly braces are ALWAYS needed for 21 | # ACCESSING ARRAY elements and carrying out BRACE EXPANSION. 22 | 23 | # Regarding using them on Variables: 24 | # The script will run either way however 25 | # when appending something to the Variable, then you must use the curly brace syntax. 26 | # ${VAR}iaible 27 | 28 | # They are not always necessary. Some say always use them as best practice, 29 | # in case you need them and therefore do not inadvertantly leave them out. 30 | # While others say no because they make the code more verbose and takes longer to type. 31 | -------------------------------------------------------------------------------- /regex/awk.txt: -------------------------------------------------------------------------------- 1 | awk '{print $4}' emails.txt 2 | 3 | awk '/@/ && /mail/ {print $4}' emails.txt 4 | 5 | (awk '/@/ && /mail/ {print $4}' emails.txt | tr -d \") 6 | 7 | (awk '/@/ && /mail/ {print $4}' emails1 | tr -d '2009' | tr -d '7' | tr -d '1-8' | tr -d \") 8 | 9 | (cat testclean | tr -d '-' | tr -d '...' | tr -d ',,') 10 | 11 | ------------------------------------------------------------------------------------------------- 12 | 13 | THIS DID IT 14 | 15 | awk '/@/ {print $4}' emails.txt | tr -d '2009' | tr -d '1-8' | tr -d '-' | tr -d ',' | tr -d '"' | tr -d '...' > emails2.txt 16 | 17 | ---------------------------------------------------------------------------------------------------------------------------- 18 | 19 | head emails.txt 20 | 21 | sed 11q emails.txt 22 | 23 | awk '(NR>=0 && NR<=11){print} (NR==11){exit}' emails.txt 24 | 25 | grep -i 'www' emails.txt 26 | 27 | sed'[Qq]we /!q' e 28 | 29 | awk 'tolower($0) ~ /qweq/' e 30 | 31 | awk '$3 > 0 {print $1, $2 * $3 }' em2 32 | 33 | awk '$3 > 0' em2 34 | 35 | awk '{print NF}' em2 NF number of fields 36 | 37 | awk '{print NF, $NF}' em2 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 CodeRed by EC-Council 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /var/varex.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | VAR='script' 4 | 5 | echo "$VAR" 6 | 7 | echo ${VAR} 8 | 9 | # Using { } to append text to the variable." 10 | echo " Bash ${VAR}ing." 11 | 12 | # Use of {} for array and expansion. 13 | touch file{1..3}.txt 14 | 15 | 16 | 17 | 18 | 19 | # Using braces to display the var contents is an alternative way 20 | # ${VAR} 21 | # Best practice is to use UPPER case for VARIABLES 22 | # {} are not ALWAYS necessary for VARS, 23 | # BUT, Curly braces are ALWAYS needed for 24 | # ACCESSING ARRAY elements and carrying out BRACE EXPANSION 25 | # single quote prvent vars from expansion and specificity and no changes 26 | # Use double quotes with variables for expansion 27 | . 28 | 29 | # Regarding using them on Variables: 30 | # The script will run either way however 31 | # when appending something to the Variable, then you must use the curly brace syntax. 32 | # ${VAR}iaible 33 | 34 | # They are not always necessary. Some say always use them as best practice, 35 | # in case you need them and therefore do not inadvertantly leave them out. 36 | # While others say no because they make the code more verbose and takes longer to type. 37 | 38 | -------------------------------------------------------------------------------- /regex/regex.txt: -------------------------------------------------------------------------------- 1 | REGULAR EXPRESSIONS - GREP 2 | 3 | . any one char 4 | * match any number of previous (also 0) 5 | + match any number of previous 6 | $ end of line 7 | ^ beginning of line 8 | \S any non-whitespace char 9 | \s any white-space char 10 | ? optional 11 | [a-z] any lower case letter 12 | [A-Z] any UPPER CASE letter 13 | \ escape something 14 | [A-Za-Z] any letter regardless of caps 15 | [0-9] any number 16 | ----------------------------------------------------------- 17 | exe: 18 | 19 | grep "o" n2 20 | grep "o$" n2 21 | grep "^e" n2 22 | grep ".c" n2 23 | grep ".c*" n2 24 | igrep "oo" n2 25 | grep ".oo" n2 26 | grep ".*oo" n2 27 | grep ".*ol" n2 28 | grep "\s*oo" n2 29 | grep "^\s*ad" n2 30 | 31 | grep "http" urls.txt 32 | grep "\http\." u 33 | grep "http:\?" u 34 | grep "http\://\S*" u 35 | grep "http\://\S*\.[a-z]" u 36 | grep "http\://\S*\.[a-z]\+\S*" u 37 | 38 | ---------------------------------------------- 39 | GREPPING EMAILS 40 | 41 | grep "\S\+@\S\+\.[A-Za-z]\+" emails.txt 42 | grep "\S\+@\S\+\.[A-Za-z]\+" emails.txt 43 | 44 | ---------------------------------------------------------------- 45 | AWK 46 | 47 | awk '{print $4}' emails.txt 48 | 49 | -------------------------------------------------------------------------------- /regex/regex_cp.txt: -------------------------------------------------------------------------------- 1 | REGULAR EXPRESSIONS - GREP 2 | 3 | . any one char 4 | * match any number of previous (also 0) 5 | + match any number of previous 6 | $ end of line 7 | ^ beginning of line 8 | \S any non-whitespace char 9 | \s any white-space char 10 | ? optional 11 | [a-z] any lower case letter 12 | [A-Z] any UPPER CASE letter 13 | \ escape something 14 | [A-Za-Z] any letter regardless of caps 15 | [0-9] any number 16 | ----------------------------------------------------------- 17 | exe: 18 | 19 | grep "o" n2 20 | grep "o$" n2 21 | grep "^e" n2 22 | grep ".c" n2 23 | grep ".c*" n2 24 | igrep "oo" n2 25 | grep ".oo" n2 26 | grep ".*oo" n2 27 | grep ".*ol" n2 28 | grep "\s*oo" n2 29 | grep "^\s*ad" n2 30 | 31 | grep "http" urls.txt 32 | grep "\http\." u 33 | grep "http:\?" u 34 | grep "http\://\S*" u 35 | grep "http\://\S*\.[a-z]" u 36 | grep "http\://\S*\.[a-z]\+\S*" u 37 | 38 | ---------------------------------------------- 39 | GREPPING EMAILS 40 | 41 | grep "\S\+@\S\+\.[A-Za-z]\+" emails.txt 42 | grep "\S\+@\S\+\.[A-Za-z]\+" emails.txt 43 | 44 | ---------------------------------------------------------------- 45 | AWK 46 | 47 | awk '{print $4}' emails.txt 48 | 49 | -------------------------------------------------------------------------------- /user_and_group_management/users.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Quickly add a new user to the system. 4 | # This script combines the useradd cmd plus attributes. 5 | 6 | # Create username (login). 7 | echo 'Enter the username: ' 8 | read USER_NAME 9 | 10 | # Persons real name. 11 | echo 'Enter the person's real name: '' 12 | read COMMENT 13 | 14 | # Create a password. 15 | echo 'PW for the acct: ' 16 | read PASSWORD 17 | 18 | # Create the account. 19 | # -m creates user's home dir if it does not already exist. 20 | useradd -c "${COMMENT}" -m ${USER_NAME} 21 | 22 | # Set the password. 23 | echo "${USER_NAME}:${PASSWORD}" | chpasswd 24 | 25 | # ADD THE NEW USER TO A GROUP?? 26 | echo -e "Add this user to a group?\n Yes 1. No 2.\n1 = Yes\n2 = No\n" 27 | read sel 28 | 29 | if [[ $sel -eq 1 ]] 30 | then 31 | echo 'Enter group name: ' 32 | read GROUP_NAME 33 | usermod -G ${GROUP_NAME} ${USER_NAME} 34 | 35 | elif [[ $sel -eq 2 ]] 36 | then 37 | true 38 | # true is the equivilant of pass in Python 39 | 40 | 41 | # Display username, pw, & the host 42 | echo '' 43 | echo "${USER_NAME} " 44 | echo '' 45 | echo "${PASSWORD} " 46 | echo '' 47 | echo "${HOSTNAME} " 48 | 49 | fi 50 | exit 0 51 | -------------------------------------------------------------------------------- /instant.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #By utilizing the touch, chmod, echo, and vim commands, in that order, this Bash script enables the user 4 | #to instantly create, open and make an executable Python or Bash file. 5 | #This bypasses the hassle of manually opening vim, 6 | #typing the interpreter (#!/usr/bin/env python3) or (#!/bin/bash), saving , exiting then chmoding it. 7 | 8 | # First make sure the script is being executed with sudo privileges. 9 | if [[ "${UID}" -ne 0 ]] 10 | then 11 | echo 'Please run with sudo or as root.' 12 | exit 1 13 | fi 14 | 15 | 16 | # Create either a Python or Bash file & open it with Vim 17 | echo -e "Create a Python or Bash file: \n1 = Python\n2 = Bash" 18 | read sel 19 | 20 | # Crete a Python file/script 21 | if [[ $sel -eq 1 ]]; 22 | then 23 | echo "Name the Python file: " 24 | read NAME 25 | touch $NAME.py 26 | echo '#!/usr/bin/env python3' > $NAME.py 27 | chmod +x $NAME.py 28 | vim $NAME.py 29 | 30 | 31 | # Create a Bash Script 32 | elif [[ $sel -eq 2 ]]; 33 | then 34 | echo "Name the Bash script: " 35 | read NAME 36 | touch $NAME.sh 37 | chmod 755 $NAME.sh 38 | echo '#!/bin/bash' > $NAME.sh 39 | vim $NAME.sh 40 | 41 | 42 | exit 0 43 | fi 44 | -------------------------------------------------------------------------------- /user_and_group_management/passwordgen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #Generating Random Data, Cryptographic Hash Funtions, Text & String Manipulation 4 | 5 | #Random number as a password. 6 | PASSWORD="${RANDOM}" 7 | echo "${PASSWORD}" 8 | 9 | #Three random numbers together. 10 | PASSWORD="${RANDOM}${RANDOM}${RANDOM}" 11 | echo "${PASSWORD}" 12 | 13 | #Six random numbers together. 14 | PASSWORD="${RANDOM}${RANDOM}${RANDOM}${RANDOM}${RANDOM}${RANDOM}" 15 | echo "${PASSWORD}" 16 | 17 | #Use the current date/time as the basis for the password. 18 | PASSWORD=$(date +%s) 19 | echo "${PASSWORD}" 20 | 21 | #Use nanoseconds to act as randomization. 22 | PASSWORD=$(date +%s%N) 23 | echo "${PASSWORD}" 24 | 25 | # A lengther password combining date, seconds, sha256 and chaaracter 26 | #length specification 27 | PASSWORD=$(date +%s%N | sha256sum | head -c32) 28 | echo "${PASSWORD}" 29 | 30 | 31 | PASSWORD=$(date +%s%N | sha256sum | head -c48) 32 | echo "${PASSWORD}" 33 | 34 | 35 | #Append a special character to the password - 48 character 36 | SPECIAL_CHARACTER=$(echo '!@#$^&*()-_=+' | fold -w1 | shuf | head -c48) 37 | 38 | 39 | #Use SHA-3 40 | PASSWORD=$(date +%s%N | sha512sum | head -c48) 41 | echo "${PASSWORD}${SPECIAL_CHARACTER}" 42 | 43 | 44 | -------------------------------------------------------------------------------- /regex/file_globbing.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | * 0 or more chars could be begin or end of the word 4 | 5 | *d* anything wit a in it 6 | 7 | [] is OR betweeen a range of characters 8 | 9 | [dc]* 10 | 11 | ? must be 1 or more chars at the start 12 | 13 | ?*d one char infront. then followed by zero or more (a) 14 | must be at least one char infront of the A 15 | 16 | 17 | ! ls [!ad]* negate the a or b 18 | 19 | ls *[[:upper:]]* search for just upper 20 | ls *[[:digit:]]* search for just digits 21 | ls *[[:punct:]]* search for chars with punctuation 22 | 23 | -------------------------------------------------------------------------------- 24 | 25 | 26 | 476 ls 27 | 477 ls * 28 | 478 ls *d* 29 | 479 ls [ad]* 30 | 481 ls [!tr]* 31 | ls [0-9]* 32 | 483 ls *[[:upper:]]* 33 | ls *[[:lower:]]* 34 | 484 ls *[[:digit:]]* 35 | 485 ls *[[:punct:]]* 36 | 37 | rm d* remove all fiels begining with d 38 | rm *d* remove all files with d 39 | rm .txt* remove all .txt files 40 | 41 | run touch.sh again 42 | 43 | then 44 | 45 | cp -r f* .. copy everything with f back one dir 46 | 47 | ! CAREFULL ! 48 | 49 | REMOVE EVERYTHING 50 | 51 | rm * 52 | 53 | 54 | -------------------------------------------------------------------------------- /File_Globbing/file_globbing.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | * 0 or more chars could be begin or end of the word 4 | 5 | *d* anything wit a in it 6 | 7 | [] is OR betweeen a range of characters 8 | 9 | [dc]* 10 | 11 | ? must be 1 or more chars at the start 12 | 13 | ?*d one char infront. then followed by zero or more (a) 14 | must be at least one char infront of the A 15 | 16 | 17 | ! ls [!ad]* negate the a or b 18 | 19 | ls *[[:upper:]]* search for just upper 20 | ls *[[:digit:]]* search for just digits 21 | ls *[[:punct:]]* search for chars with punctuation 22 | 23 | -------------------------------------------------------------------------------- 24 | 25 | 26 | 476 ls 27 | 477 ls * 28 | 478 ls *d* 29 | 479 ls [ad]* 30 | 481 ls [!tr]* 31 | ls [0-9]* 32 | 483 ls *[[:upper:]]* 33 | ls *[[:lower:]]* 34 | 484 ls *[[:digit:]]* 35 | 485 ls *[[:punct:]]* 36 | 37 | rm d* remove all fiels begining with d 38 | rm *d* remove all files with d 39 | rm .txt* remove all .txt files 40 | 41 | run touch.sh again 42 | 43 | then 44 | 45 | cp -r f* .. copy everything with f back one dir 46 | 47 | ! CAREFULL ! 48 | 49 | REMOVE EVERYTHING 50 | 51 | rm * 52 | 53 | 54 | -------------------------------------------------------------------------------- /all_commands/uniq.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | sort (alphebetical) 5 | 6 | sort numerical value [option -n] 7 | 8 | 9 | -------------------------------------------------------- 10 | 11 | 12 | The "nl" command is dedicated for adding line numbers to a file. 13 | cat -n file.txt 14 | 15 | nl file.txt > file2.txt 16 | 17 | or 18 | cat -n file.txt > newfile.txt 19 | 20 | 21 | edit a list of names 22 | head 50names.txt | nl | sort -n > file1.txt 23 | 24 | 25 | ------------------------------------------------------------ 26 | 27 | 28 | uniq --- > matching lines 29 | sort | uniq 30 | 31 | count dups 32 | uniq -c file.txt | less 33 | 34 | 35 | Listing Only Duplicate Lines 36 | uniq -d file.txt 37 | 38 | list all dupps 39 | uniq -D sorted.txt | less 40 | 41 | ------------------------------------------------------------- 42 | 43 | 44 | cut 45 | 46 | cutting bytes & specific byte(s) 47 | head 50 | cut -b 1 48 | 49 | & range 50 | 51 | cut | -b 5-10 52 | 53 | 54 | Cut Text From Columns using Fields and Delimiters 55 | $ echo "Let's cut this input stream section by section" | cut -d ' ' -f 1,2,3 56 | 57 | 58 | Cut Range of Fields from the Input Stream 59 | $ echo "Let's cut this input stream section by section" | cut -d ' ' -f 1-5 60 | 61 | ------------------------------------------------------------------------------------------------ 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /user_and_group_management/edit.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | # This Bash Script enables the user to quickly edit text files. 5 | echo "What do you want to do?" 6 | echo "1) Remove duplicates " 7 | echo "2) Sort by length " 8 | echo "3) Sort by [0-9][A-Z] " 9 | echo "4) Remove all blank lines " 10 | echo "q) quit " 11 | read -p "> " choice 12 | 13 | # The case statement is used in lieu of a nested if statement. 14 | # It is a way to simplify complex conditionals. 15 | case $choice in 16 | 17 | # 1) Remove duplicates 18 | 1) read -p "Enter path to file: " f_path 19 | awk '!(count[$0]++)' "$f_path" > ${f_path}-new 20 | [ $? -eq 0 ] && { echo "Duplicates have been removed, see new file at ${f_path}-new"; exit 0; } 21 | ;; 22 | 23 | 24 | 25 | # 2) Sort by length 26 | 2) read -p "Enter path to file: " f_path 27 | awk '{print length, $0}' "$f_path" | sort -n | cut -d " " -f2- > ${f_path}-new 28 | [ $? -eq 0 ] && { echo "File has been sorted by length at ${f_path}-new"; exit 0; } 29 | ;; 30 | 31 | 32 | 33 | # 3) Sort by [0-9][A-Z] 34 | 3) read -p "Enter path to file: " f_path 35 | sort "$f_path" | uniq > ${f_path}-new 36 | [ $? -eq 0 ] && { echo "File has been sorted in alphebetical order at ${f_path}-new"; exit 0; } 37 | ;; 38 | 39 | 40 | 41 | # 4) Remove all blank lines 42 | 4) read -p "Enter path to file: " f_path 43 | egrep -v "^[[:space:]]*$" "$f_path" > ${f_path}-new 44 | [ $? -eq 0 ] && { echo "All blank lines removed at ${f_path}-new"; exit 0; } 45 | ;; 46 | 47 | 48 | # 5) Quit 49 | q) echo "Cheers" 50 | ;; 51 | *) echo "Have a nice day" 52 | ;; 53 | 54 | esac 55 | -------------------------------------------------------------------------------- /REGEX/uniq/most_common_pws.txt: -------------------------------------------------------------------------------- 1 | 2 | Top 25 most common passwords by year according to SplashData 3 | Rank 2011 [6] 2012 [7] 2013 [8] 2014 [9] 2015 [10] 2016 [5] 2017 [11] 2018 [12] 2019 [13] 4 | 1 password password 123456 123456 123456 123456 123456 123456 123456 5 | 2 123456 123456 password password password password password password 123456789 6 | 3 12345678 12345678 12345678 12345 12345678 12345 12345678 123456789 qwerty 7 | 4 qwerty abc123 qwerty 12345678 qwerty 12345678 qwerty 12345678 password 8 | 5 abc123 qwerty abc123 qwerty 12345 football 12345 12345 1234567 9 | 6 monkey monkey 123456789 123456789 123456789 qwerty 123456789 111111 12345678 10 | 7 1234567 letmein 111111 1234 football 1234567890 letmein 1234567 12345 11 | 8 letmein dragon 1234567 baseball 1234 1234567 1234567 sunshine iloveyou 12 | 9 trustno1 111111 iloveyou dragon 1234567 princess football qwerty 111111 13 | 10 dragon baseball adobe123 [lower-alpha 1] football baseball 1234 iloveyou iloveyou 123123 14 | 11 baseball iloveyou 123123 1234567 welcome login admin princess abc123 15 | 12 111111 trustno1 admin monkey 1234567890 welcome welcome admin qwerty123 16 | 13 iloveyou 1234567 1234567890 letmein abc123 solo monkey welcome 1q2w3e4r 17 | 14 master sunshine letmein abc123 111111 abc123 login 666666 admin 18 | 15 sunshine master photoshop [lower-alpha 1] 111111 1qaz2wsx admin abc123 abc123 qwertyuiop 19 | 16 ashley 123123 1234 mustang dragon 121212 starwars football 654321 20 | 17 bailey welcome monkey access master flower 123123 123123 555555 21 | 18 passw0rd shadow shadow shadow monkey passw0rd dragon monkey lovely 22 | 19 shadow ashley sunshine master letmein dragon passw0rd 654321 7777777 23 | 20 123123 football 12345 michael login sunshine master !@#$%^&* welcome 24 | 21 654321 jesus password1 superman princess master hello charlie 888888 25 | 22 superman michael princess 696969 qwertyuiop hottie freedom aa123456 princess 26 | 23 qazwsx ninja azerty 123123 solo loveme whatever donald dragon 27 | 24 michael mustang trustno1 batman passw0rd zaq1zaq1 qazwsx password1 password1 28 | 25 Football password1 000000 trustno1 starwars password1 trustno1 qwerty123 123qwe 29 | -------------------------------------------------------------------------------- /user_and_group_management/sysbackup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This will back up or "flash" your OS & all your data on an external HDD 4 | DEST_DRIVE="/dev/sdb" # Backup will be stored on this device 5 | DEST_MOUNT=" 6 | /media/usb" # Mount point of flash drive 7 | BACKUP_FOLDERS=("/dev/sda") # Backup folders 8 | #LOGFILE="/var/log/mybackup.log" # Logfile 9 | #DELFILES="$DEST_MOUNT/delted_files" # Path to folder for deleted files 10 | #THRESHOLD=10 # keep deleted files for 10 days 11 | 12 | # write first parameter $1 to logfile 13 | function write_to_log 14 | { 15 | # get current date and time 16 | bkp_date=$(date +%Y-%m-%d@%H:%M:%S) 17 | echo -e "$bkp_date : $1" >> $LOGFILE 18 | } 19 | 20 | # Append log entry 21 | write_to_log "====== Starting Backup ======" 22 | 23 | # test whether symbolic link to flash drive exists 24 | if [ ! -h $DEST_DRIVE ]; then 25 | write_to_log "[X] Error: Backup drive not available" 26 | write_to_log "====== Backup finished ======\n\n" 27 | exit 1 28 | fi 29 | 30 | # check whether mount point is in use 31 | if [ ! -z "$(mount -l | grep ${DEST_MOUNT})" ]; then 32 | write_to_log "[X] Error: Mount point already in use" 33 | write_to_log "====== Backup finished ======\n\n" 34 | exit 1 35 | fi 36 | 37 | # Mount flash drive 38 | mount $DEST_DRIVE $DEST_MOUNT 39 | if [ $? -ne 0 ]; then 40 | write_to_log "[X] Error: Could not mount flash drive" 41 | write_to_log "====== Backup finished ======\n\n" 42 | exit 1 43 | fi 44 | 45 | # delete all files from $DELFILES older than $THRESHOLD days 46 | if [ -d "${DELFILES}" ]; then 47 | find $DELFILES -type f -mtime $THRESHOLD -delete >> $LOGFILE 48 | fi 49 | 50 | # copy files (create backup) 51 | for f in ${BACKUP_FOLDERS[@]}; do 52 | # check if given file is directory and readable 53 | if [ -d $f ] && [ -r $d ]; then 54 | rsync -avbuz --delete --backup-dir=$DELFILES $f $DEST_MOUNT >> $LOGFILE 55 | fi 56 | done 57 | 58 | # flush file system buffer 59 | sync 60 | 61 | # unmount flash drive 62 | umount $DEST_MOUNT 63 | if [ $? -ne 0 ]; then 64 | write_to_log "[X] Error: Could not unmount flash drive" 65 | fi 66 | 67 | write_to_log "====== Backup finished ======\n\n" 68 | -------------------------------------------------------------------------------- /sed/sed.txt: -------------------------------------------------------------------------------- 1 | --------------------------------------------------------- 2 | SED : REGULAR EXPRESSIONS 3 | --------------------------------------------------------- 4 | . any one char 5 | * match any number of previous (also 0) 6 | + match any number of previous 7 | $ end of line 8 | ^ beginning of line 9 | \S any non-whitespace char 10 | \s any white-space char 11 | ? optional 12 | [a-z] any lower case letter 13 | [A-Z] any UPPER CASE letter 14 | \ escape something 15 | [A-Za-Z] any letter regardless of caps 16 | [0-9] any number 17 | ----------------------------------------------------------- 18 | Examples of sed: 19 | 20 | # Sub and replace lower case c with capital Cs in a text file 21 | 22 | sed is a stream editor 23 | 24 | sed "s/cC/g" file.txt 25 | 26 | # the g runs the sub cmds more than once 27 | 28 | # Replace the patern of something 29 | #replace a comment 30 | 31 | # the period stands for any char, and the astrix says whatever was previously typed 32 | #say any number of those, (like a wild card) 33 | # This command will remove every # 34 | sed "s/#.*//g" file 35 | 36 | # Add spaces: 37 | sed 's/$/\n/' 38 | 39 | # Remove spaces 40 | sed "s/\s*#.*//g" file.txt 41 | 42 | You can concatonate sed s 43 | (and the d at the end is to delete blank lines) 44 | (the g is to replace all instances of the targeted char) 45 | 46 | 47 | sed "s/\s*#.*//g;s/c/C/g" file.txt 48 | 49 | sed "s/\s*#.*//g; /cf/ d" file.txt 50 | 51 | --------------------------------------------- 52 | GOAL: 53 | ISOLATE THE PASSWORDS WITH JUST ONE COMMAND, USING ANY COMBO OF AWK & SED 54 | And REMOVE ALL OTHER CHARS. 55 | 56 | ========================================// ========== 57 | HACKED By: : ///L5C4S\\\ =// 21/02/2015 = 58 | ========================================// 02:24 ========== 59 | abarrene@umw.edu:antonio4 60 | abedur.rasul@yahoo.com:a1b1c1d1 61 | abellanger@gt.rr.com:mom7227691 62 | abby@emery.co.uk:maemae23 63 | abhayvc@hotmail.com:abhay190479 64 | abeandryan@centurytel.net:malachi1 65 | aaronsouthern@gmail.com:modem916 66 | 67 | -------------------------------------------------------------------------------- 68 | 69 | awk '{print $1}' emsandpws.txt | sed "s/=.*//g;s/\S*://g;s/HACKED.*//g; /^$/ d" 70 | 71 | -or better- 72 | 73 | sed "s/=.*//g;s/\S*://g;s/HACKED.*//g; /^$/ d" emsandpws.txt 74 | -------------------------------------------------------------------------------- /regex/sed.txt: -------------------------------------------------------------------------------- 1 | --------------------------------------------------------- 2 | REGULAR EXPRESSIONS 3 | 4 | . any one char 5 | * match any number of previous (also 0) 6 | + match any number of previous 7 | $ end of line 8 | ^ beginning of line 9 | \S any non-whitespace char 10 | \s any white-space char 11 | ? optional 12 | [a-z] any lower case letter 13 | [A-Z] any UPPER CASE letter 14 | \ escape something 15 | [A-Za-Z] any letter regardless of caps 16 | [0-9] any number 17 | ----------------------------------------------------------- 18 | Examples of sed: 19 | 20 | # Sub and replace lower case c with capital Cs in a text file 21 | 22 | sed is a stream editor 23 | 24 | sed "s/c/C/g" file.txt 25 | # the g runs the sub cmds more than once 26 | 27 | # Make all lower case into UPPER case 28 | sed 's/\([a-z]\)/\U\1/g' 29 | sed 's/.*/\U&/' 30 | 31 | 32 | # Make all UPPER into lower 33 | sed 's/\([A-Z]\)/\l\1/g' 34 | sed 's/.*/\L&/' 35 | 36 | 37 | # Replace the patern of something 38 | #replace a comment 39 | 40 | # the period stands for any char, and the astrix says whatever was previously typed 41 | #say any number of those, (like a wild card) 42 | # This command will remove every # 43 | sed "s/#.*//g" file 44 | 45 | to remove spaces 46 | sed "s/\s*#.*//g" file.txt 47 | 48 | You can concatonate sed s 49 | (and the d at the end is to delete blank lines) 50 | (the g is to replace all instances of the targeted char) 51 | 52 | 53 | sed "s/\s*#.*//g;s/c/C/g" file.txt 54 | 55 | sed "s/\s*#.*//g; /cf/ d" file.txt 56 | 57 | --------------------------------------------- 58 | GOAL: 59 | ISOLATE THE PASSWORDS WITH JUST ONE COMMAND, USING ANY COMBO OF AWK & SED 60 | And REMOVE ALL OTHER CHARS. 61 | 62 | ========================================// ========== 63 | HACKED By: : ///L5C4S\\\ =// 21/02/2015 = 64 | ========================================// 02:24 ========== 65 | abarrene@umw.edu:antonio4 66 | abedur.rasul@yahoo.com:a1b1c1d1 67 | abellanger@gt.rr.com:mom7227691 68 | abby@emery.co.uk:maemae23 69 | abhayvc@hotmail.com:abhay190479 70 | abeandryan@centurytel.net:malachi1 71 | aaronsouthern@gmail.com:modem916 72 | 73 | -------------------------------------------------------------------------------- 74 | 75 | awk '{print $1}' emsandpws.txt | sed "s/=.*//g;s/\S*://g;s/HACKED.*//g; /^$/ d" 76 | 77 | -or better- 78 | 79 | sed "s/=.*//g;s/\S*://g;s/HACKED.*//g;s/ISOLATE.*//g;s/And.*//g;s/\s.*//g; /^$/ d" emails.txt 80 | --------------------------------------------------------------------------------- 81 | -------------------------------------------------------------------------------- /random_bash_trix.txt: -------------------------------------------------------------------------------- 1 | =============================================================================== 2 | Important go-to AWK and GREP commands for removing duplicates and blank lines: 3 | =============================================================================== 4 | # Add spaces between lines: 5 | sed 's/$/\n/' 6 | 7 | 8 | #Remove all blank lines 9 | egrep -v "^[[:space:]]*$" old.txt > new.txt 10 | 11 | # Remove duplicates 12 | awk '!(count[$0]++)' old.txt > new.txt 13 | 14 | 15 | =============================================================== 16 | RANDOM BASH COMMANDS 17 | =============================================================== 18 | 19 | The "nl" command is dedicated for adding line numbers to a file. 20 | cat -n file.txt 21 | 22 | nl file.txt > file2.txt 23 | 24 | align width 25 | $ nl -w2 file.txt 26 | 27 | cat -n file.txt 28 | 29 | # Sort by alphabetical order 30 | sort old.txt | uniq > new.txt 31 | 32 | ---------------------------------------------------------------- 33 | 34 | RANDOM AWK COMMANDS 35 | ---------------------------------------------------------------- 36 | 37 | awk '{print $2,$5}' ScanResults | grep -i up 38 | 39 | assign a starting line to begin displaying 40 | awk 'BEGIN{i=5} /.*/{printf "%d.% s\n",i,$0; i++}' file.txt 41 | 42 | # Remove duplicates 43 | awk '!(count[$0]++)' old.txt > new.txt 44 | 45 | # Sort by length 46 | awk '{print length, $0}' old.txt | sort -n | cut -d " " -f2- > new.txt 47 | 48 | #assign a starting line to begin displaying 49 | awk 'BEGIN{i=5} /.*/{printf "%d.% s\n",i,$0; i++}' file.txt 50 | 51 | 52 | # use awk to find things in a file: 53 | awk '/pttrnmatch /, /ptttrnmatch /' file.txt 54 | ------------------------------------------------------------------------ 55 | 56 | RANDOM GREP COMMANDS 57 | 58 | # grep -i keywrd file.txt 59 | 60 | #Remove all blank lines 61 | egrep -v "^[[:space:]]*$" old.txt > new.txt 62 | 63 | 64 | 65 | #Bash Script to edit a text file. 66 | 67 | awk '!(count[$0]++)' "text.txt" > ${text.txt}-new 68 | [ $? -eq 0 ] && { echo "Duplicates have been removed, view new file at ${f_path}-new"; exit 0; } 69 | ;; 70 | 71 | 72 | 2) read -p "Enter path to file: " f_path 73 | awk '{print length, $0}' "$f_path" | sort -n | cut -d " " -f2- > ${f_path}-new 74 | [ $? -eq 0 ] && { echo "File has been sorted by length at ${f_path}-new"; exit 0; } 75 | ;; 76 | 3) read -p "Enter path to file: " f_path 77 | sort "$f_path" | uniq > ${f_path}-new 78 | [ $? -eq 0 ] && { echo "File has been sorted by alphabetical order at ${f_path}-new"; exit 0; } 79 | ;; 80 | 4) read -p "Enter path to file: " f_path 81 | egrep -v "^[[:space:]]*$" "$f_path" > ${f_path}-new 82 | [ $? -eq 0 ] && { echo "File has been removed of all blank lines at ${f_path}-new"; exit 0; } 83 | ;; 84 | q) echo "Peace" 85 | ;; 86 | *) echo "I do not understand" 87 | ;; 88 | -------------------------------------------------------------------------------- /all_commands/RegexAndcmds.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | How To Add Line Numbers To Text Files On Linux 4 | 5 | The "nl" command is dedicated for adding line numbers to a file. 6 | cat -n file.txt 7 | 8 | nl file.txt > file2.txt 9 | 10 | or 11 | cat -n file.txt > newfile.txt 12 | 13 | 14 | align width 15 | $ nl -w2 file.txt 16 | 17 | 18 | REGEX 19 | REGULAR EXPRESSIONS - GREP 20 | 21 | . any one char 22 | * match any number of previous (also 0) 23 | + match any number of previous 24 | $ end of line 25 | ^ beginning of line 26 | \S any non-whitespace char 27 | \s any white-space char 28 | ? optional 29 | [a-z] any lower case letter 30 | [A-Z] any UPPER CASE letter 31 | \ escape something 32 | [A-Za-Z] any letter regardless of caps 33 | [0-9] any number 34 | 35 | GREP: 36 | 37 | grep -i keywrd file.txt 38 | 39 | grep -i "ab" names.txt 40 | 41 | grep "a" n2 42 | grep "a$" n2 43 | grep "^e" n2 44 | grep ".k" n2 45 | grep ".u*" n2 46 | igrep "zz" n2 47 | grep ".zz" n2 48 | grep ".*zz" n2 49 | grep ".*al" n2 50 | grep "\s*aa" n2 51 | grep "^\s*xy" n2 52 | 53 | 54 | #Remove all blank lines 55 | egrep -v "^[[:space:]]*$" old.txt > new.txt 56 | 57 | --------------------------------------------------------------- 58 | 59 | AWK 60 | 61 | select a particular field and print it: 62 | awk '{print $0}' file.txt 63 | 64 | PATTERN MATCH REGEX: 65 | awk '/@/ && /mail/' emails.txt 66 | 67 | awk '/@/ && /mail/ {print $4}' emails.txt 68 | 69 | 70 | # Assign a starting line to begin displaying text: 71 | awk 'BEGIN{i=5} /.*/{printf "%d.% s\n",i,$0; i++}' file.txt 72 | 73 | # Remove duplicates 74 | awk '!(count[$0]++)' old.txt > new.txt 75 | 76 | # Sort by length 77 | awk '{print length, $0}' old.txt | sort -n | cut -d " " -f2- > new.txt 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | ------------------------------------------------------------------------------------------------- 108 | AWK & SED examples 109 | 110 | 111 | 112 | In the directory: 113 | debian@debian:~/shell/emails_copy$ 114 | 115 | GOAL: 116 | ISOLATE THE PASSWORDS WITH JUST ONE COMMAND, USING ANY COMBO OF AWK & SED 117 | And REMOVE ALL OTHER CHARS. 118 | 119 | ========================================// ========== 120 | HACKED By: : ///L5C4S\\\ =// 21/02/2015 = 121 | ========================================// 02:24 ========== 122 | abarrene@umw.edu:antonio4 123 | abedur.rasul@yahoo.com:a1b1c1d1 124 | abellanger@gt.rr.com:mom7227691 125 | abby@emery.co.uk:maemae23 126 | abhayvc@hotmail.com:abhay190479 127 | abeandryan@centurytel.net:malachi1 128 | aaronsouthern@gmail.com:modem916 129 | 130 | 131 | 132 | awk '{print $1}' emsandpws.txt | sed "s/=.*//g;s/\S*://g;s/HACKED.*//g; /^$/ d" 133 | 134 | ---------------------------------------------------------------------------------------------------------- 135 | 136 | 137 | 138 | Clean up this email list using awk and sed 139 | 140 | rw-r--r-- 1 debian debian 3737 Dec 18 05:41 pwlist.txt 141 | debian@debian:~/shell/emails_copy$ cat 12heads.txt 142 | # # # # # # # # # # # # # # 143 | # Hacked by Sniper Cmd # 144 | # Hack Emails ^_^ # 145 | # # # # # # # # # # # # # # 146 | 147 | 148 | nghquy@bxytyz.com 149 | mkarmin@bezeqint.net 150 | shuzik83@yahoo.com 151 | wind.golan@gmail.com 152 | zamirz@012.net.il 153 | f5mztlk3kq@hotmail.com 154 | 155 | 156 | 157 | awk '{print $1}' 12heads.txt | sed "s/#.*//g;s/\S*://g; /^$/ d" 158 | 159 | 160 | 161 | 162 | -------------------------------------------------------------------------------- /.bashrc: -------------------------------------------------------------------------------- 1 | # ~/.bashrc: executed by bash(1) for non-login shells. 2 | 3 | # !!! THIS IS THE BASHRC FOR THE ROOT USER !!! 4 | 5 | # Note: PS1 and umask are already set in /etc/profile. You should not 6 | # need this unless you want different defaults for root. 7 | # PS1='${debian_chroot:+($debian_chroot)}\h:\w\$ ' 8 | # umask 022 9 | 10 | # You may uncomment the following lines if you want `ls' to be colorized: 11 | # export LS_OPTIONS='--color=auto' 12 | # eval "`dircolors`" 13 | # alias ls='ls $LS_OPTIONS' 14 | # alias ll='ls $LS_OPTIONS -l' 15 | # alias l='ls $LS_OPTIONS -lA' 16 | # 17 | # Some more alias to avoid making mistakes: 18 | # alias rm='rm -i' 19 | # alias cp='cp -i' 20 | # alias mv='mv -i' 21 | 22 | #--------------------------------------------------------------- 23 | 24 | # ~/.bashrc: executed by bash(1) for non-login shells. 25 | # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) 26 | # for examples 27 | 28 | neofetch 29 | 30 | # If not running interactively, don't do anything 31 | case $- in 32 | *i*) ;; 33 | *) return;; 34 | esac 35 | 36 | # don't put duplicate lines or lines starting with space in the history. 37 | # See bash(1) for more options 38 | HISTCONTROL=ignoreboth 39 | 40 | # append to the history file, don't overwrite it 41 | shopt -s histappend 42 | 43 | # for setting history length see HISTSIZE and HISTFILESIZE in bash(1) 44 | HISTSIZE=1000 45 | HISTFILESIZE=2000 46 | 47 | # check the window size after each command and, if necessary, 48 | # update the values of LINES and COLUMNS. 49 | shopt -s checkwinsize 50 | 51 | # If set, the pattern "**" used in a pathname expansion context will 52 | # match all files and zero or more directories and subdirectories. 53 | #shopt -s globstar 54 | 55 | # make less more friendly for non-text input files, see lesspipe(1) 56 | #[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" 57 | 58 | # set variable identifying the chroot you work in (used in the prompt below) 59 | if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then 60 | debian_chroot=$(cat /etc/debian_chroot) 61 | fi 62 | 63 | # set a fancy prompt (non-color, unless we know we "want" color) 64 | case "$TERM" in 65 | xterm-color|*-256color) color_prompt=yes;; 66 | esac 67 | 68 | # uncomment for a colored prompt, if the terminal has the capability; turned 69 | # off by default to not distract the user: the focus in a terminal window 70 | # should be on the output of commands, not on the prompt 71 | #force_color_prompt=yes 72 | 73 | if [ -n "$force_color_prompt" ]; then 74 | if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then 75 | # We have color support; assume it's compliant with Ecma-48 76 | # (ISO/IEC-6429). (Lack of such support is extremely rare, and such 77 | # a case would tend to support setf rather than setaf.) 78 | color_prompt=yes 79 | else 80 | color_prompt= 81 | fi 82 | fi 83 | 84 | if [ "$color_prompt" = yes ]; then 85 | PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' 86 | else 87 | PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' 88 | fi 89 | unset color_prompt force_color_prompt 90 | 91 | # If this is an xterm set the title to user@host:dir 92 | case "$TERM" in 93 | xterm*|rxvt*) 94 | PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" 95 | ;; 96 | *) 97 | ;; 98 | esac 99 | 100 | # enable color support of ls and also add handy aliases 101 | if [ -x /usr/bin/dircolors ]; then 102 | test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" 103 | alias ls='ls --color=auto' 104 | #alias dir='dir --color=auto' 105 | #alias vdir='vdir --color=auto' 106 | 107 | #alias grep='grep --color=auto' 108 | #alias fgrep='fgrep --color=auto' 109 | #alias egrep='egrep --color=auto' 110 | fi 111 | 112 | # colored GCC warnings and errors 113 | #export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' 114 | 115 | # some more ls aliases 116 | alias ll='ls -l' 117 | alias la='ls -A' 118 | alias l='ls -CF' 119 | alias v='vim' 120 | alias g='gedit' 121 | alias e='exit' 122 | # Alias definitions. 123 | # You may want to put all your additions into a separate file like 124 | # ~/.bash_aliases, instead of adding them here directly. 125 | # See /usr/share/doc/bash-doc/examples in the bash-doc package. 126 | 127 | if [ -f ~/.bash_aliases ]; then 128 | . ~/.bash_aliases 129 | fi 130 | 131 | # enable programmable completion features (you don't need to enable 132 | # this, if it's already enabled in /etc/bash.bashrc and /etc/profile 133 | # sources /etc/bash.bashrc). 134 | if ! shopt -oq posix; then 135 | if [ -f /usr/share/bash-completion/bash_completion ]; then 136 | . /usr/share/bash-completion/bash_completion 137 | elif [ -f /etc/bash_completion ]; then 138 | . /etc/bash_completion 139 | fi 140 | fi 141 | -------------------------------------------------------------------------------- /all_commands/cmds.txt: -------------------------------------------------------------------------------- 1 | 2 | ------------------------------------------------------------------- 3 | Linux Basic and frequently used commands 4 | -------------------------------------------------------------------- 5 | 6 | Basics & essentials 7 | Navigating the CMD Line 8 | 9 | pwd 10 | id 11 | whoami 12 | ls 13 | ls -l 14 | cd 15 | cd .. 16 | 17 | man (using the manual pages) 18 | 19 | ------------------------------------------------------------------------- 20 | 21 | USER RELATED & HISTORY 22 | env 23 | $PATH ( is an enviroment variable. It controlls the cmd search path and list vof dirs) 24 | history 25 | 26 | 27 | ---------------------------------------------------------------------- 28 | 29 | VIEWING FILES using TEXT EDITORS and more 30 | file 31 | cat 32 | head 33 | tail 34 | less 35 | 36 | vim 37 | gedit 38 | 39 | echo (print something to the screen) 40 | 41 | ----------------------------------------------------------- 42 | 43 | COPYING MOVING DELETING Files&Dirs 44 | cp -r (copy a file recursively) 45 | mv (to rename) 46 | mv fielname -t (new location) 47 | mkdir 48 | rm 49 | rm -rf 50 | 51 | ----------------------------------------------------------- 52 | 53 | PACKAGE MANAGEMENT 54 | apt update 55 | apt install 56 | 57 | apt update && apt upgrade 58 | 59 | dpkg 60 | sudo dpkg -i nameofdebfile.deb 61 | 62 | ------------------------------------------------------ 63 | 64 | SOFTWARE/ HARDWARE 65 | uname -a 66 | lshw 67 | df -ah 68 | df -h 69 | du -h 70 | ------------------------------------------------------------- 71 | 72 | NETWORK RELATED 73 | ifconfig (ipconfig) 74 | netstat -tulpn 75 | service smbd restart && dhclient 76 | netstat -ant 77 | watch ss -tp (ntwrk conns) 78 | netstat -tulpn conns with PIDs 79 | ------------------------------------------------------------- 80 | END OF LESSON ONE 81 | END OF LESSON ONE 82 | END OF LESSON ONE 83 | 84 | 85 | 86 | ------------------------------------------------------------ 87 | 88 | END OF LESSON ONE 89 | 90 | ------------------------------------------------------------- 91 | 92 | END OF LESSON ONE 93 | 94 | END OF LESSON ONE 95 | 96 | END OF LESSON ONE 97 | 98 | END OF LESSON ONE 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | ------------------------------------------------------------ 110 | 111 | BEGIN LESSON 2 112 | 113 | ----------------------------------------------------------- 114 | 115 | WORKING WITH TEXT - INPUT OUTPUT 116 | 117 | 118 | cat > test1.txt 119 | 120 | Redirect Contents of a Single File 121 | cat test1.txt > test2.txt 122 | 123 | Redirect Contents of Multiple Files 124 | cat test1.txt test2.txt test3.txt test4.txt > allfiles.txt (or > /allfiles.txt) 125 | 126 | append 127 | cat test1.txt >> test3.txt 128 | 129 | Append Text to Existing File 130 | cat >> test1.txt 131 | 132 | append multiple files to the end of an existing file: 133 | cat test2.txt test1.txt >> test4.txt 134 | 135 | 136 | concatentating 137 | cat file 138 | also 139 | cat file1.txt file2.txt allfiles.txt 140 | 141 | 142 | 143 | 144 | 145 | PROCESSES 146 | ps -ef 147 | top htop 148 | kill (pid) 149 | lsof -i 150 | sytemctl status 151 | 152 | 153 | USER MANAGEMENT 154 | useradd 155 | rmuser 156 | passwd 157 | 158 | ------------------------------------------ 159 | 160 | SINCE THE REST OF THIS COURSE ENTAILS HEAVY USE OF VIM 161 | I'M GOING TO DEDICATE THIS VIDEO AS A HOW TO 162 | & IF THE LINUX CMD LINE IS SOMETHING YOU PLAN ON USING, THEN 163 | VIM IS ESSENTIAL 164 | 165 | It makes u more effeciant bc u dont have to take your hands off the keyboard 166 | 167 | ------------------------------------------------ 168 | 169 | 170 | 171 | 172 | 173 | 174 | --------------------------------------------------------- 175 | 176 | WORKING WITH TEXT - ADVANCED 177 | REGULAR EXPRESSIONS 178 | 179 | do more advanced text manipulation: bashtrix 180 | 181 | align width 182 | $ nl -w2 file.txt 183 | 184 | https://github.com/LinuxUser255/Bash_Scripting/blob/master/bashtrix.txt 185 | 186 | 187 | 188 | grep 189 | awk 190 | sed 191 | 192 | ----------------------------------------------------------- 193 | 194 | 195 | 196 | END LESSON 2 197 | 198 | 199 | -------------------------------------------------------- 200 | 201 | 202 | STOP 203 | 204 | 205 | 206 | 207 | STOP 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | tar stuff 225 | create a tar 226 | tar cf file.tar files 227 | 228 | extract tarfiles 229 | tar xf file.tar 230 | tar xjf file.tar.bz2 231 | tar xvfz file.tar.gz 232 | 233 | 234 | compression: 235 | gzip file 236 | 237 | decompress: 238 | gunzip 239 | or 240 | gzip -d 241 | 242 | 243 | 244 | UN-TARING & UNZIPING FILES 245 | tar xf, cf, czf, xzf 246 | xdg-open (open a PDF) 247 | 248 | 249 | --------------------------------------------------------------------------------- 250 | BASICS of BASH SCRIPTING: 251 | *STRINGS 252 | *Variables 253 | *Conditionals: (if-then, else-if, nested ifs), 254 | *LOOPS: 255 | For Loops and While Loops, 256 | *Boolean Operators 257 | *Iput/Output, Functions 258 | *Parsing output $ more. 259 | -------------------------------------------------------------------------------- /regex/globs: -------------------------------------------------------------------------------- 1 | 2 | # Globbing cheatsheet 3 | 4 | WIP 5 | 6 | ## Basic globbing 7 | 8 | | **Character** | **Description** | 9 | | --- | --- | 10 | | `*` | Matches any character zero or more times, except for `/` | 11 | | `**` | Matches any character zero or more times, including `/` | 12 | | `?` | Matches any character except for `/` one time | 13 | | `[abc]` | Matches any characters inside the brackets. For example, `[abc]` would match the characters `a`, `b` or `c`, and nothing else. | 14 | 15 | Notes: 16 | 17 | - `*` typically does not match dotfiles (file names starting with a `.`) unless explicitly enabled by the user [via options](#common-options) 18 | - `?` also typically does not match the leading dot 19 | - More than two stars in a glob path segment are typically interpreted as _a single star_ (e.g. `/***/` is the same as `/*/`) 20 | 21 | ## Extended globbing 22 | 23 | ### brace expansion 24 | 25 | TODO 26 | 27 | ### extglob 28 | 29 | | **pattern** | **regex equivalent** | **description** | 30 | | --- | --- | --- | 31 | | `?(pattern-list)` | `(...|...)?` | Matches zero or one occurrence of the given patterns | 32 | | `*(pattern-list)` | `(...|...)*` | Matches zero or more occurrences of the given patterns | 33 | | `+(pattern-list)` | `(...|...)+` | Matches one or more occurrences of the given patterns | 34 | | `@(pattern-list)` | `(...|...)` * | Matches one of the given patterns | 35 | | `!(pattern-list)` | N/A | Matches anything except one of the given patterns | 36 | 37 | ### POSIX character classes 38 | 39 | TODO 40 | 41 | ## Globbing options 42 | 43 | Options that are commonly available on various globbing implementations. 44 | 45 | | **Option name** | **Description** | 46 | | --- | --- | 47 | | `extglob` | Enable extended globs. In addition to the traditional globs (using wildcards: `*`, `*`, `?` and `[...]`), extended globs add (almost) the expressive power of regular expressions, allowing the use of patterns like `foo/!(a|b)*` | 48 | | `dotglob` | Allows files beginning with `.` to be included in matches. This option is automatically enabled if the glob pattern begins with a dot. Aliases: `dot` (supported by: [minimatch][], [micromatch][]) | 49 | | `failglob` | report an error when no matches are found | 50 | | `globignore` allows you to specify patterns a glob should not match Aliases: `ignore` (supported by: [minimatch][], [micromatch][]) | 51 | | `globstar` | recursively match directory paths (enabled by default in [minimatch][] and [micromatch][], but not in [bash][]) | 52 | | `nocaseglob` | perform case-insensitive pathname expansion | 53 | | `nocasematch` | perform case-insensitive matching. Aliases: `nocase` (supported by: [minimatch][], [micromatch][]) | 54 | | `nullglob` | when enabled, the pattern itself will be returned when no matches are found. Aliases: `nonull` (supported by: [minimatch][], [micromatch][]) 55 | 56 | 57 | 58 | #ASTERIX(*) 59 | The asterisk * is interpreted by the shell as a sign to generate filenames, 60 | matching the asterisk to any combination of characters (even none). 61 | When no path is given, the shell will use filenames in the current directory. 62 | 63 | #QUESTION MARK (?) 64 | Similar to the asterisk, the question mark ?, is interpreted by the shell 65 | as a sign to generate filenames, matching the question mark with exactly one character. 66 | 67 | 68 | # SQUARE BRACKETS ( [] ) 69 | The square bracket [ is interpreted by the shell as a sign to generate 70 | ilenames, matching any of the characters between [ and the first subsequent ]. 71 | The order in this list between the brackets is not important. 72 | Each pair of brackets is replaced by exactly one character. 73 | You can also exclude characters from a list between square brackets with the exclamation mark !. 74 | And you are allowed to make combinations of these wild cards 75 | 76 | 77 | a-z and 0-9 ranges & A-Z for CAPS 78 | The bash shell will also understand ranges of characters between brackets. 79 | 80 | $LANG and square brackets 81 | But, don't forget the influence of the LANG variable. Some languages include lower case letters in an upper case range (and vice versa). 82 | 83 | ------------------------------------------------------------------------------------------------------------------------------------- 84 | 85 | 86 | #* 0 or more chars could be begin or end of the word 87 | 88 | #*a* anything wit a in it 89 | 90 | #[] is OR betweeen a range of characters 91 | 92 | #[ab]* 93 | 94 | #? must be 1 or more chars at the start 95 | 96 | #?*a one char infront. then followed by zero or more (a) 97 | # must be at least one char infront of the A 98 | 99 | #?l*a must be once character then possibly an l followed by any number of 100 | 101 | #! ls [!ad]* negate the a or b 102 | 103 | #ls *[[:upper:]]* search for just upper 104 | #ls *[[:digit:]]* search for just digits 105 | #ls *[[:punct:]]* search for chars with punctuation 106 | 107 | #====================================================================== 108 | 109 | 110 | # ls 111 | # ls * 112 | # ls *a*..............................anthing with an a in it 113 | # ls [ab]* ...........................range a through b 114 | # ls ?*a 115 | # ls ?l*a 116 | # ls [!ab]* 117 | # ls *[[:upper:]]* 118 | # ls *[[:digit:]]* 119 | # ls *[[:punct:]]* 120 | 121 | -------------------------------------------------------------------------------- /File_Globbing/globs: -------------------------------------------------------------------------------- 1 | 2 | # Globbing cheatsheet 3 | 4 | WIP 5 | 6 | ## Basic globbing 7 | 8 | | **Character** | **Description** | 9 | | --- | --- | 10 | | `*` | Matches any character zero or more times, except for `/` | 11 | | `**` | Matches any character zero or more times, including `/` | 12 | | `?` | Matches any character except for `/` one time | 13 | | `[abc]` | Matches any characters inside the brackets. For example, `[abc]` would match the characters `a`, `b` or `c`, and nothing else. | 14 | 15 | Notes: 16 | 17 | - `*` typically does not match dotfiles (file names starting with a `.`) unless explicitly enabled by the user [via options](#common-options) 18 | - `?` also typically does not match the leading dot 19 | - More than two stars in a glob path segment are typically interpreted as _a single star_ (e.g. `/***/` is the same as `/*/`) 20 | 21 | ## Extended globbing 22 | 23 | ### brace expansion 24 | 25 | TODO 26 | 27 | ### extglob 28 | 29 | | **pattern** | **regex equivalent** | **description** | 30 | | --- | --- | --- | 31 | | `?(pattern-list)` | `(...|...)?` | Matches zero or one occurrence of the given patterns | 32 | | `*(pattern-list)` | `(...|...)*` | Matches zero or more occurrences of the given patterns | 33 | | `+(pattern-list)` | `(...|...)+` | Matches one or more occurrences of the given patterns | 34 | | `@(pattern-list)` | `(...|...)` * | Matches one of the given patterns | 35 | | `!(pattern-list)` | N/A | Matches anything except one of the given patterns | 36 | 37 | ### POSIX character classes 38 | 39 | TODO 40 | 41 | ## Globbing options 42 | 43 | Options that are commonly available on various globbing implementations. 44 | 45 | | **Option name** | **Description** | 46 | | --- | --- | 47 | | `extglob` | Enable extended globs. In addition to the traditional globs (using wildcards: `*`, `*`, `?` and `[...]`), extended globs add (almost) the expressive power of regular expressions, allowing the use of patterns like `foo/!(a|b)*` | 48 | | `dotglob` | Allows files beginning with `.` to be included in matches. This option is automatically enabled if the glob pattern begins with a dot. Aliases: `dot` (supported by: [minimatch][], [micromatch][]) | 49 | | `failglob` | report an error when no matches are found | 50 | | `globignore` allows you to specify patterns a glob should not match Aliases: `ignore` (supported by: [minimatch][], [micromatch][]) | 51 | | `globstar` | recursively match directory paths (enabled by default in [minimatch][] and [micromatch][], but not in [bash][]) | 52 | | `nocaseglob` | perform case-insensitive pathname expansion | 53 | | `nocasematch` | perform case-insensitive matching. Aliases: `nocase` (supported by: [minimatch][], [micromatch][]) | 54 | | `nullglob` | when enabled, the pattern itself will be returned when no matches are found. Aliases: `nonull` (supported by: [minimatch][], [micromatch][]) 55 | 56 | 57 | 58 | #ASTERIX(*) 59 | The asterisk * is interpreted by the shell as a sign to generate filenames, 60 | matching the asterisk to any combination of characters (even none). 61 | When no path is given, the shell will use filenames in the current directory. 62 | 63 | #QUESTION MARK (?) 64 | Similar to the asterisk, the question mark ?, is interpreted by the shell 65 | as a sign to generate filenames, matching the question mark with exactly one character. 66 | 67 | 68 | # SQUARE BRACKETS ( [] ) 69 | The square bracket [ is interpreted by the shell as a sign to generate 70 | ilenames, matching any of the characters between [ and the first subsequent ]. 71 | The order in this list between the brackets is not important. 72 | Each pair of brackets is replaced by exactly one character. 73 | You can also exclude characters from a list between square brackets with the exclamation mark !. 74 | And you are allowed to make combinations of these wild cards 75 | 76 | 77 | a-z and 0-9 ranges & A-Z for CAPS 78 | The bash shell will also understand ranges of characters between brackets. 79 | 80 | $LANG and square brackets 81 | But, don't forget the influence of the LANG variable. Some languages include lower case letters in an upper case range (and vice versa). 82 | 83 | ------------------------------------------------------------------------------------------------------------------------------------- 84 | 85 | 86 | #* 0 or more chars could be begin or end of the word 87 | 88 | #*a* anything wit a in it 89 | 90 | #[] is OR betweeen a range of characters 91 | 92 | #[ab]* 93 | 94 | #? must be 1 or more chars at the start 95 | 96 | #?*a one char infront. then followed by zero or more (a) 97 | # must be at least one char infront of the A 98 | 99 | #?l*a must be once character then possibly an l followed by any number of 100 | 101 | #! ls [!ad]* negate the a or b 102 | 103 | #ls *[[:upper:]]* search for just upper 104 | #ls *[[:digit:]]* search for just digits 105 | #ls *[[:punct:]]* search for chars with punctuation 106 | 107 | #====================================================================== 108 | 109 | 110 | # ls 111 | # ls * 112 | # ls *a*..............................anthing with an a in it 113 | # ls [ab]* ...........................range a through b 114 | # ls ?*a 115 | # ls ?l*a 116 | # ls [!ab]* 117 | # ls *[[:upper:]]* 118 | # ls *[[:digit:]]* 119 | # ls *[[:punct:]]* 120 | 121 | -------------------------------------------------------------------------------- /regex/regawk.txt: -------------------------------------------------------------------------------- 1 | ====================================== 2 | REGULAR EXPRESSIONS with GREP & AWK 3 | ====================================== 4 | 5 | . any one char 6 | * match any number of previous (also 0) 7 | + match any number of previous 8 | $ end of line 9 | ^ beginning of line 10 | \S any non-whitespace char 11 | \s any white-space char 12 | ? optional 13 | [a-z] any lower case letter 14 | [A-Z] any UPPER CASE letter 15 | \ escape something 16 | [A-Za-Z] any letter regardless of caps 17 | [0-9] any number 18 | ----------------------------------------------------------- 19 | exe: 20 | 21 | grep "a" n2 22 | grep "a$" n2 23 | grep "^a" n2 24 | grep ".c" n2 25 | grep ".c*" n2 26 | igrep "oo" n2 27 | grep ".oo" n2 28 | grep ".*oo" n2 29 | grep ".*ol" n2 30 | grep "\s*oo" n2 31 | grep "^\s*ad" n2 32 | 33 | grep "http" urls.txt 34 | grep "\http\." u 35 | grep "http:\?" u 36 | grep "http\://\S*" u 37 | grep "http\://\S*\.[a-z]" u 38 | grep "http\://\S*\.[a-z]\+\S*" u 39 | 40 | ======================================= 41 | GREPPING EMAILS 42 | ======================================= 43 | 44 | grep "\S\+@\S\+\.[A-Za-z]\+" emails.txt 45 | grep "\S\+@\S\+\.[A-Za-z]\+" emails.txt 46 | 47 | 48 | ------------------------------------------------------------- 49 | 50 | # RANDOM AWKing of EMAILS 51 | ------------------------------------------------------------- 52 | [15:26:30] [INFO] retrieved: "2009-02-20","15","info@kerala.com","nrmjaoao" 53 | [15:26:32] [INFO] retrieved: "2009-02-27","16","3@3.com","zradxntn" 54 | [15:26:34] [INFO] retrieved: "2009-02-27","17","adasdasd@fsdfsd.com","cxyklzbf" 55 | [15:26:37] [INFO] retrieved: "2009-02-27","18","eqweqwe@213.com","vslfbpwh" 56 | [15:26:39] [INFO] retrieved: "2009-02-27","19","dasdasd@hjgjdf.com","zdlmcjlf" 57 | [15:26:41] [INFO] retrieved: "2009-03-06","20","dfgdfg@gfsmf.com","lyprtjwf" 58 | [15:26:43] [INFO] retrieved: "2009-03-06","21","qweqw","aleycazw" 59 | [15:26:46] [INFO] retrieved: "2009-03-06","22","qweqweq","rtrwxlxt" 60 | [15:26:49] [INFO] retrieved: "2009-03-06","23","qeqweqwe","svckcodp" 61 | [15:26:54] [INFO] retrieved: "2009-03-07","24","werw","euyxxjnw" 62 | ---------------------------------------------------------------------------- 63 | #Parse and clean the file above: 64 | (awk ' /@/ && /.com/ {print $4}' emails_unedit.txt | tr -d '2009' | tr -d '1-8' | tr -d '-' | tr -d ',,'\") 65 | 66 | ---------------------------------------------------------------------------------------------------------------------------- 67 | Random CMDS: 68 | head emails.txt 69 | 70 | sed 11q emails.txt 71 | 72 | awk '(NR>=0 && NR<=11){print} (NR==11){exit}' emails.txt 73 | 74 | grep -i 'www' emails.txt 75 | 76 | sed'[Qq]we /!q' e 77 | 78 | awk 'tolower($0) ~ /qweq/' e 79 | 80 | awk '$3 > 0 {print $1, $2 * $3 }' em2 81 | 82 | awk '$3 > 0' em2 83 | 84 | ----------------------------------- 85 | REG EXPRESSIONS USING AWK 86 | ---------------------------------------------------------------- 87 | !The REGEXP is specified within // and by default acts upon $0 88 | --------------------------------------------------------------- 89 | 90 | awk '/@/ && /mail/ {print $4}' emails.txt 91 | 92 | awk '/@/ && !/www/ {print $4}' emails.txt 93 | 94 | awk -i '/^[LK]/' em2 95 | 96 | awk '/^[Ll Kk]/' em2 97 | 98 | awk '/6/{print $NF}' em2 99 | 100 | ======================================================================= 101 | 102 | Parse & or edit this file in the command line: 103 | ----------------------------------------------- 104 | Rank 2011[6] 2012[7] 2013[8] 2014[9] 2015[10] 2016[5] 2017[11] 2018[12] 2019[13] 105 | 1 password password 123456 123456 123456 123456 123456 123456 123456 106 | 2 123456 123456 password password password password password password 123456789 107 | 3 12345678 12345678 12345678 12345 12345678 12345 12345678 123456789 qwerty 108 | 4 qwerty abc123 qwerty 12345678 qwerty 12345678 qwerty 12345678 password 109 | 5 abc123 qwerty abc123 qwerty 12345 football 12345 12345 1234567 110 | 6 monkey monkey 123456789 123456789 123456789 qwerty 123456789 111111 12345678 111 | 7 1234567 letmein 111111 1234 football 1234567890 letmein 1234567 12345 112 | 8 letmein dragon 1234567 baseball 1234 1234567 1234567 sunshine iloveyou 113 | 9 trustno1 111111 iloveyou dragon 1234567 princess football qwerty 111111 114 | -------------------------------------------------------------------------------- 115 | 116 | The following produce an orderly output: 117 | awk '{$1="";print}' common_pws.txt 118 | awk '{for(i=2;i<=NF;i++){printf "%s ", $i}; printf "\n"}' common_pws.txt 119 | awk '{for(i=2;i<=NF;i++){printf "%s ", $i}; printf "\n\n"}' common_pws.txt 120 | ---------------------------------------------------------------------------------- 121 | 122 | 123 | Notes: 124 | -------------------------------------------------------------------------------------- 125 | # will print all but very first column: 126 | # B/C 1st Colum equals a blank space 127 | awk '{$1="";print}' common_pws.txt 128 | 129 | #will print all but first two columns: 130 | awk '{$1= $2=""; print $0}' 131 | 132 | # Use a for loop and the printf statement: 133 | %s is one of various modifiers available to printf and similar formatting programs. 134 | #It represents a 'word' or a string between white spaces. 135 | awk '{for(i=2;i<=NF;i++){printf "%s ", $i}; printf "\n"}' common_pws.txt 136 | 137 | # The command above loops through, printing all fields starting from the second to the last (repped by $NF, (NEW FIELD)) 138 | #And to add extra space between all words, add an additional \n 139 | awk '{for(i=2;i<=NF;i++){printf "%s ", $i}; printf "\n\n"}' common_pws.txt 140 | 141 | -------------------------------------------------------------------------------- /extended.vim: -------------------------------------------------------------------------------- 1 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 2 | " Important: 3 | " This requries that you install https://github.com/amix/vimrc ! 4 | " 5 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 6 | 7 | 8 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 9 | " => GUI related 10 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 11 | " Set font according to system 12 | if has("mac") || has("macunix") 13 | set gfn=IBM\ Plex\ Mono:h14,Hack:h14,Source\ Code\ Pro:h15,Menlo:h15 14 | elseif has("win16") || has("win32") 15 | set gfn=IBM\ Plex\ Mono:h14,Source\ Code\ Pro:h12,Bitstream\ Vera\ Sans\ Mono:h11 16 | elseif has("gui_gtk2") 17 | set gfn=IBM\ Plex\ Mono\ 14,:Hack\ 14,Source\ Code\ Pro\ 12,Bitstream\ Vera\ Sans\ Mono\ 11 18 | elseif has("linux") 19 | set gfn=IBM\ Plex\ Mono\ 14,:Hack\ 14,Source\ Code\ Pro\ 12,Bitstream\ Vera\ Sans\ Mono\ 11 20 | elseif has("unix") 21 | set gfn=Monospace\ 11 22 | endif 23 | 24 | " Disable scrollbars (real hackers don't use scrollbars for navigation!) 25 | set guioptions-=r 26 | set guioptions-=R 27 | set guioptions-=l 28 | set guioptions-=L 29 | 30 | " Colorscheme 31 | set background=dark 32 | colorscheme peaksea 33 | 34 | 35 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 36 | " => Fast editing and reloading of vimrc configs 37 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 38 | map e :e! ~/.vim_runtime/my_configs.vim 39 | autocmd! bufwritepost ~/.vim_runtime/my_configs.vim source ~/.vim_runtime/my_configs.vim 40 | 41 | 42 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 43 | " => Turn persistent undo on 44 | " means that you can undo even when you close a buffer/VIM 45 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 46 | try 47 | set undodir=~/.vim_runtime/temp_dirs/undodir 48 | set undofile 49 | catch 50 | endtry 51 | 52 | 53 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 54 | " => Command mode related 55 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 56 | " Smart mappings on the command line 57 | cno $h e ~/ 58 | cno $d e ~/Desktop/ 59 | cno $j e ./ 60 | cno $c e eCurrentFileDir("e") 61 | 62 | " $q is super useful when browsing on the command line 63 | " it deletes everything until the last slash 64 | cno $q eDeleteTillSlash() 65 | 66 | " Bash like keys for the command line 67 | cnoremap 68 | cnoremap 69 | cnoremap 70 | 71 | cnoremap 72 | cnoremap 73 | 74 | " Map ½ to something useful 75 | map ½ $ 76 | cmap ½ $ 77 | imap ½ $ 78 | 79 | 80 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 81 | " => Parenthesis/bracket 82 | """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 83 | vnoremap $1 `>a)` 84 | vnoremap $2 `>a]` 85 | vnoremap $3 `>a}` 86 | vnoremap $$ `>a"` 87 | vnoremap $q `>a'` 88 | vnoremap $e `>a`` 89 | 90 | " Map auto complete of (, ", ', [ 91 | inoremap $1 ()i 92 | inoremap $2 []i 93 | inoremap $3 {}i 94 | inoremap $4 {o}O 95 | inoremap $q ''i 96 | inoremap $e ""i 97 | 98 | 99 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 100 | " => General abbreviations 101 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 102 | iab xdate =strftime("%d/%m/%y %H:%M:%S") 103 | 104 | 105 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 106 | " => Omni complete functions 107 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 108 | autocmd FileType css set omnifunc=csscomplete#CompleteCSS 109 | 110 | 111 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 112 | " => Ack searching and cope displaying 113 | " requires ack.vim - it's much better than vimgrep/grep 114 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 115 | " Use the the_silver_searcher if possible (much faster than Ack) 116 | if executable('ag') 117 | let g:ackprg = 'ag --vimgrep --smart-case' 118 | endif 119 | 120 | " When you press gv you Ack after the selected text 121 | vnoremap gv :call VisualSelection('gv', '') 122 | 123 | " Open Ack and put the cursor in the right position 124 | map g :Ack 125 | 126 | " When you press r you can search and replace the selected text 127 | vnoremap r :call VisualSelection('replace', '') 128 | 129 | " Do :help cope if you are unsure what cope is. It's super useful! 130 | " 131 | " When you search with Ack, display your results in cope by doing: 132 | " cc 133 | " 134 | " To go to the next search result do: 135 | " n 136 | " 137 | " To go to the previous search results do: 138 | " p 139 | " 140 | map cc :botright cope 141 | map co ggVGy:tabnew:set syntax=qfpgg 142 | map n :cn 143 | map p :cp 144 | 145 | " Make sure that enter is never overriden in the quickfix window 146 | autocmd BufReadPost quickfix nnoremap 147 | 148 | 149 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 150 | " => Helper functions 151 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 152 | func! DeleteTillSlash() 153 | let g:cmd = getcmdline() 154 | 155 | if has("win16") || has("win32") 156 | let g:cmd_edited = substitute(g:cmd, "\\(.*\[\\\\]\\).*", "\\1", "") 157 | else 158 | let g:cmd_edited = substitute(g:cmd, "\\(.*\[/\]\\).*", "\\1", "") 159 | endif 160 | 161 | if g:cmd == g:cmd_edited 162 | if has("win16") || has("win32") 163 | let g:cmd_edited = substitute(g:cmd, "\\(.*\[\\\\\]\\).*\[\\\\\]", "\\1", "") 164 | else 165 | let g:cmd_edited = substitute(g:cmd, "\\(.*\[/\]\\).*/", "\\1", "") 166 | endif 167 | endif 168 | 169 | return g:cmd_edited 170 | endfunc 171 | 172 | func! CurrentFileDir(cmd) 173 | return a:cmd . " " . expand("%:p:h") . "/" 174 | endfunc 175 | -------------------------------------------------------------------------------- /vimrc_basic: -------------------------------------------------------------------------------- 1 | " URL: http://vim.wikia.com/wiki/Example_vimrc 2 | " Authors: http://vim.wikia.com/wiki/Vim_on_Freenode 3 | " Description: A minimal, but feature rich, example .vimrc. If you are a 4 | " newbie, basing your first .vimrc on this file is a good choice. 5 | " If you're a more advanced user, building your own .vimrc based 6 | " on this file is still a good idea. 7 | 8 | "------------------------------------------------------------ 9 | " Features {{{1 10 | " 11 | " These options and commands enable some very useful features in Vim, that 12 | " no user should have to live without. 13 | 14 | " Set 'nocompatible' to ward off unexpected things that your distro might 15 | " have made, as well as sanely reset options when re-sourcing .vimrc 16 | set nocompatible 17 | 18 | " Attempt to determine the type of a file based on its name and possibly its 19 | " contents. Use this to allow intelligent auto-indenting for each filetype, 20 | " and for plugins that are filetype specific. 21 | if has('filetype') 22 | filetype indent plugin on 23 | endif 24 | 25 | " Enable syntax highlighting 26 | if has('syntax') 27 | syntax on 28 | endif 29 | 30 | "------------------------------------------------------------ 31 | " Must have options {{{1 32 | " 33 | " These are highly recommended options. 34 | 35 | " Vim with default settings does not allow easy switching between multiple files 36 | " in the same editor window. Users can use multiple split windows or multiple 37 | " tab pages to edit multiple files, but it is still best to enable an option to 38 | " allow easier switching between files. 39 | " 40 | " One such option is the 'hidden' option, which allows you to re-use the same 41 | " window and switch from an unsaved buffer without saving it first. Also allows 42 | " you to keep an undo history for multiple files when re-using the same window 43 | " in this way. Note that using persistent undo also lets you undo in multiple 44 | " files even in the same window, but is less efficient and is actually designed 45 | " for keeping undo history after closing Vim entirely. Vim will complain if you 46 | " try to quit without saving, and swap files will keep you safe if your computer 47 | " crashes. 48 | set hidden 49 | 50 | " Note that not everyone likes working this way (with the hidden option). 51 | " Alternatives include using tabs or split windows instead of re-using the same 52 | " window as mentioned above, and/or either of the following options: 53 | " set confirm 54 | " set autowriteall 55 | 56 | " Better command-line completion 57 | set wildmenu 58 | 59 | " Show partial commands in the last line of the screen 60 | set showcmd 61 | 62 | " Highlight searches (use to temporarily turn off highlighting; see the 63 | " mapping of below) 64 | set hlsearch 65 | 66 | " Modelines have historically been a source of security vulnerabilities. As 67 | " such, it may be a good idea to disable them and use the securemodelines 68 | " script, . 69 | " set nomodeline 70 | 71 | 72 | "------------------------------------------------------------ 73 | " Usability options {{{1 74 | " 75 | " These are options that users frequently set in their .vimrc. Some of them 76 | " change Vim's behaviour in ways which deviate from the true Vi way, but 77 | " which are considered to add usability. Which, if any, of these options to 78 | " use is very much a personal preference, but they are harmless. 79 | 80 | " Use case insensitive search, except when using capital letters 81 | set ignorecase 82 | set smartcase 83 | 84 | " Allow backspacing over autoindent, line breaks and start of insert action 85 | set backspace=indent,eol,start 86 | 87 | " When opening a new line and no filetype-specific indenting is enabled, keep 88 | " the same indent as the line you're currently on. Useful for READMEs, etc. 89 | set autoindent 90 | 91 | " Stop certain movements from always going to the first character of a line. 92 | " While this behaviour deviates from that of Vi, it does what most users 93 | " coming from other editors would expect. 94 | set nostartofline 95 | 96 | " Display the cursor position on the last line of the screen or in the status 97 | " line of a window 98 | set ruler 99 | 100 | " Always display the status line, even if only one window is displayed 101 | set laststatus=2 102 | 103 | " Instead of failing a command because of unsaved changes, instead raise a 104 | " dialogue asking if you wish to save changed files. 105 | set confirm 106 | 107 | " Use visual bell instead of beeping when doing something wrong 108 | set visualbell 109 | 110 | " And reset the terminal code for the visual bell. If visualbell is set, and 111 | " this line is also included, vim will neither flash nor beep. If visualbell 112 | " is unset, this does nothing. 113 | set t_vb= 114 | 115 | " Enable use of the mouse for all modes 116 | if has('mouse') 117 | set mouse=a 118 | endif 119 | 120 | " Set the command window height to 2 lines, to avoid many cases of having to 121 | " "press to continue" 122 | set cmdheight=2 123 | 124 | " Display line numbers on the left 125 | set number 126 | 127 | " Quickly time out on keycodes, but never time out on mappings 128 | set notimeout ttimeout ttimeoutlen=200 129 | 130 | " Use to toggle between 'paste' and 'nopaste' 131 | set pastetoggle= 132 | 133 | 134 | "------------------------------------------------------------ 135 | " Indentation options {{{1 136 | " 137 | " Indentation settings according to personal preference. 138 | 139 | " Indentation settings for using 4 spaces instead of tabs. 140 | " Do not change 'tabstop' from its default value of 8 with this setup. 141 | set shiftwidth=4 142 | set softtabstop=4 143 | set expandtab 144 | 145 | " Indentation settings for using hard tabs for indent. Display tabs as 146 | " four characters wide. 147 | "set shiftwidth=4 148 | "set tabstop=4 149 | 150 | 151 | "------------------------------------------------------------ 152 | " Mappings {{{1 153 | " 154 | " Useful mappings 155 | 156 | " Map Y to act like D and C, i.e. to yank until EOL, rather than act as yy, 157 | " which is the default 158 | map Y y$ 159 | 160 | " Map (redraw screen) to also turn off search highlighting until the 161 | " next search 162 | nnoremap :nohl 163 | 164 | "------------------------------------------------------------ 165 | -------------------------------------------------------------------------------- /networking/ScanResults: -------------------------------------------------------------------------------- 1 | # Nmap 7.70 scan initiated Thu Feb 25 19:37:30 2021 as: nmap -sn -f -vv -n -oG ScanResults 192.168.50.1-254 2 | # Ports scanned: TCP(0;) UDP(0;) SCTP(0;) PROTOCOLS(0;) 3 | Host: 192.168.50.1 () Status: Up 4 | Host: 192.168.50.2 () Status: Down 5 | Host: 192.168.50.3 () Status: Down 6 | Host: 192.168.50.4 () Status: Down 7 | Host: 192.168.50.5 () Status: Down 8 | Host: 192.168.50.6 () Status: Down 9 | Host: 192.168.50.7 () Status: Down 10 | Host: 192.168.50.8 () Status: Down 11 | Host: 192.168.50.9 () Status: Down 12 | Host: 192.168.50.10 () Status: Down 13 | Host: 192.168.50.11 () Status: Down 14 | Host: 192.168.50.12 () Status: Down 15 | Host: 192.168.50.13 () Status: Down 16 | Host: 192.168.50.14 () Status: Down 17 | Host: 192.168.50.15 () Status: Down 18 | Host: 192.168.50.16 () Status: Down 19 | Host: 192.168.50.17 () Status: Down 20 | Host: 192.168.50.18 () Status: Down 21 | Host: 192.168.50.19 () Status: Down 22 | Host: 192.168.50.20 () Status: Down 23 | Host: 192.168.50.21 () Status: Down 24 | Host: 192.168.50.22 () Status: Down 25 | Host: 192.168.50.23 () Status: Down 26 | Host: 192.168.50.24 () Status: Down 27 | Host: 192.168.50.25 () Status: Down 28 | Host: 192.168.50.26 () Status: Down 29 | Host: 192.168.50.27 () Status: Down 30 | Host: 192.168.50.28 () Status: Down 31 | Host: 192.168.50.29 () Status: Down 32 | Host: 192.168.50.30 () Status: Down 33 | Host: 192.168.50.31 () Status: Down 34 | Host: 192.168.50.32 () Status: Down 35 | Host: 192.168.50.33 () Status: Down 36 | Host: 192.168.50.34 () Status: Down 37 | Host: 192.168.50.35 () Status: Down 38 | Host: 192.168.50.36 () Status: Down 39 | Host: 192.168.50.37 () Status: Down 40 | Host: 192.168.50.38 () Status: Down 41 | Host: 192.168.50.39 () Status: Down 42 | Host: 192.168.50.40 () Status: Down 43 | Host: 192.168.50.41 () Status: Down 44 | Host: 192.168.50.42 () Status: Down 45 | Host: 192.168.50.43 () Status: Down 46 | Host: 192.168.50.44 () Status: Down 47 | Host: 192.168.50.45 () Status: Down 48 | Host: 192.168.50.46 () Status: Down 49 | Host: 192.168.50.47 () Status: Down 50 | Host: 192.168.50.48 () Status: Down 51 | Host: 192.168.50.49 () Status: Down 52 | Host: 192.168.50.50 () Status: Down 53 | Host: 192.168.50.51 () Status: Down 54 | Host: 192.168.50.52 () Status: Down 55 | Host: 192.168.50.53 () Status: Down 56 | Host: 192.168.50.54 () Status: Down 57 | Host: 192.168.50.55 () Status: Down 58 | Host: 192.168.50.56 () Status: Down 59 | Host: 192.168.50.57 () Status: Down 60 | Host: 192.168.50.58 () Status: Down 61 | Host: 192.168.50.59 () Status: Down 62 | Host: 192.168.50.60 () Status: Down 63 | Host: 192.168.50.61 () Status: Down 64 | Host: 192.168.50.62 () Status: Down 65 | Host: 192.168.50.63 () Status: Down 66 | Host: 192.168.50.64 () Status: Down 67 | Host: 192.168.50.65 () Status: Down 68 | Host: 192.168.50.66 () Status: Down 69 | Host: 192.168.50.67 () Status: Down 70 | Host: 192.168.50.68 () Status: Down 71 | Host: 192.168.50.69 () Status: Down 72 | Host: 192.168.50.70 () Status: Down 73 | Host: 192.168.50.71 () Status: Up 74 | Host: 192.168.50.72 () Status: Down 75 | Host: 192.168.50.73 () Status: Down 76 | Host: 192.168.50.74 () Status: Down 77 | Host: 192.168.50.75 () Status: Down 78 | Host: 192.168.50.76 () Status: Down 79 | Host: 192.168.50.77 () Status: Down 80 | Host: 192.168.50.78 () Status: Down 81 | Host: 192.168.50.79 () Status: Down 82 | Host: 192.168.50.80 () Status: Down 83 | Host: 192.168.50.81 () Status: Down 84 | Host: 192.168.50.82 () Status: Down 85 | Host: 192.168.50.83 () Status: Down 86 | Host: 192.168.50.84 () Status: Down 87 | Host: 192.168.50.85 () Status: Down 88 | Host: 192.168.50.86 () Status: Down 89 | Host: 192.168.50.87 () Status: Down 90 | Host: 192.168.50.88 () Status: Down 91 | Host: 192.168.50.89 () Status: Down 92 | Host: 192.168.50.90 () Status: Down 93 | Host: 192.168.50.91 () Status: Down 94 | Host: 192.168.50.92 () Status: Down 95 | Host: 192.168.50.93 () Status: Down 96 | Host: 192.168.50.94 () Status: Down 97 | Host: 192.168.50.95 () Status: Down 98 | Host: 192.168.50.97 () Status: Down 99 | Host: 192.168.50.98 () Status: Down 100 | Host: 192.168.50.99 () Status: Down 101 | Host: 192.168.50.100 () Status: Down 102 | Host: 192.168.50.101 () Status: Down 103 | Host: 192.168.50.102 () Status: Down 104 | Host: 192.168.50.103 () Status: Down 105 | Host: 192.168.50.104 () Status: Down 106 | Host: 192.168.50.105 () Status: Down 107 | Host: 192.168.50.106 () Status: Down 108 | Host: 192.168.50.107 () Status: Down 109 | Host: 192.168.50.108 () Status: Down 110 | Host: 192.168.50.109 () Status: Down 111 | Host: 192.168.50.110 () Status: Down 112 | Host: 192.168.50.111 () Status: Down 113 | Host: 192.168.50.112 () Status: Down 114 | Host: 192.168.50.113 () Status: Down 115 | Host: 192.168.50.114 () Status: Down 116 | Host: 192.168.50.115 () Status: Down 117 | Host: 192.168.50.116 () Status: Down 118 | Host: 192.168.50.117 () Status: Down 119 | Host: 192.168.50.118 () Status: Down 120 | Host: 192.168.50.119 () Status: Down 121 | Host: 192.168.50.120 () Status: Down 122 | Host: 192.168.50.121 () Status: Down 123 | Host: 192.168.50.122 () Status: Down 124 | Host: 192.168.50.123 () Status: Down 125 | Host: 192.168.50.124 () Status: Down 126 | Host: 192.168.50.125 () Status: Down 127 | Host: 192.168.50.126 () Status: Down 128 | Host: 192.168.50.127 () Status: Down 129 | Host: 192.168.50.128 () Status: Down 130 | Host: 192.168.50.129 () Status: Down 131 | Host: 192.168.50.130 () Status: Down 132 | Host: 192.168.50.131 () Status: Down 133 | Host: 192.168.50.132 () Status: Down 134 | Host: 192.168.50.133 () Status: Down 135 | Host: 192.168.50.134 () Status: Down 136 | Host: 192.168.50.135 () Status: Down 137 | Host: 192.168.50.136 () Status: Down 138 | Host: 192.168.50.137 () Status: Down 139 | Host: 192.168.50.138 () Status: Down 140 | Host: 192.168.50.139 () Status: Down 141 | Host: 192.168.50.140 () Status: Down 142 | Host: 192.168.50.141 () Status: Down 143 | Host: 192.168.50.142 () Status: Down 144 | Host: 192.168.50.143 () Status: Down 145 | Host: 192.168.50.144 () Status: Down 146 | Host: 192.168.50.145 () Status: Down 147 | Host: 192.168.50.146 () Status: Down 148 | Host: 192.168.50.147 () Status: Down 149 | Host: 192.168.50.148 () Status: Down 150 | Host: 192.168.50.149 () Status: Down 151 | Host: 192.168.50.150 () Status: Down 152 | Host: 192.168.50.151 () Status: Down 153 | Host: 192.168.50.152 () Status: Down 154 | Host: 192.168.50.153 () Status: Down 155 | Host: 192.168.50.154 () Status: Down 156 | Host: 192.168.50.155 () Status: Down 157 | Host: 192.168.50.156 () Status: Down 158 | Host: 192.168.50.157 () Status: Down 159 | Host: 192.168.50.158 () Status: Down 160 | Host: 192.168.50.159 () Status: Down 161 | Host: 192.168.50.160 () Status: Down 162 | Host: 192.168.50.161 () Status: Down 163 | Host: 192.168.50.162 () Status: Down 164 | Host: 192.168.50.163 () Status: Down 165 | Host: 192.168.50.164 () Status: Down 166 | Host: 192.168.50.165 () Status: Down 167 | Host: 192.168.50.166 () Status: Down 168 | Host: 192.168.50.167 () Status: Down 169 | Host: 192.168.50.168 () Status: Down 170 | Host: 192.168.50.169 () Status: Down 171 | Host: 192.168.50.170 () Status: Down 172 | Host: 192.168.50.171 () Status: Down 173 | Host: 192.168.50.172 () Status: Down 174 | Host: 192.168.50.173 () Status: Down 175 | Host: 192.168.50.174 () Status: Down 176 | Host: 192.168.50.175 () Status: Down 177 | Host: 192.168.50.176 () Status: Down 178 | Host: 192.168.50.177 () Status: Down 179 | Host: 192.168.50.178 () Status: Down 180 | Host: 192.168.50.179 () Status: Down 181 | Host: 192.168.50.180 () Status: Down 182 | Host: 192.168.50.181 () Status: Down 183 | Host: 192.168.50.182 () Status: Down 184 | Host: 192.168.50.183 () Status: Down 185 | Host: 192.168.50.184 () Status: Down 186 | Host: 192.168.50.185 () Status: Down 187 | Host: 192.168.50.186 () Status: Down 188 | Host: 192.168.50.187 () Status: Down 189 | Host: 192.168.50.188 () Status: Down 190 | Host: 192.168.50.189 () Status: Down 191 | Host: 192.168.50.190 () Status: Down 192 | Host: 192.168.50.191 () Status: Down 193 | Host: 192.168.50.192 () Status: Down 194 | Host: 192.168.50.193 () Status: Down 195 | Host: 192.168.50.194 () Status: Down 196 | Host: 192.168.50.195 () Status: Down 197 | Host: 192.168.50.196 () Status: Down 198 | Host: 192.168.50.197 () Status: Down 199 | Host: 192.168.50.198 () Status: Down 200 | Host: 192.168.50.199 () Status: Down 201 | Host: 192.168.50.200 () Status: Down 202 | Host: 192.168.50.201 () Status: Down 203 | Host: 192.168.50.202 () Status: Down 204 | Host: 192.168.50.203 () Status: Down 205 | Host: 192.168.50.204 () Status: Down 206 | Host: 192.168.50.205 () Status: Down 207 | Host: 192.168.50.206 () Status: Down 208 | Host: 192.168.50.207 () Status: Down 209 | Host: 192.168.50.208 () Status: Down 210 | Host: 192.168.50.209 () Status: Down 211 | Host: 192.168.50.210 () Status: Down 212 | Host: 192.168.50.211 () Status: Down 213 | Host: 192.168.50.212 () Status: Down 214 | Host: 192.168.50.213 () Status: Down 215 | Host: 192.168.50.214 () Status: Down 216 | Host: 192.168.50.215 () Status: Down 217 | Host: 192.168.50.216 () Status: Down 218 | Host: 192.168.50.217 () Status: Down 219 | Host: 192.168.50.218 () Status: Down 220 | Host: 192.168.50.219 () Status: Down 221 | Host: 192.168.50.220 () Status: Down 222 | Host: 192.168.50.221 () Status: Down 223 | Host: 192.168.50.222 () Status: Down 224 | Host: 192.168.50.223 () Status: Down 225 | Host: 192.168.50.224 () Status: Down 226 | Host: 192.168.50.225 () Status: Down 227 | Host: 192.168.50.226 () Status: Down 228 | Host: 192.168.50.227 () Status: Up 229 | Host: 192.168.50.228 () Status: Down 230 | Host: 192.168.50.229 () Status: Down 231 | Host: 192.168.50.230 () Status: Down 232 | Host: 192.168.50.231 () Status: Down 233 | Host: 192.168.50.232 () Status: Down 234 | Host: 192.168.50.233 () Status: Down 235 | Host: 192.168.50.234 () Status: Down 236 | Host: 192.168.50.235 () Status: Down 237 | Host: 192.168.50.236 () Status: Down 238 | Host: 192.168.50.237 () Status: Down 239 | Host: 192.168.50.238 () Status: Down 240 | Host: 192.168.50.239 () Status: Down 241 | Host: 192.168.50.240 () Status: Down 242 | Host: 192.168.50.241 () Status: Down 243 | Host: 192.168.50.242 () Status: Down 244 | Host: 192.168.50.243 () Status: Down 245 | Host: 192.168.50.244 () Status: Down 246 | Host: 192.168.50.245 () Status: Up 247 | Host: 192.168.50.246 () Status: Down 248 | Host: 192.168.50.247 () Status: Down 249 | Host: 192.168.50.248 () Status: Down 250 | Host: 192.168.50.249 () Status: Down 251 | Host: 192.168.50.250 () Status: Down 252 | Host: 192.168.50.251 () Status: Down 253 | Host: 192.168.50.252 () Status: Down 254 | Host: 192.168.50.253 () Status: Down 255 | Host: 192.168.50.254 () Status: Down 256 | Host: 192.168.50.96 () Status: Up 257 | # Nmap done at Thu Feb 25 19:37:37 2021 -- 254 IP addresses (5 hosts up) scanned in 6.37 seconds 258 | --------------------------------------------------------------------------------