Things you need. Things you don’t need

November 25th, 2015

First thing is first. I’m not saying 100% that what I’m about to say is correct for everybody, but these are observations so far that I have had with our child as far as what I feel we absolutely need and what we don’t need.

The Needs

The list of items that either we use all the time or are awesome to have when you really need them. Also included, are some cost saver things

Read the full post…

Creating a cheap internet proxy

June 12th, 2015

Often times you may find yourself in the need to get to sites that are unavailable for one reason or another. You can easily achieve this via the powerful SSH protocol’s ability to proxy your connections.

Read the full post…

Keeping your GitHub fork up-to-date

December 24th, 2014

While this may seem trivial to those that have been working in a GitHub workflow for a while, I’ve just recently been working with others through GitHub and have had to learn how to do this.

So you start with either of two scenarios:

  1. You cloned the original repository to your local machine
  2. You cloned your fork of the repository to your local machine

Regardless of which scenario you start with, you need to end up with 2 remote branches:

  1. origin, which points to your forked GitHub project
  2. upstream, which points to the original GitHub project

So to normalize so we end up with these remote branches

If Scenario #1

git remote rename origin upstream
git remote add origin

If Scenario #2

git remote add upstream

Alright, moving on…

So any time the upstream(original) project changes you will need to synchronize your fork on github(even after you are the one that submitted the pull request and it was merged)

To do this you should be able to issue the following commands

git remote update
git rebase upstream/master
git push origin master

So essentially you are telling git to fetch all of your remote branches, then you are applying all changes from the upstream/master branch to your master so that both are in sync. Then you push your master up to your fork on GitHub. At the end, all 3 repositories’ master branches(local, fork, original) will be in sync.

This does assume a few things especially that you do your edits in separate branches and that your local master branch is the same as your origin/master. This is the typical development workflow(I think).

The Hack

July 4th, 2014

Maybe you noticed, but most likely you didn’t, but and were down for a while. Tygertown was only down for about 5 hours but Melanie’s site was down until today.
Read the full post…

SmartCard Authentication

July 1st, 2014

I had the pleasure recently of having to figure out how to get SmartCard(CaC) authentication up and running on our Red Hat workstations. The workstations are mostly STIG’d already, but now they required us to get CaC authentication up and runnning. I was happy really to do this as it removes the rediculous additional password that I have to remember and also do not have to try and keep 20 passwd/shadow/group files in sync.

Hopefully this will help somebody configure this as well. There are quite a few steps but once you get it configured at the end I show you how to save the config which you can very very easily deploy to other workstations. It takes us about 5 minutes now to do a workstation from scratch!
Read the full post…

Tricksy Little Variables

April 18th, 2014

Last week we reviewed a bunch of Linux commands. This week we will go over bash variables and all the fun things that you can do with them.

First, we will need to explore a bit about how to use the basics of bash variables. As in any programming language, variables hold values or hold a list of values called an array. That is the basics.

In bash variables have two forms for when you want to access and when you want to set the value of them.

Setting Variables

When you want to set the value of a variable you just name the variable with an equal sign after it just like this

myvariable2="Text in quotes"

Just make sure you do not put spaces on either side of the equals sign

Accessing Variables

When you want to access the variable’s you have to put a dollar sign in front of the variable name

echo $myvariable
echo $myvariable2
echo ${myvariable}

Would print the values of both variables to the terminal. Notice you can also put {} around the variable name which I almost always do because it removes problems when you try to do something like

echo $var1more/path/stuff
echo ${var1}more/path/stuff

In the first echo statement bash has no way to know that the variable name is var1 and not var1more. So if you wrap it in {} you don’t have to worry about that issue any more. You will see later that the {} also allows you to do some other fun things.


For the longest time I really didn’t know what the heck the export command did. Then I did a little research on it and it is pretty straight forward.
When you set a variable normally by just doing something like

var1="Some Text"

This variable is only available to the shell you are in. So if you then try something like this

python -c "import os; print os.environ['var1'];"

You will get a KeyError exception that variable does not exist. This tells you that when python executed that command in it’s own process, the environment of that process did not contain the variable var1

The export command makes a variable available to the current shell and all child processes. Aka, any program that you execute from the shell you define the variable in will have access to it as well.

export var1
python -c "import os; print os.environ['var1'];"

This prints Some Text now !!!


Arrays are simply variables that have multiple values. That is, a list of values that you assign to a single variable name.
Arrays are assigned in a very similar manner.

arr=( value1 value2 value3 )
arr2=( $(ls) )

There are many ways to create an array. These are just two. The basics of creating an array is that you put parenthesis around the values. I think of it as telling bash to do a split on the values or something.
Anyways, how do you get the individual values out of the array? It is very similar to regular variables. If you are familiar with arrays then this will be nothing too new.

echo "First item of the array: ${arr[0]}"
echo "All items of the array: ${arr[@]}"
echo "Number of items in array: ${#arr[@]}"

Try it out. Poke it a bit. See how you like it.

String Manipulation

Because text processing is possible the most fun thing to do, here are some quick ways to play around with variables that contain strings as their values.

Here is our example string


String Length
Same as array length(Not surprising since a string is essentially an array of characters)

echo ${#mystr}


echo "${mystr:0}" # A
echo "${mystr:0:2}" # AB
echo "${mystr: -3}" # txt

Removing Portions of Strings
Honestly, I would be lying if I didn’t say I had to look these up almost every time I use them.
Here is where I get the info from

Think of the # and ## as the operators that remove from the left
## Removes as much as it can of the substring on the right side of it as it can
# Removes the shortest match
This is confusing. It is ok. Just skim over it and know it is possible and don’t give up trying to get it to work

echo "${mystr##*.}" # txt

Think of % and %% as the operator that removes from the right. I often use these to remove file extensions and the like.

echo "${mystr%.txt}"

String Substitution

It exists. I just found this out while reading through this
So so very awesome. Before I was always using sed in a subshell to do this. Bash is so awesome!
I used to do this

mystr=$(echo $mystr | sed 's/.txt/.csv/')

but now I can do this


This just made my day! I’m so gitty right now.
I’m probably forgetting some other fun things, but time is ticking away. Go forth and explore

How many commands can you memorize

April 11th, 2014

Friday Linux is something I started doing at work for people to get used to the shell environment. I started writing these on our wiki at work, but decided to move them to the web since they are general enough. I will post up the other ones I have done later, but for now, here is today’s Friday Linux

This topic is to simply get you acquainted with what commands are available in the bash shell so you know what is available
Just a simple list more or less

Just remember this is just a list to get acquainted. You should investigate the ones that look interesting to you by experimentation and also using the man pages.

The List

  • ls
    • List permissions, size and what not of file. If you select detail view in Windows explorer you would get something similar(but ls has much more goodies too)
  • cd
    • Change directory. cd /path/to/something
  • rm
    • Remove command. rm -rf is the command that removes directories and files inside of those directories
  • ps
    • Process list. Typically use ps -ef to show all processes
  • grep
    • Search for text inside files or text streams
  • sed
    • Replace text inside of files or text streams
  • cat
    • concatenate files
  • echo
    • Print some text
  • touch
    • set access/modify timestamp on a file, but really useful to just create an empty file
  • awk
    • scripting language processor, but usually used to do things on text that is delimiter separated
  • xargs
    • Operates on line by line input and runs a command on each line…more or less
  • pushd and popd
    • Creates a stack of directories as you visit them so it is easy to go back to where you came from.
cd /; pushd /some/path; echo "Now I am in /some/path"; popd; echo "Now I am back in /";
  • chmod
    • Change permissions on file/directory
  • chown
    • Change ownership on file/directory
  • tar
    • Make archive. Like winzip, but better of course
  • ln
    • Create a hard or soft link(think shortcuts, but what is the difference between soft and hard links? Google away my friend)
  • mkdir
    • Create directory(mkdir -p is your friend)
  • ping
    • Check to see if another computer is alive
  • head & tail
    • Beginning and end of a file or text stream(try head -5 or tail -38. You can use any number for those commands after the dash to show that many lines)
  • rsync
    • The best copy command that exists in computing. No joke! Rsync not only copies files, but it essentially remembers exactly where it left off if it stops mid way through copying. I almost always use rsync instead of the cp command because rsync also has the –progress option which gives you status of how much is copied where cp is a pain to get get info like that.
  • find
    • Find files and/or directories. Many many confusing options, but find is amazing once you invest the time to figure it out
find /root/path/to/search -name "*.txt"
  • kill
    • Kill process. Probably use ps -ef | grep ‘program’ to get the pid field then use kill to kill it(or kill -9 to really really kill it with a knife and gun)
  • screen(usually requires being installed specially)
    • Don’t ssh and do analysis without learning screen or an equivalent. Screen essentially protects you from network outages
  • tee
    • Hard to explain if you don’t understand pipes, but tee allows you to output to the screen and also into a pipe at the same time
  • diff
    • Show difference between two text files
  • sort and uniq
echo -e '5\n7\n9\n3\n1\n6\n5\n9' | sort | uniq -c
1 1
1 3
2 5
1 6
1 7
2 9
  • wget
    • Download a file from the web
  • curl
    • Fetch anything from the web(ftp,http,https…) It is awesome. Try it out.

I’m just going to stop there. There are plenty more, but hopefully you are excited enough to explore and find some more that you can use. Sorry they are not in alphabetical order, just kind of dumped the list as I thought of them

Tyghe’s Favorite List:
If this excites you that I use VIM, that is awesome
If you are angered that I am not using emacs, that is awesome
Else figure out how to be excited or angered and fit into one of the above 2 groups

  1. rsync
  2. curl
  3. grep
  4. awk
  5. sed

Just remember, for the most part, any command that outputs can be piped into another command and so on. This gives you the power to do anything you can dream up.

Install Python for your Account in Windows

March 28th, 2014

Ever need to install Python for just your user account? Maybe you don’t have admin privileges or something to install it? Read the full post…

Redmine on Heroku

March 4th, 2014

Since this isn’t as easy as some posts make it here is how I got it to work:

Read the full post…

Backups for beginners

February 10th, 2014

It’s going to happen to you eventually. You are going to lose information saved on your computer. I’m guessing you have all of your data saved in a single spot. If you don’t good for you your one step ahead, but you can do more and it isn’t hard to do.

Eventually your hard drive is going to crash and burn. Especially if you have a laptop, you’re poor hard drive is just doomed at some point. It could be in a few years or it could be tomorrow or maybe before you are done reading this. Similar to how life operates you just never know when your ticket is up. Sure you can recover your data if your hard drive crashes, but it’s going to cost you and you just don’t know how much you will get back. Some of you may be thinking, well I have a second hard drive that I copy everything too so I’m set. Well you are really about 3/4 set in that case. How often do you copy your data to the second hard drive? What happens if you get a virus on your computer and it infects all of your files and you copy them over to your backup hard drive? Read the full post…