Showing posts with label bash. Show all posts
Showing posts with label bash. Show all posts

Sunday, 23 March 2014

Speed Up Your Browsing with Profile-Sync-Daemon

What if I told you that you could greatly speed up your browser while reducing the physical wear on your hard drive?  You'd call me a daft bugger I'd bet!  :-)

I found this application some weeks ago and recommend it, profile-sync-daemon on the AUR.  It symlinks your browser profile to /tmp which is a tmpfs (running in RAM), so the large amount of disk I/O that it generates is now in RAM rather than on your disk.  This is great for HDD as well as SSD - with speed increases up to six times taster. It supports a wide range of browsers including:

  • Chromium
  • Firefox
  • Google Chome
  • Midori
  • Opera

Very easy to install, just edit (as root).
    /etc/psd.conf
Setting USERS to a space delimited list of user accounts on this machine.
    USERS="jeff"
Close your browsers, then enable and start it in systemd.
    systemctl enable psd
    systemctl start psd
You can see what just happened with parse.
    profile-sync-daemon parse


Saturday, 8 March 2014

Testing if an Application Exists in Bash

Some of my Bash scripts need to be used on various systems I use.  It is very common to call other command line tools that do some job or another, from these scripts.  Sometimes I am forgetful (big surprise!) and forget to install these required applications.

So I use a simple function to check that these other applications exist, returning true or false.



Now you use the function, placing your call below the code above.  This example exits the script if the application is not found.


Saturday, 15 February 2014

Updating Arch - My Way

I like to script a lot of the repetitive jobs I do (and what geek doesn't?).  One of those jobs is the updating of Arch Linux packages.  Check out this simplistic bash script.



I use aurget, as it has similar syntax with pacman.  And I'm using Reflector to grab the fastest mirrors.  Script will run without these packages installed.

Tuesday, 11 February 2014

My Favourite Git Alias

I use this git alias every day, a number a times a day.  Unfortunately I don't know where I originally found it, as I did not create it, I did update it a little to my needs.

In your projects .gitconfig or your home folders ~/.gitconfig add this (just add the lg line to the [alias] section to an existing file) :


I don't have a project, that includes a lot of branching, that I am able to show you - I do have a flat project of my own that gives you an idea of what the output looks like.


If you have some great git command line tricks, please toss them my way - I live in a version control world!

Doesn't that look better than git log:

Friday, 7 February 2014

Updated Your Bash Shell in OSX

Are you a Bash shell user on OSX? (by default you are!)  Well, did you realize that Bash is at version 3.2.51 on Mavericks, 10.9.1?   I hit a wall when I realized some of my dotfiles were not going to run as expected with this older version.

No worries - since I use the fantastic Homebrew package manager for OSX, installing Bash 4.2.45 was a simple:
    brew install bash
Thats not the end of the story though.  Now you have to change your login shell on OSX.

First step after installing is to edit /etc/shells, and add /usr/local/bin/bash to the top of the list:
    sudo vi /etc/shells
Being a nerd, you know you can just to change your shell:
    chsh -s /usr/local/bin/bash
Or you can go to System Preferences, then Ctrl-Click on your Users & Groups user profile (ensuring screen is unlocked):


And finally, after selecting Advanced Options, just change the shell to /usr/local/bin/bash:


If you want to be sure it worked, just do this in a new terminal:

    echo $SHELL



Monday, 3 February 2014

Easy Bash Colorization

I like things simple - if they are hard, I like to make them simple.  Take my bash prompt (PS1) I want it to have colour, be easy to change (and mess around with), and well as show me if I'm on a remote machine (as I will tend to do a few dozen times a day).  I also put it into its own file, which I call .bash_prompt and to be called from .bashrc or .bash_profile.

So here is my .bash_prompt file:



Edit to your personal preference then run:

    source ~/.bash_prompt