Posts Tagged ‘sys-admin’

Python: How to Install and Update pip on Ubuntu

Surprisingly, pip doesn’t come pre-installed on Python 2 or 3 in Ubuntu (as of v 14.04). This could be untrue in some flavors of the distro, but mine is pretty inclusive and yet no pip.

To install it:

$ sudo apt-get install python-pip python-dev build-essential
$ sudo pip install –upgrade pip
$ sudo pip install –upgrade virtualenv

tux

Windows: Generate a List of Installed Programs

Enter “wmic” (wmic is the Windows Management Instrumentation

term

Command-line tool) at the command line and press Enter.

NOTE: For more information about WMIC, see Microsoft – Using the Windows Management Instrumentation Command-line (WMIC) tool.

Enter the following line at the wmic:root\cli prompt and press Enter.

/output:C:\Users\jmiller\InstallList.txt product get name,version

NOTE: There is a space between .txt and product, between product and get, and between get and name.

You can also change the name of the output file and drive letter and path (right after /output:) if you want to modify the output location.

term2

The InstallList.txt file is created on the root of the C: drive.

NOTE: Depending on how many programs are installed, you may have to wait a bit for the list of installed programs to be created. You will know that the list is complete when you get the wmic:root\cli prompt again.

3

When you open the InstallList.txt file in a text editor, you can view the Name and Version of every program installed on your computer in a nice table.

Quick Tip: IPTables port forwarding in 1 Line

iptables -A PREROUTING -t nat -p tcp -i eth0 –dport 88 -j DNAT –to 192.168.1.2:22

Quick Tip: Erase a drive (insecurely) in 1 Line

sudo dd if=/dev/zero of=/dev/sdx bs=512 count=1
where sdx is the drive you want to zero (this is an INsecure wipe)

Quick Tip: How to Free Up Resources for Big Data Scripts in Linux by Checking Processes, Killing Duplicates, Tailing Log

ps -ef
sudo kill -2600 1982 999
tail -f myscript.log
Where “2600”, “1982”, and “999” represent the PPID’s you wish to kill, which you looked up with the ps -ef command.

Optionally filter the process list by changing the first command to:

ps -ef | grep -i keyword