Posts

Bash One-Liners for Ping

Image
Here are a few notes to add to the previous article on ping. This time, we look at some bash one-liner tips and tricks. Combine multiple commands Return Values Ping Multiple Hosts Using Bash Nmap and Fping Ping, and Command Line Variables Start from the beginning. We want to see what happens when attempting to ping a host that resolves an IP address from DNS, but is not reachable from our network at the moment. This is to show how we might build a simple monitoring tool from scratch, and also to see what kind of fun we can have with the command line. To ping a host only one time use the count option, which in Windows is -n, and in Linux is -c. Windows C:\>set host=google.com C:\>ping -n 1 %host% Pinging google.com [216.58.219.46] with 32 bytes of data: Request timed out. Ping statistics for 216.58.219.46: Packets: Sent = 1, Received = 0, Lost = 1 (100% loss), Bash: Linux, Mac, Unix Note that in bash, we don't use the set command to assign a varia...

Git Quick Start

When attempting to learn new tools, such as git, or vim, it is easy to get lost in all the features.  Here is a quick start guide that focuses on the essentials for a single user to get started with a local git repo.  Working with a team, and advanced features can be added later. Git Quick Start Commands Git Core Commands git init git add . git commit -m “initial commit” Supporting Commands git status git log Remote Repository Commands git clone [url] git pull git push Git Notes on github goes into more detail https://github.com/systemnotes/gitnotes

Online Learning Resources

I recently started exploring online resources that my company provides for free to their employees.  I was pleasantly surprised to see all my favorite O'Reilly books on SafariBooksOnline, but also amazed at how much new technology has been developed over the last few years.  Areas that I thought I was very familiar with have suddenly shifted to include new tools, and new ways of doing things with cloud, big data, automation, and all kinds of new Apache products. Check to see if your company provides free subscriptions, and then have a look at some of these resources: Paid Learning Sites http://www.safaribooksonline.com -- Huge selection of technical books http://www.pluralsight.com -- High Quality, from overview to advanced topics for programmers http://www.lynda.com -- High Quality, some topics are not very advanced, but courses are very well done When discussing career development ideas with my colleagues, I usually recommend training courses, or books, o...

How to Protect Online Activity

Introduction to Online Security, Internet Privacy, Anonymous browsing.   As an honest hard-working citizen, you may think you have nothing to hide, but at the same time you may be annoyed with intrusive advertizing, or you may be concerned with the ability of hackers to see your bank accounts, or for governments, foreign or domestic to watch what you do online. Advertising Some people are surprised to see ads shortly after visiting a website.  For example, suppose you want to check the price of flights to Seattle, just out of curiosity to compare prices to different cities, but with no intention of ever going there.  Then, you notice over the next few days, that there all kinds of advertisements in your browser for flights, or hotels in Seattle.  Then you wonder how did those advertisers get the crazy idea that I might be interested in going to Seattle?  Or why do I keep seeing ads for something in which I have no interest?  That is tracking te...

Get a List of rpms for a Specific Program or Version

Image
Systems that use rpm as the package manager can often be managed by using yum, but sometimes a simple rpm command can quickly give the required information. The RPM Package Manager has a huge number of options, but most commonly only a few are used on a regular basis. Get a list of rpms for mysql-5.1   Check for mysql version 5.1   $ rpm -qa |grep mysql | grep 5.1 mysql-test-5.1.52-1.el6_0.1.x86_64 mysql-connector-java-5.1.12-2.el6.x86_64 mysql-bench-5.1.52-1.el6_0.1.x86_64 mysql-server-5.1.52-1.el6_0.1.x86_64 mysql-connector-odbc-5.1.5r1144-7.el6.x86_64 mysql-5.1.52-1.el6_0.1.x86_64 mysql-libs-5.1.52-1.el6_0.1.x86_64 mysql-devel-5.1.52-1.el6_0.1.x86_64 Of course we can use egrep, and sort to get a more specific list $ rpm -qa |egrep -i "bash|ntpdate|httpd"|sort bash-4.1.2-8.el6.x86_64 ntpdate-4.2.4p8-2.el6.x86_64 xargs - build and execute command lines from standard input Now suppose we want to remove all the rpms found by the rpm query. Sometimes we can ...

Use awk to Extract a Column from a Text File

Image
Here is an example of how to use awk to extract a column from a text file. The default field separator is a space, so this will work with some text files:    cat somefile.txt | awk '{print $2}' But, if the fields are separated by a delimiter, such as tab, or comma, just specify the field separator by using "-F" before the print statement    cat somefile.txt | awk -F"\t" '{print $2}'   Unix and linux distributions generally come with sed and awk, among other things. The problem. You want to get a list of companies to research before investing in them, and paste only the stock symbols into a Yahoo finance portfolio.   You run a stock screen on a site such as  magicformulainvesting.com , or investors.com but if you try to paste the text into a spreadsheet it may show up as a single row, with no way to extract the column. Here is the process 1.)  Run a Stock Screen Get output similar to this: Company Name (in alphabetical...

Free Tax Preparation Software

Image
At SystemNotes, we love free software. Especially when it is Open Source (source code is readable and may be freely modified by the end users), and available on different platforms (Linux, Mac, Windows, iPad, Android, etc.). When preparing tax returns, many people turn to paid software, or tax professionals. There's nothing wrong with paying for a useful service or software, but linux geeks often turn to shell scripts, or whatever open source software they can find before shelling out any cash -- no pun intended. Here are some useful tools for preparing the US 1040 tax return and most common schedules: Open Tax Solver If your needs are simple, Open tax solver is quick and easy. There are even options for some state taxes. Open Tax Solver http://opentaxsolver.sourceforge.net There is a simple interface that takes inputs, and when finished, just click "Compute Tax." for the results. Microsoft Excel Spreadsheet Income Tax Calculator If you prefer to ha...