Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Question 1: What command would I use to remove a non-empty folder?
- rm -r <folder-name>
- rm remove
- -r recursive
- Question 2: How to make a script and add executable permissions to the user and the group.
- chmod 770 <script-name>
- This allows you to chmod or modify read write and execute
- Or
- chmod 110 <filename>
- chmod ug + x
- Question 3: If I wanted to view the contents of a large text file, one page at a time, what command would I use?
- cat <file-name> | less
- if a file is too large to fit in terminal this command will allow you to see more details about what is shown above
- Question 4: What permissions can a super user change?
- A super user can change the permissions of a file, and execute commands with the privileges of another user account.
- Question 5: How do I copy a file through a relative path?
- Relative path uses the current working directory
- cp <file-name> <relative-path>
- Question 6: What does the first line of a shell script look like?
- #! /bin/bash //This imports the bash library
- Question 7: What’s the command only used to view the file name?
- ls -a
- list all the file names including hidden files
- Question 8: How do you use ls, Grep and Zip together?
- ls <path> | grep zip
- ls used to list files
- grep is used to find the name or words of the file and user keep in mind multiple word need
- to be separate by a | and zip is used to zip a file.
- Question 9: What is an example of a soft link?
- 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.
- Example of soft link:
- Question 10: How do you represent a hard link?
- A hard link is represented by number of links that bring you to a direct folder or directory
- -rw-r--r-- 1 n01235723 MEDIASTUDIES\Domain Users 9 Jan 17 15a52 test.txt
- (The 1 after the permissions and before the user name)
- A Hard link also contains the same size of the file itself as it is a copy of the file.
- Question 11: What’s the number that represents the size of the file in a link file?
- -rw-r--r-- 1 n01235723 MEDIASTUDIES\Domain Users 9 Jan 17 15a52 test.txt
- (The “9” after “users”)
- Question 12: Can the Tilda represent an absolute path?
- Yes, the tilde can represent absolute path (represents user folder)
- Question 13: How many ways can I quit the VI editor?
- Shift and press zz
- :x and press enter
- :wq press enter
- :q press enter
- :q! press enter
- NOTE: THE COLON DOES NOT COUNT AS PART OF THE COMMAND
- There are 5 total ways to exit vi editor
- Question 14: Whats does it look like when you execute a command that takes 5 arguments?
- <command> <arg1> <arg2> <arg3> <arg4> <arg5>
- Type in command and five arguments
- Question 15: Starting with a working directory, what would the end result look like when doing change directory, and pre-working directory?
- cd <dir-path> .
- cd would change the directory to the next level in the hierarchy
- . would show the parent directory of the last working directory
- Question 16: Which is not a valid variable name in bash?
- Variable can only contain letters, digits and underscores however variable cannot begin with a number. A variable must also not already be declared
- Question 17: Syntax to suppress the display of errors while executing the command is?
- <command> 2 > /dev/null
- dev/null is used to get rid of unwanted output of a process (errors)
- Question 18: What is the output of a program that has a function, a variable and an echo?
- (Look up how functions, variables, and echo work)
- Question 19: What is the output of the program that has a function that calls another function?
- You can call a function within another function…
- Question 20: What’s the command used for shorthand in command line?
- Alias is used to create custom shorthand commands in Linux terminal
- Question 21: What’s it the result of a copy command with multiple arguments?
- cp <item1> <item2> <dir-path>
- cp would copy the first file to the second file creating the second if necessary
- You can have many items to copy
- Question 22: How do you generate a calendar with a specific date?
- cal <day> <month> <year>
- cal is calendar
- day is day of the month
- month displays month
- year displays year
- Question 23: What is the output of a program that takes in a system argument?
- A system argument is an argument that begins with $
- Question 24: What is the output of the following script that has a counter, while, do, and if
- The loop will keep running until the while statement’s condition(s) have been reached by the counter
- (Look up how do/while loops and if statements work)
- Question 25: How do I list all the files and directories recursively starting with a specific character?
- ls -r <character>*.*
- ls show directory list
- * one or more occurrences of the characters including no character or wildcard
- Question 26: What’s the command used to create an empty file if it does not exist?
- touch <filename>
- Question 27: How do you create a hard link that points across all partitions?
- A hard link CANNOT point across partitions unless change into a soft link using -s option
- Keep in mind partition is a logical division on a hard disk drive (HDD)
- Question 28: How do you point a file to an existing file?
- ln <new-path> <file-name>
- ln used to create a hard link or a symbolic link to a file
- Question 29: Given a permission sequence, what is the octal representation?
- An octal representation is the numerical representation of the of the permission for the file
- Octal Notation
- Permissions
- Alpha Notation
- 0
- means no permission
- ---
- 1
- execute
- --x
- 2
- write
- -w-
- 3
- execute and write
- -wx
- 4
- read
- r--
- 5
- read and execute
- r-x
- 6
- read and write
- rw-
- 7
- read, write and execute
- rwx
- Question 30: If a user tries to remove a read only file, what is the outcome?
- The console returns an error; you cannot remove a read only file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement