2019-12-14 Meeting

Presentation:

Rich brought in his raspberry pi and asked about how best to make a clone of the SDCard.  This led us into a deep discussion drives and partitions.  We used the lsblk and blkid commands to discover the block devices, namely two MicroSD cards and a USB stick drive.  We also looked at the various partitions using mount and df to find which filesystems were mounted and the amount of free space.  Rich said he would  remove the SDCard, make on image of it on a PC, then write the image to another SDCard.

Carl talked about aliases and showed an easy way to manage a set of aliases for several different computers.

  1. Add “.~/.aliases” to the bottom of the ~/.bashrc file.
  2. Create or edit ~/.aliases and make the first line “unalias -a”
  3. Add “alias .A=’vi ~/.aliases; .au'”
  4. Add “alias .a=’vi ~/.aliases.local; .au'”
  5. Add “alias .au=’. ~/.aliases'”
  6. At the bottom, add “[ -f ~/.aliases.local ] && . ~/.aliases.local || touch ~/.aliases.local”

Run “. ~/.aliases” once and you’ll have some handy ways to manage aliases.

  • .A lets you update the main set of aliases, which can be synced to other systems
  • .a lets you update aliases specific to this computer and override the main aliases
  • .au lets you easily reload your aliases after an update

We also discussed the && and || in the command in step 6.  The exit status of the command “[ -f ~/.aliases.local ]” is evaluated by the && and either runs “. ~/.aliases.local or fails.  The || evaluates the previous command and runs “touch ~/.aliases.local” if the previous command failed.  The easy way to remember this is that && and || work like if/then/else., as in these examples:

cmd && echo Success || echo Failure
if cmd
then echo Success
else echo Failure
fi

Several of us are viewing and enjoying the Python for Everybody course based on the PY4E book by Dr. Chuck.