I love to learn new thing and very often undertake some sort of new study, sometimes out of pure interest and sometimes out of necessity.
This latest learning venture takes me on a journey I previously never considered, and to be honest this time its more out of necessity than interest. I think I have a mental block about learning something that does not fascinate me and this is going to be a uphill struggle.
My First lesson was rather boring. I learned how to install virtualbox and set up a virtual machine and I learned how to install Ubuntu on my windows laptop. We spent some time learning about Linux distributions and finding our way around our Ubuntu Desktop.
I tend to jump ahead of myself a lot and during this lesson my thoughts wondered. I want to learn this stuff to help me run a witness server on STEEM. How is running Ubuntu on a virtual machine with a desktop interface going to help me here. The server stuff looks nothing like this. where is the black screen with the flashy cursor? How much of this stuff is going to be relevant? Is this all a waste of my time???? I think I decided it was because I don't have any notes to share with you about that class.
My second class was more engaging. We started some work on Linux command line. Thankfully I managed to stay focused for this class. I got that black screen with the flashing cursor that I am was previously familiar with staring at wondering what the heck I am supposed to do.
The thing is I know I am not the only one running blockchain software on a server with no idea what they are doing. Whether it’s running a masternode software or a STEEM witness, people like me rely on the skills and knowledge of others to really make these things run.
I am using steem to keep a kinda learning log and maybe some of the stuff I learn, by sharing it here, can also help others.
So lets get into some command lines
When you screen is just getting to full type clear
Change directory: cd – this is a command built into the shell
Example 1: cd / - this will change directory to an absolute path from the root directory, for example cd /user/myuser. However, you can change the path to a relative directory by omitting the /.
Example 2: cd ./ - this will change the current directory to the level of the current directory. For example we are in user, cd ./myuser will bring us to myuser.
To quickly jump to home you can use cd ~
Print working directory: pwd – this will show you the directory you are currently in
To list all the content from the current directory in alphabetical order use ls. To list in reverse alphabetical order use ls -r
To list contents with more details, use ls -l. -l standing for long. Here you will find permissions, user, user group and date.
To include file types in the list use ls -p and to sort based on file size use ls -s
You can also pass a path to the ls command for example ls /user/myuser
And you can string commands together such as ls -r -d which would return a list in reverse alphabetical order of only directories
To get help on the ls command use ls –
The command nano is the terminal text editor
Administrator privileges are granted to sudo users. Standing for super user do.
To repeat the last command use !!
To repeat the last command with admin privileges use sudo !! (for example, you tried to edit a file and could not because you did not have the rights, you can run sudo !! and it will re-run the command under sudo)
To change user the command is su. If you use sudo su, you will change the user to sudo. To change back to your own account use su myuser (replace myuser with account name)
To manage packages, use the program apt-get. This program can preform a number of actions
To install a package, use apt-get install filename, to remove its apt-get remove filename. To use apt-get you many need to be a sudo user.
To search the Ubuntu repository for a package, use apt-cache search filename*
To check if you have a package installed use apt-cache policy filename
You can install a package that is not in the official repositories. .deb files work with apt package manager. Once you download the file, use cd to navigate to downloads and use the following command sudo dpkg -i ./filename.deb
To update packages and check for updates use sudo apt-get upgrade.
That's my class notes shared and up to-date. I hope by sharing these notes I can help others and also reinforce the learning for me. If you are reading this and you know about Linux and Ubuntu and you see any glaring mistakes, please do let me know.