├── 4_Making_and_Manipulating_Files └── Challenge 1_ Terminal Navigation and Manipulating Files.pdf ├── 5_Searching_Through_Files └── Challenge 2_ Piping, Grep, Awk, and Redirecting Output.pdf ├── 6_Permissions └── Challenge 3_ File Permissions, Users, and Groups.pdf ├── 7_Installing_Software └── Challenge 4_ Installing New Software and Learning How To Use It.pdf ├── 8_Compressing_Files └── Challenge 5_ Compressing and Decompressing Files.pdf ├── 9_Bash_Scripting ├── Challenge 6_ Bash Scripting.pdf ├── ed_Challenge_6 ├── ed_Challenge_6.pdf ├── hello_world ├── hello_world.pdf ├── mkfile ├── mkfile.pdf ├── ninfo ├── ninfo.pdf ├── numbers ├── numbers.pdf ├── session_info ├── session_info.pdf ├── touchfile └── touchfile.pdf ├── LICENSE └── README.md /4_Making_and_Manipulating_Files/Challenge 1_ Terminal Navigation and Manipulating Files.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/The-Art-of-Doing-Learn-the-Linux-Command-Line/7319d9b72ffe08f4fd590ad7947fca047d947e2c/4_Making_and_Manipulating_Files/Challenge 1_ Terminal Navigation and Manipulating Files.pdf -------------------------------------------------------------------------------- /5_Searching_Through_Files/Challenge 2_ Piping, Grep, Awk, and Redirecting Output.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/The-Art-of-Doing-Learn-the-Linux-Command-Line/7319d9b72ffe08f4fd590ad7947fca047d947e2c/5_Searching_Through_Files/Challenge 2_ Piping, Grep, Awk, and Redirecting Output.pdf -------------------------------------------------------------------------------- /6_Permissions/Challenge 3_ File Permissions, Users, and Groups.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/The-Art-of-Doing-Learn-the-Linux-Command-Line/7319d9b72ffe08f4fd590ad7947fca047d947e2c/6_Permissions/Challenge 3_ File Permissions, Users, and Groups.pdf -------------------------------------------------------------------------------- /7_Installing_Software/Challenge 4_ Installing New Software and Learning How To Use It.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/The-Art-of-Doing-Learn-the-Linux-Command-Line/7319d9b72ffe08f4fd590ad7947fca047d947e2c/7_Installing_Software/Challenge 4_ Installing New Software and Learning How To Use It.pdf -------------------------------------------------------------------------------- /8_Compressing_Files/Challenge 5_ Compressing and Decompressing Files.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/The-Art-of-Doing-Learn-the-Linux-Command-Line/7319d9b72ffe08f4fd590ad7947fca047d947e2c/8_Compressing_Files/Challenge 5_ Compressing and Decompressing Files.pdf -------------------------------------------------------------------------------- /9_Bash_Scripting/Challenge 6_ Bash Scripting.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/The-Art-of-Doing-Learn-the-Linux-Command-Line/7319d9b72ffe08f4fd590ad7947fca047d947e2c/9_Bash_Scripting/Challenge 6_ Bash Scripting.pdf -------------------------------------------------------------------------------- /9_Bash_Scripting/ed_Challenge_6: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #Encrypt or decrpt and a file or entire directory. 4 | 5 | echo "Welcome, I am ready to encrypt/decrypt a file for you." 6 | echo -n "Enter the name of the file to work with: " 7 | read file_name 8 | 9 | file_path="$PWD/$file_name" 10 | 11 | echo -n "Enter (e) to encrypt or (d) to decrypt: " 12 | read choice 13 | echo 14 | 15 | if [ -f "$file_path" ]; then 16 | if [ "$choice" = e ]; then 17 | gpg -c --no-symkey-cache "$file_path" 18 | echo "$file_name succesfully encrypted. Removing unencrypted file..." 19 | rm "$file_path" 20 | elif [ "$choice" = d ]; then 21 | gpg -d "$file_path" 22 | else 23 | echo "I'm sorry, $choice is not a viable option..." 24 | fi 25 | else 26 | echo "I'm sorry, $file_name is not a regular file..." 27 | for file in "$PWD"/*; do 28 | if [ -f "$file" ]; then 29 | echo "Possible usage: $file" 30 | fi 31 | done 32 | fi 33 | 34 | echo 35 | echo "Current ecrypted files include: " $(ls | grep .gpg) 36 | 37 | 38 | -------------------------------------------------------------------------------- /9_Bash_Scripting/ed_Challenge_6.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/The-Art-of-Doing-Learn-the-Linux-Command-Line/7319d9b72ffe08f4fd590ad7947fca047d947e2c/9_Bash_Scripting/ed_Challenge_6.pdf -------------------------------------------------------------------------------- /9_Bash_Scripting/hello_world: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #Print a message to the world 4 | 5 | echo 'Hello world!' 6 | -------------------------------------------------------------------------------- /9_Bash_Scripting/hello_world.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/The-Art-of-Doing-Learn-the-Linux-Command-Line/7319d9b72ffe08f4fd590ad7947fca047d947e2c/9_Bash_Scripting/hello_world.pdf -------------------------------------------------------------------------------- /9_Bash_Scripting/mkfile: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #Touch a file if not already in existance and set its permissions 4 | 5 | echo -n "Enter a filename: " 6 | read filename 7 | 8 | filepath="$PWD/$filename" 9 | 10 | if [ -e "$filepath" ]; then 11 | echo "File already exists...exiting." 12 | else 13 | touch "$filepath" 14 | echo "File created." 15 | echo -n "Enter a permission code for the file (***): " 16 | read permission 17 | chmod "$permission" "$filepath" 18 | 19 | if [ "$permission" = 777 ]; then 20 | echo "All users have rwx permissions." 21 | elif [ "$permission" = 666 ]; then 22 | echo "All users have rw permissions." 23 | elif [ "$permission" = 444 ]; then 24 | echo "All users have r permissions." 25 | else 26 | echo "Permissions have been set to $permission" 27 | fi 28 | fi 29 | -------------------------------------------------------------------------------- /9_Bash_Scripting/mkfile.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/The-Art-of-Doing-Learn-the-Linux-Command-Line/7319d9b72ffe08f4fd590ad7947fca047d947e2c/9_Bash_Scripting/mkfile.pdf -------------------------------------------------------------------------------- /9_Bash_Scripting/ninfo: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #Gather information for a specific internet device using ip and ping. 4 | 5 | echo -n "Enter your device name: " 6 | read device 7 | 8 | while [ "$choice" != 0 ]; do 9 | echo 10 | echo "Enter 1 to get your device IP." 11 | echo "Enter 2 to get your device MAC." 12 | echo "Enter 3 to test your network using PING." 13 | echo "Enter 0 to quit." 14 | echo -n "Enter your choice: " 15 | read choice 16 | echo 17 | 18 | if [ "$choice" = 1 ]; then 19 | ip=$(ip addr show "$device" | grep -w inet | awk -F" " '{ print $2 }') 20 | echo "$device ip: $ip" 21 | elif [ "$choice" = 2 ]; then 22 | mac=$(ip addr show "$device" | grep -w ether | awk -F" " '{ print $2 }') 23 | echo "$device mac: $mac" 24 | elif [ "$choice" = 3 ]; then 25 | echo -n "Please give a website or IP to ping: " 26 | read website 27 | echo "Testing network by pinging $website..." 28 | status=$(ping -c 10 "$website" | grep -w packets | awk -F"," '{ print $3 }') 29 | echo "Network strength: $status" 30 | elif [ "$choice" = 0 ]; then 31 | echo "Thank you, goodbye." 32 | else 33 | echo "That is not an option. Ending program." 34 | break 35 | fi 36 | done 37 | -------------------------------------------------------------------------------- /9_Bash_Scripting/ninfo.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/The-Art-of-Doing-Learn-the-Linux-Command-Line/7319d9b72ffe08f4fd590ad7947fca047d947e2c/9_Bash_Scripting/ninfo.pdf -------------------------------------------------------------------------------- /9_Bash_Scripting/numbers: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #Add two numbers given by the user and log the result. 4 | 5 | echo -n "$USER, please enter a number: " 6 | read numA 7 | echo -n "$USER, please enter a second number: " 8 | read numB 9 | 10 | sum=$(($numA + $numB)) 11 | echo "The sum of $numA and $numB is $sum" 12 | 13 | #Log script usage information 14 | echo $(id):$(date +%D):"$sum" >> "$HOME"/addition.log 15 | 16 | -------------------------------------------------------------------------------- /9_Bash_Scripting/numbers.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/The-Art-of-Doing-Learn-the-Linux-Command-Line/7319d9b72ffe08f4fd590ad7947fca047d947e2c/9_Bash_Scripting/numbers.pdf -------------------------------------------------------------------------------- /9_Bash_Scripting/session_info: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #Give specific info about the current session 4 | 5 | echo "The current date and time is $(date)" 6 | echo "The current user is $USER" 7 | echo "The current shell is $SHELL" 8 | echo "The current working directory is $PWD" 9 | 10 | echo "Your system has been up for $(uptime -p)" 11 | -------------------------------------------------------------------------------- /9_Bash_Scripting/session_info.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/The-Art-of-Doing-Learn-the-Linux-Command-Line/7319d9b72ffe08f4fd590ad7947fca047d947e2c/9_Bash_Scripting/session_info.pdf -------------------------------------------------------------------------------- /9_Bash_Scripting/touchfile: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #Touch all the files in a given directory and update their timestamp. 4 | 5 | files="$PWD"/* 6 | 7 | #" " allows for the expansion of $ but not * 8 | #Therefore we shouldn't use double quotes here. 9 | #echo $files 10 | #echo "$files" 11 | 12 | for f in $files; do 13 | touch "$f" 14 | done 15 | 16 | -------------------------------------------------------------------------------- /9_Bash_Scripting/touchfile.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/The-Art-of-Doing-Learn-the-Linux-Command-Line/7319d9b72ffe08f4fd590ad7947fca047d947e2c/9_Bash_Scripting/touchfile.pdf -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Packt 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | # The-Art-of-Doing-Learn-the-Linux-Command-Line --------------------------------------------------------------------------------