Back in March, I touched base with Corey and we both caught up quite a bit on what we've been up to - considering we haven't talked in years. I mentioned I was still job hunting, pummeling through interviews left and right, and still to no avail...no job offer. We then decided to work together on making that possible, still, as well as coming up with ideas/projects to bring to the table for future employers.
These kinds of projects would be more focused on building entire full-stack applications which I am able to add more functionality in the future and bells + whistles. We also thought it would be good practice to learn about devops! I've always been intrigued with the development cycle and server infrastructure.
So first things first - Learning Linux.
Corey crafted together a nifty e-textbook on Linux that is currently a Work in Progress. Up to Ch. 4 so far, to be precise.
He decided to set up a server for me and my goal was to log into it using a generated public + private key. I had trouble logging on and had a popup reading: (says no supported authentication methods(privateKey)). I eventually learned that I must upload my private key on putty and then log in as root user. I had to generate my own private keys through puttygen.
Listed below are simple notes on Linux
Ch. 1+2
- update packages installed in the system
root user = super user
- benefits of creating a personal account: can use same commands as root/same power but generally denied or require special command: sudo
GRANTING ADMINISTRATIVE ACCESS TO USER
- add new user: usermod -aG sudo
- exit + login as new user: though doesn't work for me on putty < ...permission denied
- so I just switched users and input password
accessed server, changed root users password, update system packages
man: manual
man pwd: manual print working directory
- like a manual make directory for more context
rm: remove
-d: denotes that argument is directory/other file
-r: removes a directory and all of its contents(recursive)
rmdir: remove a directory if only it is empty
cd ; pwd ( this is a chain command seperated by semi colons ;)
$HOME: Home directory
touch: set modification + access to a file
touch creates an empty file
Ch. 3 - WRITING SHELL SCRIPTS
Shell script : Computer program designed to be run by unix shell, a command line interpreter
- middleman - interface, between the command line and underlying command system
My First Shell Script!
$ chmod +x : grants permission to file for it to be executable
To execute script: ./hello.sh
Arguments(Parameters) : echo "Hello ${1}!"
./hello.sh Jess Hello Jess!
{0} is program by default
$ {@}: references entire argument list
echo "Hello ${args}!"
# : Prepend a line to mark as comment
IF CONTROL STATEMENTS
IF:
args = "${@}"
if [[ "${args}" == " "]]; then
args = "World!"
fi
echo "${args}!"
IF-ELSE
args = $1
if [[ "${args}" == " "]]; then
args = "Hello World!"
else
args = "Hello ${args}"
fi
SHELL SCRIPT + OPERATIONS
#!/bin/bash : (list on top line of script) Tells kernel which shell should be used
- Var names should be lowercase. Multiple words be separated by _
The textbook was extremely straightforward and simple to grasp. I had some prior knowledge on how Linux work and I've dabbled with server-side infra before. I believe that if this was my first time touching Linux, I probably would have had a more difficult time putting the pieces together