Advertisement
Guest User

Untitled

a guest
Jan 20th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.89 KB | None | 0 0
  1. Question 1: What command would I use to remove a non-empty folder?
  2. rm -r <folder-name>
  3. rm remove
  4. -r recursive
  5. Question 2: How to make a script and add executable permissions to the user and the group.
  6. chmod 770 <script-name>
  7. This allows you to chmod or modify read write and execute
  8. Or
  9. chmod 110 <filename>
  10. chmod ug + x
  11. Question 3: If I wanted to view the contents of a large text file, one page at a time, what command would I use?
  12. cat <file-name> | less
  13. if a file is too large to fit in terminal this command will allow you to see more details about what is shown above
  14. Question 4: What permissions can a super user change?
  15. A super user can change the permissions of a file, and execute commands with the privileges of another user account.
  16. Question 5: How do I copy a file through a relative path?
  17. Relative path uses the current working directory
  18. cp <file-name> <relative-path>
  19. Question 6: What does the first line of a shell script look like?
  20. #! /bin/bash //This imports the bash library
  21. Question 7: What’s the command only used to view the file name?
  22. ls -a
  23. list all the file names including hidden files
  24. Question 8: How do you use ls, Grep and Zip together?
  25. ls <path> | grep zip
  26. ls used to list files
  27. grep is used to find the name or words of the file and user keep in mind multiple word need
  28. to be separate by a | and zip is used to zip a file.
  29. Question 9: What is an example of a soft link?
  30. A soft link can be equated to a desktop shortcut, a file that simply redirects the real file, A symbolic link is a link to another name in the file system. And can be on different partitions on a drive.
  31. Example of soft link:
  32.  
  33. Question 10: How do you represent a hard link?
  34. A hard link is represented by number of links that bring you to a direct folder or directory
  35.  
  36. -rw-r--r-- 1 n01235723 MEDIASTUDIES\Domain Users 9 Jan 17 15a52 test.txt
  37. (The 1 after the permissions and before the user name)
  38. A Hard link also contains the same size of the file itself as it is a copy of the file.
  39. Question 11: What’s the number that represents the size of the file in a link file?
  40. -rw-r--r-- 1 n01235723 MEDIASTUDIES\Domain Users 9 Jan 17 15a52 test.txt
  41. (The “9” after “users”)
  42. Question 12: Can the Tilda represent an absolute path?
  43. Yes, the tilde can represent absolute path (represents user folder)
  44. Question 13: How many ways can I quit the VI editor?
  45. Shift and press zz
  46. :x and press enter
  47. :wq press enter
  48. :q press enter
  49. :q! press enter
  50. NOTE: THE COLON DOES NOT COUNT AS PART OF THE COMMAND
  51. There are 5 total ways to exit vi editor
  52. Question 14: Whats does it look like when you execute a command that takes 5 arguments?
  53. <command> <arg1> <arg2> <arg3> <arg4> <arg5>
  54. Type in command and five arguments
  55. Question 15: Starting with a working directory, what would the end result look like when doing change directory, and pre-working directory?
  56. cd <dir-path> .
  57. cd would change the directory to the next level in the hierarchy
  58. . would show the parent directory of the last working directory
  59. Question 16: Which is not a valid variable name in bash?
  60. Variable can only contain letters, digits and underscores however variable cannot begin with a number. A variable must also not already be declared
  61. Question 17: Syntax to suppress the display of errors while executing the command is?
  62. <command> 2 > /dev/null
  63. dev/null is used to get rid of unwanted output of a process (errors)
  64. Question 18: What is the output of a program that has a function, a variable and an echo?
  65. (Look up how functions, variables, and echo work)
  66. Question 19: What is the output of the program that has a function that calls another function?
  67. You can call a function within another function…
  68. Question 20: What’s the command used for shorthand in command line?
  69. Alias is used to create custom shorthand commands in Linux terminal
  70. Question 21: What’s it the result of a copy command with multiple arguments?
  71. cp <item1> <item2> <dir-path>
  72. cp would copy the first file to the second file creating the second if necessary
  73. You can have many items to copy
  74. Question 22: How do you generate a calendar with a specific date?
  75. cal <day> <month> <year>
  76. cal is calendar
  77. day is day of the month
  78. month displays month
  79. year displays year
  80. Question 23: What is the output of a program that takes in a system argument?
  81. A system argument is an argument that begins with $
  82. Question 24: What is the output of the following script that has a counter, while, do, and if
  83. The loop will keep running until the while statement’s condition(s) have been reached by the counter
  84. (Look up how do/while loops and if statements work)
  85. Question 25: How do I list all the files and directories recursively starting with a specific character?
  86. ls -r <character>*.*
  87. ls show directory list
  88. * one or more occurrences of the characters including no character or wildcard
  89. Question 26: What’s the command used to create an empty file if it does not exist?
  90. touch <filename>
  91. Question 27: How do you create a hard link that points across all partitions?
  92. A hard link CANNOT point across partitions unless change into a soft link using -s option
  93. Keep in mind partition is a logical division on a hard disk drive (HDD)
  94. Question 28: How do you point a file to an existing file?
  95. ln <new-path> <file-name>
  96. ln used to create a hard link or a symbolic link to a file
  97. Question 29: Given a permission sequence, what is the octal representation?
  98. An octal representation is the numerical representation of the of the permission for the file
  99. Octal Notation
  100. Permissions
  101. Alpha Notation
  102. 0
  103. means no permission
  104. ---
  105. 1
  106. execute
  107. --x
  108. 2
  109. write
  110. -w-
  111. 3
  112. execute and write
  113. -wx
  114. 4
  115. read
  116. r--
  117. 5
  118. read and execute
  119. r-x
  120. 6
  121. read and write
  122. rw-
  123. 7
  124. read, write and execute
  125. rwx
  126. Question 30: If a user tries to remove a read only file, what is the outcome?
  127. The console returns an error; you cannot remove a read only file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement