MagicMirror² v2.13.0 is available! For more information about this release, check out this topic.

Simplifying the live on the bash command line



  • Setting up a MagicMirror² on a Raspberry Pi isn’t too difficult using the installer script from @sdetweil . The more difficult part is selecting which modules to install and then configuring them.

    I’m not a command line guru, so the hopping back and forth between the config, modules and css directory feels like a lot of work. So to ease the stress on my keyboard, I created a .bash_aliases file with some useful aliases. These aliases make my life easier, and I hope for you as well.

    Currently I’m using the following aliases:

    • cdMM => change to the MagicMirror directory
    • cdMMC => change to the config directory
    • cdMMM => change to the modules directory
    • cdMMS => change to the css directory
    • viMMC => open the config.js in vi
    • edMMC => open the config.js in leafpad via X forwarding.

    My .bash_aliases file can be found on github: https://github.com/MoreLinuxDev/MagicMirror-bash-aliases

    I hope I setup the repository correctly as this is my first one on github.



  • @MoreLinux if u have windows, then get the bitvise ssh client. It will give u ssh and a windows explore type view of the pi file system. Double click to edit, navigate etc.
    Can Drag drop files between PC and pi, either way.

    U didn’t have to BE in the folder to edit a file there, nano …/…/config/config.js for example, from a module folder edit config.



  • @sdetweil , I haven’t been running Windows on my home pc’s and laptop since the late 90’, I’m didn’t know about bitvise. Will check this out for my work PC.

    Most of my Raspberry Pi’s are running headless, and for those ssh and vi are mostly fine as they need little attention, but two week ago my SD card in the MM died, so I had to setup a new one. A restore of a backup would have made things much easier, but … the backup … yeah … was still on the to-do list 🙂 … So I had to setup a system from scratch and that’s a lot of work, and that’s the reason I came-up with the aliases list.

    Also I now setup the PI to have as little as possible writes on the SD with the method I written down in this topic: https://forum.magicmirror.builders/topic/11513/dead-sd-card-every-aprox-6-months/10

    I’m also thinking to setup a github repro for my MM config.js and custom.css file. With these files stored on github, I can easily track back which modules I have installed and layout changes I have performed.

    Mental note 1 … always make a backup of all critical files!
    Mental note 2 … keep the MM working, because the wife who didn’t want the stupid thing in the first place, now was telling me to fix it ASAP because she now didn’t know what to wear due to the missing weather info.



  • @MoreLinux said in Simplifying the live on the bash command line:

    didn’t know what to wear due to the missing weather info

    the law of unintended consequences!!!

    ok, I use nemo as my file manager under ubuntu, and it shows the pi drives on a;ll 5 systems i open ssh connections to…

    similar to what bitvise did…



  • Most distributions add at least some popular aliases in the default .bashrc file of any new user account. These are simple ones to demonstrate the syntax of a Bash alias:
    alias ls=‘ls -F’
    alias ll=‘ls -lh’



  • @barryallen1337 true, but in the .bashrc on Raspbian, not that many are there. Also editing the .bashrc is something you can do, but those changes might end-up throwing update problems that need to be merged. This is due to the changes made in the .bashrc file.

    To have a smooth ride during updating the Raspbian OS, it better to use the .bash_aliases file. This file, if it exists, is read by the .bashrc and your aliases are activated. The .bash_aliases is read at the end of the .bashrc file, so your aliases are always created last what means the aliases work the way you set them up.


Log in to reply