13-09-2025

Scrumptious Scripting

I ended up helping out one of my fellow students today. It was over an azure lab that was fairly simple, though not for him in the slightest. He seemed to not understand how things worked in the background. For example the fundamentals of what a Virtual Machine is and does. So, we spent a couple hours going through how to do it through the Azure Portal, and more importantly learning how to use the Command Line Interface. So, as I thought why not share the basics on how to use Bash!

Note

This is not all inclusive as I will be covering only the basics in this post and provided examples are not all inclusive. I may consider expand upon this in a future post.

Bashing you with Basics

sudo is a basic command that stands for "Switch User Do." It is often used as a means to safely run a command as root without directly logging into the root account. It is prepended before another command and is used to update packages, and modify system configurations not in userspace. Ex. files in /etc/* or /boot/* some direct usage examples are as follows:

  • This command switches to the root account, tells the package manager to update the the package database, and then tells the package manager to upgrade any available packages in Debian/Ubuntu + Arch/Manjaro
    • sudo apt update && sudo apt upgrade
    • sudo pacman -Syu
  • This command tells nano to open /etc/pacman.conf with the root account so any changes are saved to disk and not read-only since it is a system file.
    • sudo nano /etc/pacman.conf
  • This command should not be run with sudo unless you really want to delete EVERYTHING, but thats what this does. It ignores any user permissions and deletes everything in the root folder.
    • sudo rm -rf /

#bash #commands

cd stands for "Change Directory." Basically you can type cd followed by a directory to move to that directory or "folder." Its a very simple command with very simple syntax Some examples:

  • This command snippet changes directory to the root directory, or base of the filesystem.
    • cd /
  • This command snippet moves you to your user home
    • cd ~
  • This command moves up one directory, you can go further by adding more ../'s
    • cd ../
  • This command goes up a couple directories and then into another
    • cd ../../some/folder

#bash #commands

If you ever get lost in your own filesystem and do not know where you are pwd is the command for you. Type pwd in your CLI, hit enter, and it will Print your Working Directory. Give it a try!

#bash #commands

man is another one of those commands that is prepended to another. This time however, it tells you how to use the command that its prepended to as long as you have the man-docs installed for that command. It will tell you all the gritty details like what arguments the command takes as well as some explanations for the behavior of the command. Some basic examples include:

  • This prints the usage of the sudo command to the CLI
    • man sudo
  • This prints the usage of the cd command to the CLI
    • man cd

#bash #commands

nano is one of those neat text editors that people use who do not understand vim (like me!). The syntax to nano is very simple. Supply it with a text file and it will attempt to read it and allow you to edit it. nano provides commands to exit, save, cut, paste, etc. by using the carrot symbol followed by a letter. For simplicity if you see a ^ replace that with the control key to use the command. nano also tells you if you need sudo to save a file, and allow you to elevate the command so you can automatically.

  • This command edits the file located at /etc/pacman.conf
    • nano /etc/pacman.conf

<< Previous | Next >>`