bash
env //show environtment variables
$PATH //use $ before variable to print it
which //know the location of the command.
` ` //whatever is inside will be executed first
#!/bin/bash
x=1
y=2
if ["$a" -eq "$b"];then
echo "They are equal";
fi
#!/bin/bash
for i in $(ls);do
echo item: $i
done
#!/bin/bash
for i in `seq 1 10`;
do
echo $i
done
//oneliner to read contents of file.
while read line; do echo $line;doen < file.txt
//create a file with only port no's from an nmap scan oneliner
cat nmap.txt | grep open | cut -d "/" -f 1 | sort -u | xargs | tr " " "," > file.txt
windows command line
path //path variable
type //view file contents
com1 & com2 //execute both commands
com1 && com2 //iff com1 executes, execute com2
com1 | com2 //pipe com1 o/p into com2
com1 || com2 //iff com1 fails execute com2
//list files oneliner
for %i in (*.*) do @echo FILE: %i