Ubuntu & Bash tutorial & basic utilities

An introduction to the CLI (Command Line Interface) and Bash on Ubuntu Linux aka a bash tutorial The default shell that is installed on Ubuntu Linux is bash. Alternatives exist, but they’re beyond the scope of this tutorial (check our post here for more info on how to isntall a better alternative to bash called Zshell or zsh). Bash is available on almost all Linux distributions, so this tutorial will work on most Linux distributions as well. What is a shell? Simply put, the shell is a program that takes your commands from the keyboard and gives them to the operating system to perform. In the old days, it was the only user interface available on a Unix computer. Nowadays, we have graphical user interfaces (GUIs) in addition to command line interfaces (CLIs) such as the shell. Bash is the most popular shell application for Linux, and is the default on Ubuntu and hundreds of other Linux distributions, Mac OS X, and soon Windows 10. The basics are: You type one or more command(s), hit enter, and it runs the command(s). Use the up/down arrows to go through your bash history. Ctrl+P also works Use Ctrl+R to search the history of commands used previously. Hitting tab will autocomplete commands. Instead of typing cd ~/myfolder1/ you can just type cd ~/my<tab> and it’ll either autocomplete fully or if there are still more folders (like my234 and myfolder1), it’ll show you your options. You can enter multiple commands by separating them with “;” or “&&”. ; allows commands […]

Why you should switch to ZShell ( zsh )

Why use ZShell It has some amazing features, but right out of the gate in no particular order: Context based tab completion that puts most others out there to shame. Shared history among tabs. Dynamic Load modules Spelling correction that out performs most others out there. Globbing that works on magic. I am positive of this. Themes that work wonders, there are tons of them out there and they fit everyone’s needs or just write your own! Global aliases I’m going to be an elitist and say bash is for the cavemen 😐 any machine you have a personal user account on: install zsh. life just became pretty… and pretty awesome. why zsh? well its powerful and configurable…. its awesome! and you can change a LOT about it and extend it via plugins. sudo apt-get install zsh curl git-core ruby wget –no-check-certificate https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O – | sh this should switch you to zsh and install an awesome script for zsh. if not then do the next two steps. They can be repeated at will. Note where your zsh is, most likely /bin/zsh. which zsh chsh After that comes customization time! yay… etc. (pick a theme, I prefer dallas so) edit ~/.zshrc ZSH_THEME=”dallas” Heres my plugins, you can remove the ones you dont need plugins=(git ant cpanm debian github mercurial node npm svn) Install rvm : user$ bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer ) add the following to your ~/.zshrc [[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm more to come later.[/et_pb_text][/et_pb_column][/et_pb_row][/et_pb_section]

Alsa CLI Volume control

I couldn’t find the silly volume control in the system settings one day so i figured there had to be something I could use to control volume settings like mic boost without needing a gui or remembering names and numbers for the CLI. well there is and it’s so easy a caveman could do it (hah remember those ads….)…. so without further ado here’s a fun and great way to control your volume via Alsa CLI Volume control. type the following then use your arrows to move right/left and make the volume higher or lower by using up/down keys: alsamixer -c 0 the 0 at the end is the number of your device. if a system only has one device you will use 0. if you have two devices you can use 0 or 1. it tells you the name of the device currently being edited so you don’t give yourself a heart attack by changing the wrong volume. picture of the control is attached.   [et_pb_section admin_label=”section”][et_pb_row admin_label=”row”][et_pb_column type=”4_4″][et_pb_text admin_label=”Text” background_layout=”light” text_orientation=”left” use_border_color=”off” border_color=”#ffffff” border_style=”solid”] [/et_pb_text][/et_pb_column][/et_pb_row][/et_pb_section]

Letsencrypt ssl cert for mumble

I needed to set up a mumble server for a friends minecraft community. The Mumble software uses a client–server architecture which allows users to talk to each other via the same server. It has a very simple administrative interface and features high sound quality and low latency where possible. All communication is encrypted to make sure user privacy using either a self signed cert or a cert purchased via a vendor. The great thing about Mumble is that it’s free and open-source software, is cross-platform, and is released under the terms of the new BSD license. Since letsencrypt is awesome and provides completely free certs to the end users, I figured it would be perfect to use in this attempt.  So I started on the road to acquire a letsencrypt ssl cert for mumble. First we need to acquire the letsencrypt client. for this you need git. git clone https://github.com/letsencrypt/letsencrypt cd letsencrypt ./letsencrypt-auto certonly –standalone –standalone-supported-challenges tls-sni-01 A text / curses bases dialogue will start. it will ask you to input your domain(s) you want a cert for. If you want multiple domains or multiple subdomains at the same time just separate them via a space or a comma, follow the prompts and it will install your cert in /etc/letsencrypt/live/<domain>/cert.pem. So far so good! now you need to install murmur/mumble-server on your machine. I would like to tell you how to do it but due to the nature of software it might change, the best way to do it is via checking the official mumble wiki for info […]

Remove spaces from file names via bash

if you need a simple way to remove spaces from file names and replace with an underscore or a hyphen or whatever else here is a bash one liner. You can also do this via python or perl or most likely via php (why? o.0) but since bash / zsh is here and readily available for me I choose to use bash / zsh. Remove spaces and replace with underscore: find /tmp/ -depth -name “* *” -execdir rename ‘s/ /_/g’ “{}” \; remove spaces and replace with hyphen : find /tmp/ -depth -name “* *” -execdir rename ‘s/ /-/g’ “{}” \; Remove spaces completely: find /tmp/ -depth -name “* *” -execdir rename ‘s/ //g’ “{}” \; Be careful with he above as it will remove all spaces from file and directory names. hope this helps. if you have a better way of doing it comment and let me know 🙂

Linux HP Smart Array Raid Controller

A client has a machine in a DC that has a raid controller and 4 hdd’s set to raid 10, that’s all I was told. I wanted to keep an eye on the hdds, so I needed to install a utility that can monitor and interact with the raid controller.  In my case I have the hp smart array raid controller as you will see in just a bit, you may have a different controller from this one by a different manufacturer, or it may require a different version of the software tool from HP, please check on the HP site linked below before continuing on. There is a chance of serious data loss if you don’t follow common sense practices and MAKE BACKUPS. I needed to do a few things, find out which controller is it, find latest of control utility for it, install said utility and then check on the drives. that isnt always easy, sadly. First we check who makes this system. dmidecode | grep -A3 ‘^System Information’ Sample result: System Information Manufacturer: HP Product Name: ProLiant DL160 G6 Version: Second we check lspci to see what controller we have installed. lspci -k|grep -i -A2 raid Sample Result : 04:00.0 RAID bus controller: Hewlett-Packard Company Smart Array G6 controllers (rev 01) Subsystem: Hewlett-Packard Company Smart Array P410 Kernel driver in use: hpsa Now we know we have a HP machine, DL160 G6 to be exact in this case, and the exact rev of the card itself. We need to install the HP provided software for it.  The […]