Linux UpSkill Challenge Day 0 through 2 - Setup and CLI Basics

Linux UpSkill Challenge Day 0 through 2 - Setup and CLI Basics

I took a big break during the summer with work starting up again and everything happening with COVID-19 here in the city, I will get back to the Python practice as much as I can during this semester that sees me taking 5 classes while distance learning.

One extra bit of training that I came across while browsing /r/linux was this thing called the [Linux UpSkill Challenge](https://linuxupskillchallenge.com/).  Lovely chap who goes by snori74 on Reddit and Github has a 20 day course setup to help people learn basic remote sysadmin commands.  Importance of people learning how to remotely control and move around their VMs is pretty important with so many services being migrated to the Cloud as opposed to being run locally, and with remote work possibly being more accepted due to this pandemic it's probably even more important.

I know some of these basic commands from working with my Unraid and Proxmox server, plus my normal navigation in Pop!_OS terminal but it doesn't hurt to have it reinforced through practice like this.  And I had $100 in Azure credits through using my student email so it cost me nothing upfront to setup a VPS through them for this.  

Day 0 was to be done anytime before September 7th, 2020 which was simply setting up your VM on whatever service you chose, whether it be DigitalOcean/AWS/Azure/etc.  Creating the VM in Azure gave me the option to download the Private Key, as I opted for enabling SSH through the use of keys as opposed to a password since this was going to be open to the internet.  Now, I never used SSH before on my machine.  So without going too much into specifics of how I setup my SSH I followed this nice [post on Linuxize.com](https://linuxize.com/post/using-the-ssh-config-file/) about how to do it and also how to edit your ssh config file.  As opposed to needing to specific the public IP, port and key needed everytime you can create an alias so instead of needing to type all that, to access my VPS(virtual private server) for this course I simply type

ssh linuxskillup

in the terminal and I am connected to my VPS.  Day 1 is to ensure we can connect to the server and then run some simple commands as shown below.  The day 1 task list on snori74's Github can be found here.

cleverness@Linux-Skillup-Challenge-Ubuntu:~$ ls
cleverness@Linux-Skillup-Challenge-Ubuntu:~$ uptime
  14:56:56 up 3 days, 22:23,  1 user,  load average: 0.00, 0.00, 0.00
cleverness@Linux-Skillup-Challenge-Ubuntu:~$ free
              total        used        free      shared  buff/cache   available
Mem:         938456      188864      170352         908      579240      591652
Swap:             0           0           0
cleverness@Linux-Skillup-Challenge-Ubuntu:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        29G  1.8G   28G   6% /
devtmpfs        455M     0  455M   0% /dev
tmpfs           459M     0  459M   0% /dev/shm
tmpfs            92M  888K   91M   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           459M     0  459M   0% /sys/fs/cgroup
/dev/sda15      105M  9.1M   96M   9% /boot/efi
/dev/loop0       56M   56M     0 100% /snap/core18/1885
/dev/loop1       72M   72M     0 100% /snap/lxd/16740
/dev/loop2       30M   30M     0 100% /snap/snapd/8790
/dev/sdb1       3.9G   16M  3.7G   1% /mnt
/dev/loop3       71M   71M     0 100% /snap/lxd/16922
tmpfs            92M     0   92M   0% /run/user/1000
cleverness@Linux-Skillup-Challenge-Ubuntu:~$ uname -a
Linux Linux-Skillup-Challenge-Ubuntu 5.4.0-1023-azure #23-Ubuntu SMP Mon Aug 17 20:33:19 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Day 2 was to get used to the concept of how to move across the linux filesystem through the terminal.  Things i've done before but still a good refresher.  In the terminal output below I kept the mistake I made when creating the test directory and not putting the period infront initially to show what happens when you mess up.  Instead of creating the directory locally in my home directory, I accidentally created it in /test under the root directory.  That's why the first ls output after creating the directory was empty.  Removing it and creating it correctly allowed for the output to now be seen as expected.  Day 2 task list can be found here.  Since I am saving time from commuting due to distance learning I am looking to make sure I work on things like this and the Python 100 days of coding more accurately now that I have a sense of how to manage my time between work and school during this unique semester.

cleverness@Linux-Skillup-Challenge-Ubuntu:~$ pwd
/home/cleverness
cleverness@Linux-Skillup-Challenge-Ubuntu:~$ cd /var/log
cleverness@Linux-Skillup-Challenge-Ubuntu:/var/log$ pwd
/var/log
cleverness@Linux-Skillup-Challenge-Ubuntu:/var/log$ cd ..
cleverness@Linux-Skillup-Challenge-Ubuntu:/var$ pwd  
/var
cleverness@Linux-Skillup-Challenge-Ubuntu:/var$ cd ..
cleverness@Linux-Skillup-Challenge-Ubuntu:/$ pwd
/
cleverness@Linux-Skillup-Challenge-Ubuntu:/$ cd /var
cleverness@Linux-Skillup-Challenge-Ubuntu:/var$ cd /log
-bash: cd: /log: No such file or directory
cleverness@Linux-Skillup-Challenge-Ubuntu:/var$ cd ./log 
cleverness@Linux-Skillup-Challenge-Ubuntu:/var/log$ pwd
/var/log
cleverness@Linux-Skillup-Challenge-Ubuntu:/var/log$ ls
alternatives.log  auth.log.1  chrony                 dist-upgrade  dmesg.1.gz  kern.log    lastlog  syslog.1     syslog.4.gz          wtmp
apt               azure       cloud-init-output.log  dmesg         dpkg.log    kern.log.1  private  syslog.2.gz  unattended-upgrades
auth.log          btmp        cloud-init.log         dmesg.0       journal     landscape   syslog   syslog.3.gz  waagent.log
cleverness@Linux-Skillup-Challenge-Ubuntu:/var/log$ ls -l -t
total 1492
-rw-rw-r--  1 root      utmp            292292 Sep  8 08:07 lastlog
-rw-rw-r--  1 root      utmp             12288 Sep  8 08:07 wtmp
-rw-r-----  1 syslog    adm              70469 Sep  8 08:07 syslog
-rw-r-----  1 syslog    adm             252184 Sep  8 08:07 auth.log
-rw-r--r--  1 root      root             87858 Sep  8 07:51 waagent.log
-rw-r--r--  1 root      root             75130 Sep  8 06:11 dpkg.log
drwxr-xr-x  2 root      root              4096 Sep  8 06:11 apt
-rw-r-----  1 syslog    adm               1968 Sep  8 06:11 kern.log
-rw-rw----  1 root      utmp             85632 Sep  8 04:38 btmp
-rw-r-----  1 syslog    adm              36618 Sep  8 00:00 syslog.1
-rw-r-----  1 syslog    adm               4977 Sep  7 00:00 syslog.2.gz
-rw-r-----  1 syslog    adm               3898 Sep  6 00:00 syslog.3.gz
-rw-r-----  1 syslog    adm             256456 Sep  5 23:49 auth.log.1
-rw-r-----  1 syslog    adm              67937 Sep  5 00:00 syslog.4.gz
drwxr-x---  2 root      adm               4096 Sep  4 02:01 unattended-upgrades
-rw-r-----  1 syslog    adm             112130 Sep  3 20:28 kern.log.1
-rw-r--r--  1 root      root              7839 Sep  3 16:33 cloud-init-output.log
-rw-r--r--  1 syslog    adm             260953 Sep  3 16:33 cloud-init.log
-rw-r--r--  1 root      adm              34207 Sep  3 16:33 dmesg
-rw-r--r--  1 root      root              1906 Sep  3 15:23 alternatives.log
-rw-r--r--  1 root      adm              38769 Sep  3 15:22 dmesg.0
drwxr-xr-x  2 landscape landscape         4096 Sep  3 15:20 landscape
-rw-r--r--  1 root      adm              11571 Sep  3 15:18 dmesg.1.gz
drwxr-xr-x  2 root      root              4096 Sep  3 15:18 azure
drwx------  2 root      root              4096 Sep  3 15:18 private
drwxr-sr-x+ 3 root      systemd-journal   4096 Sep  3 15:18 journal
drwxr-xr-x  2 root      root              4096 Aug  3 12:26 dist-upgrade
drwxr-xr-x  2 _chrony   _chrony           4096 May 20 04:16 chrony
cleverness@Linux-Skillup-Challenge-Ubuntu:/var/log$ ls -l
total 1492
-rw-r--r--  1 root      root              1906 Sep  3 15:23 alternatives.log
drwxr-xr-x  2 root      root              4096 Sep  8 06:11 apt
-rw-r-----  1 syslog    adm             252184 Sep  8 08:07 auth.log
-rw-r-----  1 syslog    adm             256456 Sep  5 23:49 auth.log.1
drwxr-xr-x  2 root      root              4096 Sep  3 15:18 azure
-rw-rw----  1 root      utmp             85632 Sep  8 04:38 btmp
drwxr-xr-x  2 _chrony   _chrony           4096 May 20 04:16 chrony
-rw-r--r--  1 root      root              7839 Sep  3 16:33 cloud-init-output.log
-rw-r--r--  1 syslog    adm             260953 Sep  3 16:33 cloud-init.log
drwxr-xr-x  2 root      root              4096 Aug  3 12:26 dist-upgrade
-rw-r--r--  1 root      adm              34207 Sep  3 16:33 dmesg
-rw-r--r--  1 root      adm              38769 Sep  3 15:22 dmesg.0
-rw-r--r--  1 root      adm              11571 Sep  3 15:18 dmesg.1.gz
-rw-r--r--  1 root      root             75130 Sep  8 06:11 dpkg.log
drwxr-sr-x+ 3 root      systemd-journal   4096 Sep  3 15:18 journal
-rw-r-----  1 syslog    adm               1968 Sep  8 06:11 kern.log
-rw-r-----  1 syslog    adm             112130 Sep  3 20:28 kern.log.1
drwxr-xr-x  2 landscape landscape         4096 Sep  3 15:20 landscape
-rw-rw-r--  1 root      utmp            292292 Sep  8 08:07 lastlog
drwx------  2 root      root              4096 Sep  3 15:18 private
-rw-r-----  1 syslog    adm              70469 Sep  8 08:07 syslog
-rw-r-----  1 syslog    adm              36618 Sep  8 00:00 syslog.1
-rw-r-----  1 syslog    adm               4977 Sep  7 00:00 syslog.2.gz
-rw-r-----  1 syslog    adm               3898 Sep  6 00:00 syslog.3.gz
-rw-r-----  1 syslog    adm              67937 Sep  5 00:00 syslog.4.gz
drwxr-x---  2 root      adm               4096 Sep  4 02:01 unattended-upgrades
-rw-r--r--  1 root      root             87858 Sep  8 07:51 waagent.log
-rw-rw-r--  1 root      utmp             12288 Sep  8 08:07 wtmp
cleverness@Linux-Skillup-Challenge-Ubuntu:/var/log$ ls -l -t -r -a
total 1500
drwxr-xr-x   2 _chrony   _chrony           4096 May 20 04:16 chrony
drwxr-xr-x   2 root      root              4096 Aug  3 12:26 dist-upgrade
drwxr-xr-x  13 root      root              4096 Aug 14 17:41 ..
drwxr-sr-x+  3 root      systemd-journal   4096 Sep  3 15:18 journal
drwx------   2 root      root              4096 Sep  3 15:18 private
drwxr-xr-x   2 root      root              4096 Sep  3 15:18 azure
-rw-r--r--   1 root      adm              11571 Sep  3 15:18 dmesg.1.gz
drwxr-xr-x   2 landscape landscape         4096 Sep  3 15:20 landscape
-rw-r--r--   1 root      adm              38769 Sep  3 15:22 dmesg.0
-rw-r--r--   1 root      root              1906 Sep  3 15:23 alternatives.log
-rw-r--r--   1 root      adm              34207 Sep  3 16:33 dmesg
-rw-r--r--   1 syslog    adm             260953 Sep  3 16:33 cloud-init.log
-rw-r--r--   1 root      root              7839 Sep  3 16:33 cloud-init-output.log
-rw-r-----   1 syslog    adm             112130 Sep  3 20:28 kern.log.1
drwxr-x---   2 root      adm               4096 Sep  4 02:01 unattended-upgrades
-rw-r-----   1 syslog    adm              67937 Sep  5 00:00 syslog.4.gz
-rw-r-----   1 syslog    adm             256456 Sep  5 23:49 auth.log.1
-rw-r-----   1 syslog    adm               3898 Sep  6 00:00 syslog.3.gz
-rw-r-----   1 syslog    adm               4977 Sep  7 00:00 syslog.2.gz
-rw-r-----   1 syslog    adm              36618 Sep  8 00:00 syslog.1
drwxrwxr-x  10 root      syslog            4096 Sep  8 00:00 .
-rw-rw----   1 root      utmp             85632 Sep  8 04:38 btmp
-rw-r-----   1 syslog    adm               1968 Sep  8 06:11 kern.log
drwxr-xr-x   2 root      root              4096 Sep  8 06:11 apt
-rw-r--r--   1 root      root             75130 Sep  8 06:11 dpkg.log
-rw-r--r--   1 root      root             87858 Sep  8 07:51 waagent.log
-rw-r-----   1 syslog    adm             252184 Sep  8 08:07 auth.log
-rw-r-----   1 syslog    adm              70469 Sep  8 08:07 syslog
-rw-rw-r--   1 root      utmp             12288 Sep  8 08:07 wtmp
-rw-rw-r--   1 root      utmp            292292 Sep  8 08:07 lastlog
cleverness@Linux-Skillup-Challenge-Ubuntu:/var/log$ cd
cleverness@Linux-Skillup-Challenge-Ubuntu:~$ ls -ltra
total 36
-rw-r--r-- 1 cleverness cleverness  807 Feb 25  2020 .profile
-rw-r--r-- 1 cleverness cleverness 3771 Feb 25  2020 .bashrc
-rw-r--r-- 1 cleverness cleverness  220 Feb 25  2020 .bash_logout
drwxr-xr-x 3 root       root       4096 Sep  3 15:18 ..
drwx------ 2 cleverness cleverness 4096 Sep  3 15:18 .ssh
drwx------ 2 cleverness cleverness 4096 Sep  3 15:20 .cache
-rw-r--r-- 1 cleverness cleverness    0 Sep  3 15:21 .sudo_as_admin_successful
drwx------ 3 cleverness cleverness 4096 Sep  3 16:34 .config
drwxr-xr-x 5 cleverness cleverness 4096 Sep  3 16:34 .
-rw------- 1 cleverness cleverness  162 Sep  7 15:25 .bash_history
cleverness@Linux-Skillup-Challenge-Ubuntu:~$ man mkdir
cleverness@Linux-Skillup-Challenge-Ubuntu:~$ pwd
/home/cleverness
cleverness@Linux-Skillup-Challenge-Ubuntu:~$ mkdir /test
mkdir: cannot create directory ‘/test’: Permission denied
cleverness@Linux-Skillup-Challenge-Ubuntu:~$ sudo mkdir /test
cleverness@Linux-Skillup-Challenge-Ubuntu:~$ ls   
cleverness@Linux-Skillup-Challenge-Ubuntu:~$ sudo rm -rf /test
cleverness@Linux-Skillup-Challenge-Ubuntu:~$ mkdir ./test
cleverness@Linux-Skillup-Challenge-Ubuntu:~$ ls
test
cleverness@Linux-Skillup-Challenge-Ubuntu:~$ cd ./test
cleverness@Linux-Skillup-Challenge-Ubuntu:~/test$