• Source
    1. #! /usr/bin/env bash
    2. #Project : To familiarize with Linux Commands
    3. #Author :-sanath vernekar
    4. #Procedure to use in Linux Terminal
    5. #chmod +x file path along with file name
    6. #ex: chmod +x /home/sanath/linux_commands.sh
    7. #then directly execute this file by entering ./filename
    8. #ex:./linux_commands.sh
    9.  
    10.  
    11. #Requires
    12. #1.uvacapture -----image capturing tool
    13. #2.libnotify-bin ----notifier
    14. #3.gpg ------Encryption Tool
    15. while true
    16. do
    17.  
    18. echo "==========================================================="
    19. echo " MENU "
    20. echo "==========================================================="
    21. echo -e "\033[32m" #Green Colour
    22. echo "1.To know about Your file systems"
    23. echo "2.To Encrypt and Decrypt Your Files"
    24. echo "3.exit"
    25. echo " enter your choice"
    26. read main_choice;
    27. clear
    28. case "$main_choice" in
    29.  
    30. 1) echo "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
    31. echo " File Menu "
    32. echo "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
    33. echo "1.Your Current Working Directory"
    34. echo "2.List all the files in this directory"
    35. echo "3.To view the Access mode of the files and their Permissions"
    36. echo "4.To view the TREE view (each and every files present in each sub folders)"
    37. echo "5.To view all the files in Tabular View"
    38. echo "6.To view all the hidden Folders"
    39. read file_choice;
    40. clear
    41. case "$file_choice" in
    42. 1) echo "==========================================================="
    43. echo "The Command for present working directory is "
    44. echo "pwd"
    45. echo "The root is the base of linux file system denoted by /"
    46. echo "Your Present Working Directory is "
    47. #notify-send "Your Present Working Directory"
    48. echo "==========================================================="
    49. pwd
    50. echo "==========================================================="
    51. ;;
    52. 2) echo "==========================================================="
    53. echo "The files/folders present in this folder only "
    54. ls
    55. echo "==========================================================="
    56. ;;
    57. 3) echo "==========================================================="
    58. echo "The files along with their permissions and Last changed "
    59. echo "==========================================================="
    60. echo "File Type owner usergp size date / Time directory/"
    61. echo "Access Perm modified filename "
    62. echo "==========================================================="
    63. ls -l
    64. echo "==========================================================="
    65. ;;
    66. 4) echo "==========================================================="
    67. echo "The Tree view of this folder"
    68.  
    69. ls -R
    70. notify-send "TREE VIEW of Folder"
    71. echo "==========================================================="
    72. ;;
    73. 5) echo "==========================================================="
    74. echo "List all the files in this folder in Tabular form"
    75. echo "==========================================================="
    76. echo "File Type owner usergp size date /Time directory/"
    77. echo "Access Perm modified filename "
    78. echo "==========================================================="
    79.  
    80. ls -al
    81. notify-send "Tabular View of Folder"
    82. echo "==========================================================="
    83. ;;
    84. 6) echo "==========================================================="
    85. echo "Any File or Directory which starts with . will not be seen unless you request to view it in Linux"
    86. echo "To view it The command is ls -a"
    87. ls -a
    88. echo "==========================================================="
    89. ;;
    90. *) echo "Wrong Choice"
    91. notify-send "Wrong Choice"
    92. ;;
    93. esac
    94. echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
    95. ;;
    96. 2) echo "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
    97. echo " File Encryption "
    98. echo "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
    99. echo "1.To Encrypt File"
    100. echo "2.To decrypt File"
    101. echo "3.To display all files present in the folder"
    102. echo "4.To hide a file in hidden folder"
    103. echo "5.To view the files in Hidden folder"
    104. echo "6.To unhide a file "
    105.  
    106. echo "Enter Your Choice [1 -3]"
    107. notify-send "Enter choice"
    108. read enc_choice;
    109. clear
    110. case "$enc_choice" in
    111. 1) echo "Enter the Exact File Name with extension to Encrypt the File"
    112. read file_name;
    113. if [ -s $file_name ]
    114. then
    115. gpg -c $file_name
    116. echo "Your file has been successfully Encrypted! "
    117. notify-send "Your file has been successfully Encrypted! "
    118. echo "Now the original file will be removed."
    119. rm -rf $file_name
    120. else
    121. notify-send "$file_name not found"
    122. echo "Wrong File name entered! ;("
    123. #echo "Re-run the program! ;("
    124. fi
    125. ;;
    126. 2) echo "Enter the Exact File Name with extension to Decrypt the File"
    127. read dec_file_name
    128. if [ -s $dec_file_name ]
    129. then
    130. new_file_modified=${dec_file_name::-4}
    131. gpg -d $dec_file_name > $new_file_modified
    132. if [ -s $new_file_modified ]
    133. then
    134. echo "ok"
    135. rm -rf $dec_file_name
    136. if [ -s snap.jpg ]
    137. then
    138. echo "$new_file_modified successfully decrypted"
    139. echo "Intruder Picture "
    140. notify-send "Intruder Picture "
    141. display snap.jpg
    142. echo "Your Decrypted picture "
    143. notify-send "Your Decrypted Picture"
    144. display $new_file_modified
    145. else
    146. echo "_____"
    147. fi
    148. else
    149. echo "not ok"
    150. rm -rf $new_file_modified
    151. uvccapture -m
    152. fi
    153. else
    154. echo "Wrong File name Entered ;("
    155. fi
    156.  
    157. echo "Thank You"
    158. ;;
    159. 3) echo "All the files present in this folder are:-"
    160. ls -l
    161. ;;
    162. 4) echo "Enter the exact file name which you want to Hide in Hidden folder "
    163. read hide_file_name
    164. if [ -s $hide_file_name ]
    165. then
    166. hide_file=".$hide_file_name"
    167. cp $hide_file_name $hide_file
    168. #cp $hide_file_name /home/sanath/.hidden_linux/$hide_file_name
    169. rm -rf $hide_file_name
    170. echo "$hide_file_name successfully hidden "
    171. notify-send "$hide_file_name successfully hidden "
    172. else
    173. echo "$hide_file_name not found "
    174. notify-send "$hide_file_name not found "
    175. fi
    176. ;;
    177. 5) echo "All the files along with Hidden folders and files are"
    178. ls -al
    179. ;;
    180. 6) echo "Enter the exact file name which you want to Unhide ...."
    181. read unhide_file_name
    182. unhide_file=".$unhide_file_name"
    183. #start_file_folder=pwd
    184. if [ -s $unhide_file ]
    185. then
    186. cp $unhide_file $unhide_file_name
    187. rm -rf $unhide_file
    188. echo "$unhide_file successfully Unhidden"
    189. notify-send "$unhide_file successfully Unhidden"
    190. else
    191. echo "$unhide_file_name not found"
    192. notify-send "$unhide_file_name not found "
    193. fi
    194. ;;
    195. *) echo "Wrong Choice"
    196. ;;
    197. esac
    198. ;;
    199. 3) echo "Thank You :)"
    200. notify-send "Thank You ;)"
    201. notify-send "BYE"
    202. echo "BYE"
    203. exit;;
    204. *) echo -e "\n"
    205. echo "Wrong Choice"
    206. ;;
    207.  
    208. esac
    209. done