Saturday, October 25, 2014

Mount Windows Filesystem From Linux


How to mount a windows drive through the administrative share from linux.

$ sudo mount -t cifs <windows hostname>/<drive>$  -o username=<user>,password=<pwd>,domain=<domain>  /<mount-point>

Monday, September 8, 2014

Share VBox Folder With Linux

First you need to create a Transient or Machine Folder within VirtualBox "Settings > Shared Folders" for the specific VM you would like to enable shared folders for. Make sure to remember the name of the folder, for our example we'll use the name "temp" pointing to "c:\temp". Next, from within the linux OS command line you would create a mount point and mount it as so

$ mkdir /mnt/temp
$ sudo mount -t vboxsf temp /mnt/temp

Once you are done sharing files you can unmount the folder by doing the following:

$ sudo umount /mnt/temp

Friday, April 11, 2014

Get IP on Linux

Today I needed to get the ip address as part of script to configure the "/etc/hosts" file. The command to get the IP is a one line command:

$ ifconfig | grep 'inet addr:' | grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1 }'

Thats all it takes to get the IP address(es) of the current interfaces excluding the loop back adapter. Other variants of *nix and windows may require different commands.

Wednesday, April 9, 2014

Get rpm and dependencies

On RHEL/Centos you need to install "yum-utils" first.

$ sudo yum install yum-utils

Then you can download an rpm and its depdencies by doing the following:

$ sudo yumdownloader --resolve <rpm name>

Then, you can transport them to another computer with a USB drive.

Sunday, April 6, 2014

Add RSpec

I need to add the rspec gem to my ruby project. How do I do that?  Can I do this from the command line or do I need to open a file? Looks like I need to open my "gemspec" file and add the line:

spec.add_development_dependency "rspec"

Then, I can install the gem through bundler from the command line:

$ bundle install

Next, add a directory structure and spec files.

[project]/spec/spec_helper.rb # Reference code in ../lib
[project]/spec/[gem name]/actual_spec.rb # Relative reference to ../spec_helper.rb

Now you should be able to run rspec from the command line:

$ bundle exec rspec actual_spec.rb