├── 0x00-shell_basics ├── 0-current_working_directory ├── 1-listit ├── 10-back ├── 100-lets_move ├── 101-clean_emacs ├── 102-tree ├── 103-commas ├── 11-lists ├── 12-file_type ├── 13-symbolic_link ├── 14-copy_html ├── 2-bring_me_home ├── 3-listfiles ├── 4-listmorefiles ├── 5-listfilesdigitonly ├── 6-firstdirectory ├── 7-movethatfile ├── 8-firstdelete ├── 9-firstdirdeletion ├── README.md └── school.mgc ├── 0x01-shell_permissions ├── 0-iam_betty ├── 1-who_am_i ├── 10-mirror_permissions ├── 100-change_owner_and_group ├── 101-symbolic_link_permissions ├── 102-if_only ├── 103-Star_Wars ├── 11-directories_permissions ├── 12-directory_permissions ├── 13-change_group ├── 2-groups ├── 3-new_owner ├── 4-empty ├── 5-execute ├── 6-multiple_permissions ├── 7-everybody ├── 8-James_Bond ├── 9-John_Doe └── README.md ├── 0x02-shell_redirections ├── 0-hello_world ├── 1-confused_smiley ├── 10-no_more_js ├── 100-empty_casks ├── 101-gifs ├── 102-acrostic ├── 103-the_biggest_fan ├── 11-directories ├── 12-newest_files ├── 13-unique ├── 14-findthatword ├── 15-countthatword ├── 16-whatsnext ├── 17-hidethisword ├── 18-letteronly ├── 19-AZ ├── 2-hellofile ├── 20-hiago ├── 21-reverse ├── 22-users_and_homes ├── 3-twofiles ├── 4-lastlines ├── 5-firstlines ├── 6-third_line ├── 7-file ├── 8-cwd_state ├── 9-duplicate_last_line └── README.md ├── 0x03-shell_variables_expansions ├── 1 ├── 0-alias ├── 1-hello_you ├── 10-love_exponent_breath ├── 100-decimal_to_hexadecimal ├── 101-rot13 ├── 102-odd ├── 103-water_and_stir ├── 11-binary_to_decimal ├── 12-combinations ├── 13-print_float ├── 2-path ├── 3-paths ├── 4-global_variables ├── 5-local_variables ├── 6-create_local_variable ├── 7-create_global_variable ├── 8-true_knowledge ├── 9-divide_and_rule └── README.md ├── 0x04-loops_conditions_and_parsing ├── 0-RSA_public_key.pub ├── 1-for_best_school ├── 10-fizzbuzz ├── 100-read_and_cut ├── 101-tell_the_story_of_passwd ├── 102-lets_parse_apache_logs ├── 103-dig_the-data ├── 2-while_best_school ├── 3-until_best_school ├── 4-if_9_say_hi ├── 5-4_bad_luck_8_is_your_chance ├── 6-superstitious_numbers ├── 7-clock ├── 8-for_ls ├── 9-to_file_or_not_to_file └── README.md ├── 0x05-processes_and_signals ├── 0-what-is-my-pid ├── 1-list_your_processes ├── 100-process_and_pid_file ├── 101-manage_my_process ├── 101-manage_my_process, ├── 102-zombie.c ├── 2-show_your_bash_pid ├── 3-show_your_bash_pid_made_easy ├── 4-to_infinity_and_beyond ├── 5-dont_stop_me_now ├── 6-stop_me_if_you_can ├── 7-highlander ├── 8-beheaded_process ├── README.md └── manage_my_process ├── 0x06-regular_expressions ├── 0-simply_match_school.rb ├── 1-repetition_token_0.rb ├── 100-textme.rb ├── 2-repetition_token_1.rb ├── 3-repetition_token_2.rb ├── 4-repetition_token_3.rb ├── 5-beginning_and_end.rb ├── 6-phone_number.rb ├── 7-OMG_WHY_ARE_YOU_SHOUTING.rb └── README.md ├── 0x07-networking_basics ├── 0-OSI_model ├── 1-types_of_network ├── 2-MAC_and_IP_address ├── 3-UDP_and_TCP ├── 4-TCP_and_UDP_ports ├── 5-is_the_host_on_the_network └── README.md ├── 0x08-networking_basics_2 ├── 0-change_your_home_IP ├── 1-show_attached_IPs ├── 100-port_listening_on_localhost └── README.md ├── 0x09-web_infrastructure_design └── README.md ├── README.md └── command_line_for_the_win ├── 0-first_9_tasks.jpg,0-first_9_tasks.png ├── 1-next_9_tasks.jpg,1-next_9_tasks.png ├── 2-next_9_tasks.jpg,2-next_9_tasks.png └── README.md /0x00-shell_basics/0-current_working_directory: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | pwd 3 | -------------------------------------------------------------------------------- /0x00-shell_basics/1-listit: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ls 3 | -------------------------------------------------------------------------------- /0x00-shell_basics/10-back: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cd - 3 | -------------------------------------------------------------------------------- /0x00-shell_basics/100-lets_move: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | mv [[:upper:]]* /tmp/u 3 | -------------------------------------------------------------------------------- /0x00-shell_basics/101-clean_emacs: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | rm *~ 3 | -------------------------------------------------------------------------------- /0x00-shell_basics/102-tree: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | mkdir -p welcome/to/school 3 | -------------------------------------------------------------------------------- /0x00-shell_basics/103-commas: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ls -xamp 3 | -------------------------------------------------------------------------------- /0x00-shell_basics/11-lists: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ls -la . .. /boot 3 | -------------------------------------------------------------------------------- /0x00-shell_basics/12-file_type: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | file /tmp/iamafile 3 | -------------------------------------------------------------------------------- /0x00-shell_basics/13-symbolic_link: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ln -s /bin/ls __ls__ 3 | -------------------------------------------------------------------------------- /0x00-shell_basics/14-copy_html: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cp -nu *.html .. 3 | -------------------------------------------------------------------------------- /0x00-shell_basics/2-bring_me_home: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cd ~ 3 | -------------------------------------------------------------------------------- /0x00-shell_basics/3-listfiles: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ls -l 3 | -------------------------------------------------------------------------------- /0x00-shell_basics/4-listmorefiles: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ls -l -a 3 | -------------------------------------------------------------------------------- /0x00-shell_basics/5-listfilesdigitonly: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ls -al 3 | -------------------------------------------------------------------------------- /0x00-shell_basics/6-firstdirectory: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | mkdir /tmp/my_first_directory 3 | -------------------------------------------------------------------------------- /0x00-shell_basics/7-movethatfile: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | mv /tmp/betty /tmp/my_first_directory 3 | -------------------------------------------------------------------------------- /0x00-shell_basics/8-firstdelete: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | rm /tmp/my_first_directory/betty 3 | -------------------------------------------------------------------------------- /0x00-shell_basics/9-firstdirdeletion: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | rmdir /tmp/my_first_directory 3 | -------------------------------------------------------------------------------- /0x00-shell_basics/README.md: -------------------------------------------------------------------------------- 1 | this is shell basics -------------------------------------------------------------------------------- /0x00-shell_basics/school.mgc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makitey/alx-system_engineering-devops/440d81fa7967878d02dde2029b03cc54f54e41ee/0x00-shell_basics/school.mgc -------------------------------------------------------------------------------- /0x01-shell_permissions/0-iam_betty: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | su betty 3 | -------------------------------------------------------------------------------- /0x01-shell_permissions/1-who_am_i: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | whoami 3 | -------------------------------------------------------------------------------- /0x01-shell_permissions/10-mirror_permissions: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | chmod --reference=olleh hello 3 | -------------------------------------------------------------------------------- /0x01-shell_permissions/100-change_owner_and_group: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | chown vincent:staff * 3 | -------------------------------------------------------------------------------- /0x01-shell_permissions/101-symbolic_link_permissions: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | chown -h vincent:staff _hello 3 | -------------------------------------------------------------------------------- /0x01-shell_permissions/102-if_only: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | chown --from=guillaume betty hello 3 | -------------------------------------------------------------------------------- /0x01-shell_permissions/103-Star_Wars: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | telnet towel.blinkenlights.nl 3 | -------------------------------------------------------------------------------- /0x01-shell_permissions/11-directories_permissions: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | chmod -R +111 */ 3 | -------------------------------------------------------------------------------- /0x01-shell_permissions/12-directory_permissions: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | mkdir -m 751 my_dir 3 | -------------------------------------------------------------------------------- /0x01-shell_permissions/13-change_group: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | chgrp school hello 3 | -------------------------------------------------------------------------------- /0x01-shell_permissions/2-groups: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | groups 3 | -------------------------------------------------------------------------------- /0x01-shell_permissions/3-new_owner: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | chown betty hello 3 | -------------------------------------------------------------------------------- /0x01-shell_permissions/4-empty: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | touch hello 3 | -------------------------------------------------------------------------------- /0x01-shell_permissions/5-execute: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | chmod u+x hello 3 | -------------------------------------------------------------------------------- /0x01-shell_permissions/6-multiple_permissions: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | chmod ug+x,o+r hello 3 | -------------------------------------------------------------------------------- /0x01-shell_permissions/7-everybody: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | chmod ugo+x hello 3 | -------------------------------------------------------------------------------- /0x01-shell_permissions/8-James_Bond: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | chmod 007 hello 3 | -------------------------------------------------------------------------------- /0x01-shell_permissions/9-John_Doe: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | chmod 753 hello 3 | -------------------------------------------------------------------------------- /0x01-shell_permissions/README.md: -------------------------------------------------------------------------------- 1 | shell permissions 2 | -------------------------------------------------------------------------------- /0x02-shell_redirections/0-hello_world: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo 'Hello, World' 3 | -------------------------------------------------------------------------------- /0x02-shell_redirections/1-confused_smiley: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "\"(Ôo)'" 3 | -------------------------------------------------------------------------------- /0x02-shell_redirections/10-no_more_js: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | find . -type f -name '*.js' -delete 3 | -------------------------------------------------------------------------------- /0x02-shell_redirections/100-empty_casks: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | find . -empty -printf %f'\n' 3 | -------------------------------------------------------------------------------- /0x02-shell_redirections/101-gifs: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | find . -type f -name \*.gif -printf "%f\n" | LC_ALL=C sort -f | rev | cut -b 5- | rev 3 | -------------------------------------------------------------------------------- /0x02-shell_redirections/102-acrostic: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cut -c 1 | paste -s -d '' 3 | -------------------------------------------------------------------------------- /0x02-shell_redirections/103-the_biggest_fan: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | tail -n +2 | cut -f -1 | sort -k 1 | uniq -c | sort -rnk 1 | head -n 11 | rev | cut -d ' ' -f -1 | rev 3 | -------------------------------------------------------------------------------- /0x02-shell_redirections/11-directories: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | find . -type d -path './*' -print | wc -l 3 | -------------------------------------------------------------------------------- /0x02-shell_redirections/12-newest_files: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ls -t | head 3 | -------------------------------------------------------------------------------- /0x02-shell_redirections/13-unique: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | sort | uniq -u 3 | -------------------------------------------------------------------------------- /0x02-shell_redirections/14-findthatword: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | grep -i "root" /etc/passwd 3 | -------------------------------------------------------------------------------- /0x02-shell_redirections/15-countthatword: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | grep -c "bin" /etc/passwd 3 | -------------------------------------------------------------------------------- /0x02-shell_redirections/16-whatsnext: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | grep -iA 3 "root" /etc/passwd 3 | -------------------------------------------------------------------------------- /0x02-shell_redirections/17-hidethisword: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | grep -v "bin" /etc/passwd 3 | -------------------------------------------------------------------------------- /0x02-shell_redirections/18-letteronly: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | grep '^[A-Za-z]' /etc/ssh/sshd_config 3 | -------------------------------------------------------------------------------- /0x02-shell_redirections/19-AZ: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | tr Ac Ze 3 | -------------------------------------------------------------------------------- /0x02-shell_redirections/2-hellofile: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cat /etc/passwd 3 | -------------------------------------------------------------------------------- /0x02-shell_redirections/20-hiago: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | tr -d cC 3 | -------------------------------------------------------------------------------- /0x02-shell_redirections/21-reverse: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | rev 3 | -------------------------------------------------------------------------------- /0x02-shell_redirections/22-users_and_homes: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cut -d':' -f1,6 /etc/passwd | sort 3 | -------------------------------------------------------------------------------- /0x02-shell_redirections/3-twofiles: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cat /etc/passwd /etc/hosts 3 | -------------------------------------------------------------------------------- /0x02-shell_redirections/4-lastlines: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | tail /etc/passwd 3 | -------------------------------------------------------------------------------- /0x02-shell_redirections/5-firstlines: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | head /etc/passwd 3 | -------------------------------------------------------------------------------- /0x02-shell_redirections/6-third_line: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | head --lines=3 iacta | tail --lines=1 3 | -------------------------------------------------------------------------------- /0x02-shell_redirections/7-file: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "Best School" > "\*\\\'\"Best School\"\'\\\*$\?\*\*\*\*\*:)" 3 | -------------------------------------------------------------------------------- /0x02-shell_redirections/8-cwd_state: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ls -la >> ls_cwd_content 3 | -------------------------------------------------------------------------------- /0x02-shell_redirections/9-duplicate_last_line: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | tail --lines=1 iacta >> iacta 3 | -------------------------------------------------------------------------------- /0x02-shell_redirections/README.md: -------------------------------------------------------------------------------- 1 | shell redirection -------------------------------------------------------------------------------- /0x03-shell_variables_expansions/0-alias: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | alias ls="rm *" 3 | -------------------------------------------------------------------------------- /0x03-shell_variables_expansions/1: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export BEST=School 3 | -------------------------------------------------------------------------------- /0x03-shell_variables_expansions/1-hello_you: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "hello $USER" 3 | -------------------------------------------------------------------------------- /0x03-shell_variables_expansions/10-love_exponent_breath: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo $(($BREATH**$LOVE))"" 3 | -------------------------------------------------------------------------------- /0x03-shell_variables_expansions/100-decimal_to_hexadecimal: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | printf '%x\n' $DECIMAL 3 | -------------------------------------------------------------------------------- /0x03-shell_variables_expansions/101-rot13: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | tr 'A-Za-z' 'N-ZA-Mn-za-m]' 3 | -------------------------------------------------------------------------------- /0x03-shell_variables_expansions/102-odd: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | perl -lne 'print if $. %2==1' 3 | -------------------------------------------------------------------------------- /0x03-shell_variables_expansions/103-water_and_stir: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | printf '%o\n' $((5#$( echo $WATER | tr water 01234) + 5#$( echo $STIR | tr stir. 01234))) | tr 01234567 bestchol 3 | -------------------------------------------------------------------------------- /0x03-shell_variables_expansions/11-binary_to_decimal: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo $((2#$BINARY)) 3 | -------------------------------------------------------------------------------- /0x03-shell_variables_expansions/12-combinations: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | printf "%s\n" {a..z}{a..z} | grep -v "oo" 3 | -------------------------------------------------------------------------------- /0x03-shell_variables_expansions/13-print_float: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | printf "%.2f\n" $NUM 3 | -------------------------------------------------------------------------------- /0x03-shell_variables_expansions/2-path: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export PATH="$PATH:/action" 3 | -------------------------------------------------------------------------------- /0x03-shell_variables_expansions/3-paths: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo $PATH | tr -s ":" "\n"| wc -l 3 | -------------------------------------------------------------------------------- /0x03-shell_variables_expansions/4-global_variables: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | printenv 3 | -------------------------------------------------------------------------------- /0x03-shell_variables_expansions/5-local_variables: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set 3 | -------------------------------------------------------------------------------- /0x03-shell_variables_expansions/6-create_local_variable: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | BEST=School 3 | -------------------------------------------------------------------------------- /0x03-shell_variables_expansions/7-create_global_variable: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export BEST=School 3 | -------------------------------------------------------------------------------- /0x03-shell_variables_expansions/8-true_knowledge: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo $(($TRUEKNOWLEDGE+128))"" 3 | -------------------------------------------------------------------------------- /0x03-shell_variables_expansions/9-divide_and_rule: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo $(($POWER/$DIVIDE))"" 3 | -------------------------------------------------------------------------------- /0x03-shell_variables_expansions/README.md: -------------------------------------------------------------------------------- 1 | shell variables expansions -------------------------------------------------------------------------------- /0x04-loops_conditions_and_parsing/0-RSA_public_key.pub: -------------------------------------------------------------------------------- 1 | issh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDjfAqNjdwgV7bqv7FTNPmAybAio6CsTSVHzdqG6Vri363pXO7StVk6x2FC6UQoG1zZpMbbjOLeV6dCZh5njgoMTYvyHHz87fGnURQY6xqV4B5BDIwQp1G0LyFeMv4TPSKY5/tXnzSMzmqFH4EJLcDnxwA9SKvjL1ppONGNpNU0ECEQeQY6FYKH52NDWKnrTuuAtng/dOhv58kJOIsPkHkBaoN+A11pKpIMZIO8VU+RNGHIDyMwfT90RvtI0fwxB7DGW8hKlIH8dfDUeouOMuMEeN/da3Pgy8yErvmHtXJ/L7R/gl00TXD9gVGkSc4Qq+YskddJf3zHkTJZSI1ff6ClmRp6jDKWfGy4uoaxfzUSSeJePkMV79nufDNYbY8r0wri2ZXbUQIRmZOGoT54BASSY85MLVy/95TlU7XAKK24XOA8Jlm2/Y8KupPDMm4ikKUsZSklrLpkmSDgCQftv/UptYv5Bgbb1qsPHeN+ecHYqBTht/7NeP4MKB6rtLwC+jc= alpha@alpha 2 | -------------------------------------------------------------------------------- /0x04-loops_conditions_and_parsing/1-for_best_school: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # This script displays "Best School" 10 times 3 | 4 | for _ in {1..10}; do 5 | echo "Best School" 6 | done 7 | -------------------------------------------------------------------------------- /0x04-loops_conditions_and_parsing/10-fizzbuzz: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Displays 1 to 100 where "FizzBuzz" is displayed if the number is a multiple 3 | # of 3 and 5, "Fizz" if the number is a multiple of 3, and "Buzz" if the 4 | # number is a multiple of 5. Otherwise it displays the number 5 | 6 | i=1 7 | 8 | while [ $i -le 100 ]; do 9 | if [ $((i%5)) -eq 0 ] && [ $((i%3)) -eq 0 ]; then 10 | echo "FizzBuzz" 11 | elif [ $((i%5)) -eq 0 ]; then 12 | echo "Buzz" 13 | elif [ $((i%3)) -eq 0 ]; then 14 | echo "Fizz" 15 | else 16 | echo "$i" 17 | fi 18 | i=$((i+1)) 19 | done 20 | -------------------------------------------------------------------------------- /0x04-loops_conditions_and_parsing/100-read_and_cut: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Displays username, userid, and home directory path of /etc/passwd in list 3 | 4 | while read -r line; do 5 | echo "$line" | cut -d':' -f1,3,6 6 | done /var/run/myscript.pid 11 | 12 | termfunc() { 13 | rm /var/run/myscript.pid 14 | exit 15 | } 16 | 17 | 18 | while true 19 | do 20 | echo "To infinity and beyond" 21 | sleep 2 22 | trap 'echo "Y U no love me?!"' SIGINT 23 | trap 'echo "I hate the kill command" && termfunc' SIGTERM 24 | trap 'termfunc' SIGQUIT 25 | done 26 | -------------------------------------------------------------------------------- /0x05-processes_and_signals/101-manage_my_process: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Manages the program called manage_my_process 3 | 4 | FILE="/var/run/my_process.pid" 5 | 6 | create() 7 | { 8 | sudo touch $FILE 9 | sudo bash -c "echo $$ > $FILE" 10 | } 11 | 12 | if [ "$1" == "start" ]; then 13 | create 14 | ./manage_my_process & 15 | echo "manage_my_process started" 16 | 17 | elif [ "$1" == "stop" ] 18 | then 19 | [ -e "/var/run/my_process.pid" ] && sudo pkill -f "./manage_my_process" && rm /var/run/my_process.pid 20 | echo "manage_my_process stopped" 21 | 22 | elif [ "$1" == "restart" ] 23 | then 24 | $0 stop >& /dev/null 25 | $0 start >& /dev/null 26 | echo "manage_my_process restarted" 27 | 28 | else 29 | echo "Usage: manage_my_process {start|stop|restart}" 30 | fi 31 | -------------------------------------------------------------------------------- /0x05-processes_and_signals/101-manage_my_process,: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Manages the program called manage_my_process 3 | 4 | FILE="/var/run/my_process.pid" 5 | 6 | create() 7 | { 8 | sudo touch $FILE 9 | sudo bash -c "echo $$ > $FILE" 10 | } 11 | 12 | if [ "$1" == "start" ]; then 13 | create 14 | ./manage_my_process & 15 | echo "manage_my_process started" 16 | 17 | elif [ "$1" == "stop" ] 18 | then 19 | [ -e "/var/run/my_process.pid" ] && sudo pkill -f "./manage_my_process" && rm /var/run/my_process.pid 20 | echo "manage_my_process stopped" 21 | 22 | elif [ "$1" == "restart" ] 23 | then 24 | $0 stop >& /dev/null 25 | $0 start >& /dev/null 26 | echo "manage_my_process restarted" 27 | 28 | else 29 | echo "Usage: manage_my_process {start|stop|restart}" 30 | fi 31 | -------------------------------------------------------------------------------- /0x05-processes_and_signals/102-zombie.c: -------------------------------------------------------------------------------- 1 | #include "stdio.h" 2 | #include "stdlib.h" 3 | #include "unistd.h" 4 | 5 | /** 6 | * infinite_while - a function that runs forever and returns nothing 7 | * Return: 0 in the end 8 | */ 9 | int infinite_while(void) 10 | { 11 | while (1) 12 | { 13 | sleep(1); 14 | } 15 | return (0); 16 | } 17 | 18 | /** 19 | * main - the entry to a program that creates 5 zombie process 20 | * Return: 0 on success 21 | */ 22 | int main(void) 23 | { 24 | int children = 0; 25 | pid_t pid; 26 | 27 | while (children < 5) 28 | { 29 | pid = fork(); 30 | if (!pid) 31 | break; 32 | printf("Zombie process created, PID: %i\n", (int)pid); 33 | children++; 34 | } 35 | if (pid != 0) 36 | { 37 | infinite_while(); 38 | } 39 | return (0); 40 | } 41 | -------------------------------------------------------------------------------- /0x05-processes_and_signals/2-show_your_bash_pid: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Displays lines containing the word bash. 3 | 4 | ps auxf |grep bash 5 | -------------------------------------------------------------------------------- /0x05-processes_and_signals/3-show_your_bash_pid_made_easy: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # displays the PID, along with the process name, of processes 3 | # whose name contain the word bash 4 | 5 | pgrep -l bash 6 | -------------------------------------------------------------------------------- /0x05-processes_and_signals/4-to_infinity_and_beyond: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # prints the message infinity and beyon for 3 | # eternity unless it is killed, not so ethernal after all :) 4 | 5 | while true; 6 | do 7 | echo "To infinity and beyond"; 8 | sleep 2 9 | done 10 | -------------------------------------------------------------------------------- /0x05-processes_and_signals/5-dont_stop_me_now: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # kills the infinity and beyond program using sigkill signal 3 | 4 | # Get the pid of the program 5 | id=$(pgrep "bash ./4-to_infinity_and_beyond" -f) 6 | 7 | # Terminate the infinate process 8 | if [ -n "$id" ] 9 | then 10 | kill -15 "$id" 11 | fi 12 | -------------------------------------------------------------------------------- /0x05-processes_and_signals/6-stop_me_if_you_can: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # kills the infinity and beyond program using sigkill signal 3 | 4 | # Terminate the infinate process 5 | pkill -15 "bash ./4-to_infinity_and_beyond" -f 6 | -------------------------------------------------------------------------------- /0x05-processes_and_signals/7-highlander: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # prints the message infinity and beyond for 3 | # eternity unless it is killed, not so ethernal after all :) 4 | 5 | # Handle SIGTERM 6 | trap "echo 'I am invincible!!!'" 15 7 | 8 | 9 | # print the message forever 10 | while true; 11 | do 12 | echo "To infinity and beyond"; 13 | sleep 2 14 | done 15 | -------------------------------------------------------------------------------- /0x05-processes_and_signals/8-beheaded_process: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # kills the infinity and beyond program using sigkill signal 3 | 4 | # Terminate the infinate process 5 | pkill -9 "bash ./7-highlander" -f 6 | -------------------------------------------------------------------------------- /0x05-processes_and_signals/README.md: -------------------------------------------------------------------------------- 1 | 0x05-processes_and_signals -------------------------------------------------------------------------------- /0x05-processes_and_signals/manage_my_process: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Indefinitely writes "I am alive!" to a file 3 | 4 | NAME=/tmp/my_process 5 | sudo touch $NAME 6 | 7 | while true; do 8 | sudo bash -c "echo \"I am alive!\" >> $NAME" 9 | sleep 2 10 | done 11 | -------------------------------------------------------------------------------- /0x06-regular_expressions/0-simply_match_school.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | puts ARGV[0].scan(/School/).join 4 | -------------------------------------------------------------------------------- /0x06-regular_expressions/1-repetition_token_0.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | puts ARGV[0].scan(/hbt{2,5}n/).join 4 | -------------------------------------------------------------------------------- /0x06-regular_expressions/100-textme.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | puts ARGV[0].scan(/\[from:(.*?)\] \[to:(.*?)\] \[flags:(.*?)\]/).join(",") 4 | -------------------------------------------------------------------------------- /0x06-regular_expressions/2-repetition_token_1.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | puts ARGV[0].scan(/hb?t?n/).join 4 | -------------------------------------------------------------------------------- /0x06-regular_expressions/3-repetition_token_2.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | puts ARGV[0].scan(/hbt+n/).join 4 | -------------------------------------------------------------------------------- /0x06-regular_expressions/4-repetition_token_3.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | puts ARGV[0].scan(/hbt*n/).join 4 | -------------------------------------------------------------------------------- /0x06-regular_expressions/5-beginning_and_end.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | puts ARGV[0].scan(/^h.n$/).join 4 | -------------------------------------------------------------------------------- /0x06-regular_expressions/6-phone_number.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | puts ARGV[0].scan(/^\d{10,10}$/).join 4 | -------------------------------------------------------------------------------- /0x06-regular_expressions/7-OMG_WHY_ARE_YOU_SHOUTING.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | puts ARGV[0].scan(/[A-Z]*/).join 4 | -------------------------------------------------------------------------------- /0x06-regular_expressions/README.md: -------------------------------------------------------------------------------- 1 | # Regular Expression Project 2 | 3 | ## Introduction 4 | 5 | This project involves working with regular expressions using the Oniguruma library in Ruby. The goal is to create regex patterns for specific tasks. 6 | 7 | ## Files 8 | 9 | - **example.rb**: A Ruby script demonstrating the usage of regular expressions with the Oniguruma library. 10 | 11 | ## Usage 12 | 13 | To run the example script: 14 | 15 | ```bash 16 | ./example.rb 17 | ``` 18 | -------------------------------------------------------------------------------- /0x07-networking_basics/0-OSI_model: -------------------------------------------------------------------------------- 1 | 2 2 | 2 3 | -------------------------------------------------------------------------------- /0x07-networking_basics/1-types_of_network: -------------------------------------------------------------------------------- 1 | 3 2 | 2 3 | 1 4 | -------------------------------------------------------------------------------- /0x07-networking_basics/2-MAC_and_IP_address: -------------------------------------------------------------------------------- 1 | 2 2 | 1 3 | -------------------------------------------------------------------------------- /0x07-networking_basics/3-UDP_and_TCP: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 1 4 | -------------------------------------------------------------------------------- /0x07-networking_basics/4-TCP_and_UDP_ports: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Ports and sockets 3 | netstat --listening --program 4 | -------------------------------------------------------------------------------- /0x07-networking_basics/5-is_the_host_on_the_network: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # ping command usage 3 | if [ "$1" ]; then 4 | ping -c 5 "$1" 5 | else 6 | echo "Usage: 5-is_the_host_on_the_network {IP_ADDRESS}" 7 | fi 8 | -------------------------------------------------------------------------------- /0x07-networking_basics/README.md: -------------------------------------------------------------------------------- 1 | 0x07-networking_basics -------------------------------------------------------------------------------- /0x08-networking_basics_2/0-change_your_home_IP: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Change localhost address 3 | cp /etc/hosts ~/hosts.new 4 | sed -i "s/^127[0-9.]*\slocalhost/127.0.0.2 localhost/" ~/hosts.new 5 | sed -i "$ a\8.8.8.8 facebook.com" ~/hosts.new 6 | cp -f ~/hosts.new /etc/hosts 7 | -------------------------------------------------------------------------------- /0x08-networking_basics_2/1-show_attached_IPs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # displays all active IPv4 IPs on the machine it’s executed on 3 | ifconfig | awk -F "[: ]+" '/inet addr:/ { print $4 }' 4 | -------------------------------------------------------------------------------- /0x08-networking_basics_2/100-port_listening_on_localhost: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Listens to the port 98 on localhost 3 | nc -l 98 4 | -------------------------------------------------------------------------------- /0x08-networking_basics_2/README.md: -------------------------------------------------------------------------------- 1 | 0x08-networking_basics_2 -------------------------------------------------------------------------------- /0x09-web_infrastructure_design/README.md: -------------------------------------------------------------------------------- 1 | # 0x09. Web Infrastructure Design 2 | 3 | Welcome to the Web Infrastructure Design project! This project focuses on understanding the components and concepts involved in designing a web infrastructure. 4 | 5 | ## Resources 6 | 7 | - [Network basics concept page](https://en.wikipedia.org/wiki/Computer_network) 8 | - [Server concept page](https://en.wikipedia.org/wiki/Server_(computing)) 9 | - [Web server concept page](https://en.wikipedia.org/wiki/Web_server) 10 | - [DNS concept page](https://en.wikipedia.org/wiki/Domain_Name_System) 11 | - [Load balancer concept page](https://en.wikipedia.org/wiki/Load_balancing_(computing)) 12 | - [Monitoring concept page](https://en.wikipedia.org/wiki/Network_monitoring) 13 | - [What is a database](https://en.wikipedia.org/wiki/Database) 14 | - [Difference between a web server and an app server](https://www.nginx.com/resources/glossary/web-server-vs-application-server/) 15 | - [DNS record types](https://en.wikipedia.org/wiki/List_of_DNS_record_types) 16 | - [Single point of failure](https://en.wikipedia.org/wiki/Single_point_of_failure) 17 | - [Avoiding downtime when deploying new code](https://blog.heroku.com/applying-blue-green-deployment-on-heroku) 18 | - [High availability cluster](https://en.wikipedia.org/wiki/High-availability_cluster) 19 | - [What is HTTPS](https://en.wikipedia.org/wiki/HTTPS) 20 | - [What is a firewall](https://en.wikipedia.org/wiki/Firewall_(computing)) 21 | 22 | ## Learning Objectives 23 | 24 | By the end of this project, you should be able to: 25 | 26 | - Draw a diagram covering the web stack 27 | - Explain the function of each component in the web stack 28 | - Describe system redundancy 29 | - Understand acronyms like LAMP, SPOF, QPS 30 | 31 | ## Requirements 32 | 33 | - A README.md file is mandatory for each task 34 | - After whiteboarding, take a screenshot of your diagram 35 | - Upload the screenshot to an image hosting service 36 | - Insert the screenshot link into the answer file 37 | - Push your answer file to GitHub and insert the GitHub file link into the URL box 38 | - Whiteboard each task during the review session 39 | 40 | ## Notes 41 | 42 | - Focus on fulfilling the requirements mentioned in each task 43 | - Be concise and avoid unnecessary details unless requested 44 | - Ask questions if clarification is needed during whiteboarding sessions 45 | 46 | 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | a script that prints the absolute path name of the current working directory 2 | -------------------------------------------------------------------------------- /command_line_for_the_win/0-first_9_tasks.jpg,0-first_9_tasks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makitey/alx-system_engineering-devops/440d81fa7967878d02dde2029b03cc54f54e41ee/command_line_for_the_win/0-first_9_tasks.jpg,0-first_9_tasks.png -------------------------------------------------------------------------------- /command_line_for_the_win/1-next_9_tasks.jpg,1-next_9_tasks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makitey/alx-system_engineering-devops/440d81fa7967878d02dde2029b03cc54f54e41ee/command_line_for_the_win/1-next_9_tasks.jpg,1-next_9_tasks.png -------------------------------------------------------------------------------- /command_line_for_the_win/2-next_9_tasks.jpg,2-next_9_tasks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Makitey/alx-system_engineering-devops/440d81fa7967878d02dde2029b03cc54f54e41ee/command_line_for_the_win/2-next_9_tasks.jpg,2-next_9_tasks.png -------------------------------------------------------------------------------- /command_line_for_the_win/README.md: -------------------------------------------------------------------------------- 1 | # Command Line for the Win 2 | 3 | ## Project Overview 4 | 5 | This project involves completing various tasks and taking screenshots at different levels. The completion of each task is indicated by the turning of the task name to green. 6 | 7 | ## Screenshots 8 | 9 | Screenshots of the completed levels can be found in the directory `/root/alx-system_engineering-devops/command_line_for_the_win/`. 10 | 11 | ## SFTP File Transfer 12 | 13 | To transfer the screenshots to the sandbox environment, follow these steps: 14 | 15 | 1. Open a terminal or command prompt on your local machine. 16 | 17 | 2. Use the SFTP command-line tool to establish a connection to the sandbox environment. Replace ``, ``, and `` with the provided information: 18 | 19 | ```bash 20 | sftp @ 21 | ``` 22 | 23 | 3. Navigate to the directory where you want to upload the screenshots: 24 | 25 | ```bash 26 | cd /path/to/sandbox/directory 27 | ``` 28 | 29 | 4. Use the SFTP `put` command to upload the screenshots from your local machine to the sandbox environment. Replace `` with the actual filename: 30 | 31 | ```bash 32 | put /path/to/local/screenshot.png 33 | ``` 34 | 35 | Repeat this step for each screenshot. 36 | 37 | 5. Confirm that the screenshots have been successfully transferred by checking the sandbox directory. 38 | 39 | 6. Once the screenshots are transferred, push the screenshots to GitHub: 40 | 41 | ```bash 42 | git add . 43 | git commit -m "Add screenshots for completed levels" 44 | git push origin main 45 | ``` 46 | 47 | ## Manual QA Review 48 | 49 | Request a review for this project from a peer. If no peers have reviewed, request a review from a TA or staff member. 50 | 51 | --------------------------------------------------------------------------------