Access to the console still useful when no other mean

(this is more like a how-to for improving console usability)

I’d like to share my own experience with regard to local access to the console and its usefulness in some occasions.

One of the Veros I bought is installed at my parent’s house with no other computer than the Vero itself. So, I have to use the Vero to transfer movies from my own hard drive to the other one permanently connected to the Vero. I could bring my laptop and connect that drive to it, but travelling with a tiny portable drive is far more convenient. I can’t SSH into their Vero either, since they’re not connected to the Internet. I know the transfer rate through Vero’s USB ports isn’t great (the Vero was not understandably design for that), but still decent and fair enough for transferring HD movies, documentaries, music, etc. I’m not in a hurry and starting an overnight file transfer to refill a whole drive is not a problem for me.

As a result, I decided to bring some comfort while in the console:

  • mc file manager is obviously a good choice for me. I use it often when on remote machines, and hence a natural choice for me (note there are plenty of other file managers for the console). I’m also aware of another topic in connexion with Midnight Commander. Since it was a feature request, I didn’t extend the thread there.

    Install:

    $ sudo sh -c 'apt-get update -y && apt-get dist-upgrade -y'
    $ sudo apt install mc
    

    Configuration file location: /home/osmc/.config/mc/ini

    (no special configuration required)

  • tmux (like its screen friend) is excellent for three things (in the case of Vero):

    • It enables screensaver for the console after some idle time. For example, no keyboard interaction during long file transfers in mc (although one could still engage in a new virtual console by opening a new tmux window or pane, if necessary).

    • It allows file transfer at the same time using Kodi! The latter brings serious flexibility as leaving the OSMC console to come back to Kodi won’t break the current tmux session as tmux virtual consoles are not tied to the OSMC Bash console, but to the tmux server instead:

      $ pstree osmc
      bash───tmux: client───sh───cmatrix
      
      systemd───(sd-pam)
      
      tmux: server─┬─bash───bash
                   └─bash───mc───bash
      
      udisks-glue
      
    • It allows copy-and-paste—C-b + [ to enter scroll mode, spacebar to select, enter key to copy, and C-b + ] to paste—and a enhanced search mode with plug-in tmux-copycat.

    Install:

    $ sudo apt install tmux
    

    Configuration file location: /home/osmc/.tmux.conf

    Minimum configuration:

    new-session -s "OSMC" "neofetch; cd /home/osmc; bash -i"
    rename-window "Welcome!"
    
    # unix.stackexchange.com/a/17118
    new-window -t OSMC "cd /mnt; mc; bash -i"
    rename-window -t OSMC "File Manager"
    
    select-window -t OSMC:Welcome!
    
    # Screensaver
    # reddit.com/r/commandline/comments/2050gi/screen_saver_for_your_terminalshell
    set -g lock-after-time 300 # seconds
    set -g lock-command "/usr/bin/cmatrix -bx -C blue"
    

    Now, put the following in your /home/osmc/.bashrc file:

    export TERM=screen # (if linux, cursor is hidden again after exiting vi editor)
    
    # linuxgazette.net/137/anonymous.html
    # unix.stackexchange.com/a/92743
    echo -e '\033[?17;0;64c' # To render the cursor visible (red colour)
    
    # unix.stackexchange.com/a/306165
    #[ -z "$TMUX"  ] && { tmux attach && exit; }
    # To exit the OSMC console after detaching from the tmux session.
    # Dangerous in case of problematic .tmux.conf configuration file:
    # logging in to the OSMC console is no longer possible!
    # Use shift key at boot to fix the issue.
    [ -z "$TMUX"  ] && tmux attach
    
  • cmatrix is the screensaver I use, but there are plenty of other ones: pipes, TermSaver, etc. There’s a Reddit discussion on the topic.

    Install:

    $ sudo apt install cmatrix
    
  • neofetch is used for the welcome screen after logging in to the console. It’s much more friendly. Get the latest release: https://github.com/dylanaraps/neofetch/releases/latest

    Install:

    $ unzip neofetch-6.1.0.zip
    $ cd neofetch-6.1.0
    $ sudo make install
    

    Configuration file location: /home/osmc/.config/neofetch/config.conf

    Uncomment what you’d like to see.

    Especially useful for me:

    info "Disk" disk
    disk_show=('/' '/mnt/Inateck') # replace with your drive name
    

The end result:


tmuxConsole

4 Likes