what is relative path?
location from the current directory
what’s absolute path?
something like /bin/ping
-used in case the program is not specified in PATH
~
current user’s home directory
*
wildcard used for finding certain types of files
output
results of command in a bash shell
command > file.txt
create or overwrite
command»_space; file.txt
create or append
what are 2 types of output redirection
2. to another command
what bash character sends output to another command?
(pipe)
what is a “oneliner” script?
chaining multiple commands to automate a task
what does this oneliner do?
file ‘ls /etc/*conf’ | sort > test.txt && cat test.txt | wc -l
what extension does a bash script file have?
.sh
what is the first line of any bash script file?
!/bin/bash
after saving a bash file, what should you make sure of?
make sure the file is executable, change the permissions
how do you make a file executable?
chmod+x
how do you run a script in linux terminal?
./
what is they syntax for a bash conditional statement?
if ; then commands elif ; then commands else commands fi
What do these operators mean?
equal
not equal
What do these operators mean?
less than
less than or equal to
What do these operators mean?
greater than
greater than or equal to
what does this for loop do? #!/bin/bash
for i in $( ls ); do
echo item: $i
done
print out every item in a current directory
what does this for loop do? #!/bin/bash
for i in ‘seq 1 10’;
do
echo $i
done
uses the ‘seq’ command to iterate over numbers
what is the ‘while’ loops useful for
iterating over items in a file
what does the script below do?
while[condition]; do ; ; done
basic syntax to iterate over times