Basic Commands
echo "Hello World"
pwd
whoami
exit
Navigation
cd /path/to/directory
cd ..
ls
tree
File & Directory
mkdir foldername
rm -r foldername
cp source destination
mv source destination
rm filename
touch filename
Variables
var="Hello"
echo $var
read var
Loops
for i in {1..5}; do echo $i; done
for file in *.txt; do echo $file; done
while [ $count -lt 5 ]; do echo $count; ((count++)); done
Conditionals
if [ $a -eq $b ]; then echo "Equal"; fi
if [ ! -f file.txt ]; then echo "File not found"; fi
if [[ $str == "hello" ]]; then echo "Hi"; fi
Redirection & Pipes
command > file.txt
command >> file.txt
command1 | command2
Networking
ping google.com
ifconfig
traceroute google.com
netstat -tuln
Process & System Info
ps aux
top
kill -9 PID
uname -a
hostname
Help & Documentation
man command
command --help
|