(Much of this is taken from the LearnLinux.tv YouTube channel here:)
Filesystem notes:
C:\Users = /home
C:\Windows = /root (This is not 100% accurate equivalency. root is actually a user that is the admin user for the machine.)
Terminal/BASH Cheatsheet
BASH stands for Born Again SHellColour codes NB: This isn't the same of every disto:
Blue = Folder
Green = Program/Binary
White = file
Teal = link/symlink(?)
BASH_CMDS
clear = clear's the terminal (eq tq cls in windows)echo = prints what you put in quotes after the cmd (like windows does)
pwd = (print's the working directory)
~ = (shorthand/shortcut for home dir)
cat = (shows the contents of a file)
which = (show if and where a cmd/program/binary lives)
cp = (copies files)
diff = (tells you if files are different, If they're the same then there's no output)
. = refers to current dir
.. = refers to dir that's one level up from current
mv = used for moving files but ALSO renaming files.
Nano (basic test editor (ie notepad)
^ refers to Ctrl so Ctrl+G shows the help menu.
Bash scripting:
All scripts must start with a "Hash Bang" aka "She Bang":#!/bin/bash
You must make the bash file you've save an executable with:
chmod +x your_filename
Setting Variables
var_name=NB: Whitespace is not allowed
eg:
msg="Hi There"
number=10
Addressing Variables
use $ as a prefixeg:
echo $msg
echo $number
You can pass variables to the bash script. Address them using $
eg:
echo $1 # prints out first arg passed
echo $2 # prints our second arg passed
If/Else syntax
if [ $MY_VAR -eq 200 ]then
echo "my var is equal to 200"
else
echo "ma var is not equal to 200"
fi