Tuesday, July 1, 2014

Useful Linux Commands

Useful Linux Commands

Linux

Disk space

Free disk space
  • df -k Mounted disk list 
  • df -h - shows disk free info 
  • du -sh - shows information about utilisation 
  • du -sk * | sort -n - what files/directories are using the most storage

What is taking up disk space?

  • find / -type f -size +100000k -exec ls -lh {} \; | awk '{print $5 ": " $NF}'

Find Folder size, sorted.

  • du * -sh | sort –nr

Remove specific files recursively

  • rm `find . -name '*.log'` -rf

Finding files
Finding files by filename
  • find / -name mystuff 
Note: this ignores symbolic links
Finding files by content


  • grep -H -r “the text” /home/tom 
Finding strings in file recursively looking through directories

  • find ./ |xargs grep -i StringToFind 
Finding the process that access a log file
  • fuser -m -u /var/log/logfile.log

Networking

What is blocking the local port?
  • netstat -tlnp | grep 50101
Finding the application that is using the port
  • lsof | grep 50101
Finding the application that is using the port
  • fuser -v -n tcp 80
  • netstat –i – list all the interfaces (including bonded interfaces)
  • netstat –s – summary statistics - dropped packets, retransmissions
  • netstat –l – show listening sockets - who’s got what port open
  • netstat –t – show active connections - who’s connected
  • netstat –r – show the routing table used by the kernel - what routes are currently loaded
  • ss -no state established '( dport = :8999 or sport = :8999 )' - who is connected to/from port 8999
  • ss -pmn (processes, memory, numeric – don’t resolve) (su to pricing) - show the process and memory info of each socket
With this command and its different options one can obtain statistics as well as configure any network adapter connected in the system.
  • ifconfig [devicename] [reqd. action] [options] :
example : To assign IP Address to a network adapter.
  • ifconfig eth0 192.168.1.1
whois [options] <arg[@server]> : Queries the WHOIS database, to retrieve available information about the given server / domain-name. example : To obtain information about a domain, suppose google.com.
  • whois google.com
ping [options] [host-address/name] : This command sends Internet Control Message Protocol (ICMP) to the specified network host. example : To ping a network host "192.168.1.1"
  • ping 192.168.1.1
netstat [options] : Gives information about the all the network connections established by the system through different ports. -t : Displays only TCP socket connections -a : Displays all the sockets that is listening and non-listening ones For example :
  • netstat -a
traceroute [options] [host-name/address] : Displays identity of hosts visited by the packet while routing from its source to destination. -n : This option disables the DNS lookups for the IP Addresses example :
  • traceroute 192.168.1.1
route [options] [destination host-name/address] : Displays as well as allows to manipulate the IP routing table. -n : Displays IP addresses as by default hostnames are displayed example : The command below displays the numerical IP addresses in the IP routing table
  • route -n
telnet [options] [host] [port_number] : Does an interactive communication with another host through TELNET protocol on the specified port number. By default it uses TCP port number 23 and the connection is not encrypted. -l : specify user name to login as on the remote system example : To login into remote host 192.168.1.1 in username "abc"
  • telnet -l abc 192.168.1.1
ssh [options] [username@host-address] : Enables a user to make secure remote login to the specified host address. -C : Compresses the data which sent over the connection to specified host -X : Enables the user to use X server features. example : In order to ssh to host 192.168.1.1 with username "abc" following is the command.
  • ssh -X abc@192.168.1.1
scp [options] [username@host-address:file_location] : Enables a user to make secure copy of the file to the specified host-address. -r : Recursively copies the data in directories -C : Compresses the data which sent over the connection to specified host example : In order to scp file.txt to host 192.168.1.1 with username "abc" following is the command.
  • scp file.txt abc@192.168.1.1:~\
wget [options] [URL] : Performs HTTP request from through the shell to get data from the URL -r : Get the URL and all its links in recursive manner
  • wget http://www.google.co.za

iptables [options] : This command requires root permission. It enables to carry out packet filtering and Network Address Translation. -F : Flush set of rules -n : Show rules without carrying out DNS lookups -A : Appends one or more rules to the end of the selected chain. -j : Specify the target of the rule -s : specify source -L : Current rules are listed For example : To block packets from certain IP Address 192.168.1.1, can be done by
  • iptables -A INPUT -s 192.168.1.1 -j DROP
tcpdump [options] : Outputs the contents of packets on the network interface. It can also output only certain packets based on the condition provided.
-i ether0 to select the interface you what to monitor
  • tcpdump -i ethe0

How To Find My Public IP Address From Command Line On a Linux

  •  dig +short myip.opendns.com @resolver1.opendns.com

Processes

  • top : The top program provides a dynamic real-time view of a running system.
  • mpstat : writes to standard output activities for each available processor. Repeat every second : "mpstat 1"
  • ps : Display all running processes (eg : to list java processes = "ps -ef | grep java" )
  • pgrep : Looks through the currently running processes and lists the process IDs which matches the selection criteria to screen
  • pstree : shows running processes as a tree
  • netstat : displays network connections (both incoming and outgoing), routing tables, and a number of network interface (network interface controller or software-defined network interface) and network protocol statistics (the very useful "-p" option is not allowed in PROD unless you're root)
  • htop : Show all CPU running process (For mutilator CPU)
Find threads/handles for all users
  • ps -eLf 
Total counts on threads/handles for all users
  • ps -eLf | wc -l

kill

  • Never use kill -9 if you can help it
  • You can send any signal you like (use kill -l to list them) SIGUSR1 and SIGUSR2 are user defined. Each signal has a default action, e.g. to temporarily interrupt or to terminate the program

 strace - system trace

  • strace -p 25292 -f : trace pid 25292 in real time
  • strace -p 25292 -f -c : trace pid 25292 and report summary statistics on exit

How to use VI editor.

INSERT Mode

For adding text to a file  ( press Esc and then below command)  . The three most common ways to enter the Insert Mode are:
LetterAction
iStarts inserting in front of the current cursor position
IStarts adding at the front of the line
aStarts adding after the cursor
AStarts adding at the end of the line
oStarts opening a new line underneath the cursor
OStarts opening a line above the cursor.
<Esc>Gets out of Insert Mode

EDIT Mode

Generally for moving the cursor and deleting stuff.
In the Edit Mode, the keys do not type letters, but do other actions such as cursor movement, deletions, copying lines, etc.
LetterSimple Cursor Movement
hMoves cursor left one spaceNote: the Arrow keys do work locally, but sometimes mess up over a network.
jMoves cursor down one line
kMoves cursor up one line
lMoves cursor right one space
Fast Cursor Movement
wMoves the cursor a full word at a time to the right
bMoves the cursor back to the left a word at a time
^Moves the cursor to the front of a line
$Moves the cursor to the end of a line
<ctrl>fMoves the cursor forward a full page of text at a time
<ctrl>bMoves the cursor backward a full page of text at a time
Modifying Text
xDeletes the character under the cursor
ddDeletes the line where the cursor is located (type d twice!)
n ddDelete n consecutive lines ( n is an integer)
rReplaces the character under the cursor with the next thing typed
JJoins current line with the one below (Capital J!)
uUndoes the last edit operation
<ctrl> rRedo (Undoes the last undo operation)
Cut and Paste Operations
yyCopies or yanks a line ( 5yy yanks 5 lines)
pPuts the yanked text on the line below the cursor (lower case p)
PPuts the yanked text above the current line (capital P)
Note: If vi is already in the input mode, text from that or another window may be highlited using the left mouse button, and copied into place by pressing the middle mouse button.

COMMAND Mode

For interacting with the operating system. To enter the Command Mode, a colon “ : ” must precede the actual command.
LetterAction
: r <file>reads a file from disk into the vi editor
: w <file>writes current file to disk
: wqwrites the file and quits vi
: q!quits without writing (useful if you’ve messed up!)

Saturday, May 24, 2014

After a wonderful day at the SA AMSAT satellite symposium I have learned the following.

After a wonderful day at the SA AMSAT satellite symposium I found the following very interesting. (24May2014)
http://www.amsatsa.org.za/
  1. KLETSkous the 1U Cubesat build by volunteer Amateur Radio operators.



The planned payload for KLETSkous will be as follows.

  • A Linear transponder (2m uplink and 70 cm downlink)bandwidth of 20 kHz
  • Currently the frequencies in the 435.100 to 435.140 MHz range are considered for the uplink and 145.860 to 145.980 MHz for the downlink
  • The scientific payload will be a experiment analysing "Worm Holes"  (This experiment will try and find the portholes between Sun and Earth).
  • There was a live Transponder demo and a prototype of the space frame.


More information is available at http://www.amsatsa.org.za/



2) A presentation on the progress of the experiments on ZACube-1 was also very interesting.
ZACUBE-1 Cube sat Picture

  • Very nice pictures were captured from the VGA cameras.
  • Beacon TX power was also increased and should be easier to capture the signals.
  • They are now slowly deploying the long wire HF antenna in the following few weeks to enable the HF experiments.
More info available at http://www.cput.ac.za/blogs/fsati/zacube-1/

3) A presentation on the experiments of a Satellite propulsion system (Vacuum Arc Thruster)
Vacuum Arc Thruster
  • Vacuum arc thrusters are a potentially useful technology for use as microthrusters on microsats for the future.
  • It is basically a spark plug that generate sparks in a vacuum to propel the satellite. by (Jonathan Lun PhD Student SANSA Space Science,University of the Witwatersrand)

Monday, April 7, 2014

WREN The small 5X5X5cm Cube Satellite. (PocketQube)

WREN The small 5X5X5cm Cube Satellite.




The tiny PocketQube satellite WREN is just 5x5x5 cm yet is equipped with a camera for Slow Scan TV (SSTV) using the Martin-1 format, a gyro, a magnetic field sensor, momentum wheels and pulsed plasma microthrusters. The camera has an image processing system which can find the position of the Sun and the Earth automatically.
WREN Beacon on webSDR (http://zr6aic.giga.co.za:8902


Payload.
1) Beacons on 437.405 MHz (+/- 10 kHz Doppler shift)
Satellite sends 1.6 seconds in AFSK. Then it waits for 6 minutes for a signal.
It waits for a silent FM signal and Morse-like code. (So just keying the mike by hand will do.)
1 = long    0 = short
110011 = Activate (Wait for answers within 2 seconds)11111 = Camera on110 = Snapshot/Thumbnail (make image with 12x14 Pixels)110100 = SSTV send in Mode  Martin-1 with 320x240 PixelsNo, there is no self destruct code. 
The Telemetry Decoder and an Audio File of the beacon are available at http://we.tl/TkWEuhIlnF


WREN Decoder/Commander App Download https://www.dropbox.com/sh/pvzyr01216dab1k/uf4MQWEn5y

More details is available at http://amsat-uk.org/2013/11/28/commands-for-wren-sstv-released/
and https://www.facebook.com/StaDoKo


Friday, March 7, 2014

What a satellite frenzy

What a satellite frenzy.


Satellite prediction software Gpredict

Not more that a year ago you would not have seen anything like this. Its satellite heaven.

I was looking at the Gpredict screen this morning and could not believe what was happening.

There was 5 Amateur Satellites (ZACUBE-1, FUNCUBE, EAGLE2,DELFI-N3XT,CUTE-1.7  ...) above me and I had a quick look at the webSDR and could see multiple beacons all over the screen. Well there is now no excuse not to work satellites. You can pick and chose, Packet store and foreword FM transponders and Linear transponders, some even have cameras on board. What fun!. Some of the Satellites like the FM transponders can be communicated with a simple HF handheld transceiver. ($50 max)

Enjoy the Satellites.

Sunday, March 2, 2014

Satellite Log of MOVE1 CW (2 March 2014 08:02 GMT)

Satellite Log of MOVE1 CW (2 March 2014 08:02 GMT)

MOVE1 Satellite
Launched on 21/11/2013

Here is a Satellite recording of the CW Beacon.


You can monitor this satellite on the webSDR http://zr6aic.giga.co.za:8902
  • CW beacon 145.970 MHz (“MOVE1″)
  • AX.25 beacon 1k2 Cosine-BPSK
  • TLE details click here to track the sat (Catalog number 39439U)
More details is available from http://move2space.de/?page_id=910&lang=en

 



Friday, February 28, 2014

Baofeng HT Radios

Baofeng HT Radios. (UV-5RA) 2m (136-174Mhz) and 70cm (400-480Mhz) with a additional FM broadcast band Rx only (65-108Mhz) (the Transmitting power is (1 Low/4W High).
This radio should be ideal for Satellite work but it is not full duplex ;-(

Baofeng UV-5RA
Transceiver is available from http://www.giga.co.za
I have heard a lot about the small Baofeng HT radios and I was wondering how well they work.
Firstly when I looked around on the internet I found a whole range of the Devices with minor differences between them.

Here is some comparison differences I could found.

Radio Model Dual band Memory Channels Frequency range(s) Battery Power Tx Power Battery
UV-5R Yes 128 136 to 174 MHz and 400 to 480 MHz 12 hours 4/1W 1800-mAh
UV-3R Yes 99 136 to 174 MHz and 400 to 480 MHz broadcast band 68 to 108 MHz(RX) 10 hours 3 W 1800-mAh
UV-5RA Yes 128 136 to 174 MHz and 400 to 480 MHz broadcast band 68 to 108 MHz(RX) 12 hours 4/1W 1800-mAh
BF-888S No 16 400 to 470 MHz 8 hours 4W 1500-mAh
UV-100 Yes 99 136 to 174 MHz and 400 to 470 MHz Broadcast band 65 to 108 Mhz(RX) 10 hours 2W 1200mAh
UV-B5 Yes 99 136 to 174 MHz and 400 to 470 MHz 12 hours 5/1W 1800-mAh
UV-5RC Yes 128 136 to 174 MHz and 400 to 480 MHz broadcast band 68 to 108 MHz(RX)  ?? 4/1W 1800-mAh

Well I was surprised with the UV-5RA that I got and was reasonably easy to configure and program.
I got the repeater split set-up in no time after watching a YouTube video.

Here is the Microphone and external speaker connection details.

Both the modules is available from Giga Technology http://www.giga.co.za

Programming cable assembly.

Programming cable assembly.



Programming your Baofeng radio (UV-5R?)

Frequency Mode vs. Channel Mode
These two modes have different functions and often confused. 

  • Frequency Mode - Used for a temporary frequency assignment, such as a test frequency or quick field programming. 
  • Channel Mode - Used for selecting preprogrammed channels. 

All programming MUST be initially done in the Frequency Mode using the Upper Display only. From there you have the option of assigning the entered data to a specific channel for later access in the Channel Mode if desired.

IMPORTANT: Programming done using the Lower display cannot be saved and will be lost.  


Programming a Repeater Channel with Standard Offsets (600kHz minus offset)
  
This example is for:  146.700 MHz
600kHz minus offset
into channel 99
CTCSS tone 123.0

1.    Set radio to VFO Mode   (Frequency Mode)
      a.)     UV5R series - Press VFO/MR button
      b.)     UV82 - Turn radio OFF, then Press/Hold MENU button during PowerON.

2.    Select   Display A    (this is a must)
      a.)     UV5R/GT3 - Press     [A/B]      and select the Upper Display.
      b.)     UV82 - Press [EXIT A/B] and select the Upper Display.

3.    Disable TDR (Dual Watch/Dual RX) which toggles between A and B.
          Press  [Menu]   7   [Menu]
          Select OFF
          Press  [Menu]   [Exit]

4.    Delete Prior Data from the channel to be programmed.
          Press  [Menu]   2 8   [Menu]
          Enter   9 9   (Memory Channel to clear)
          Press  [Menu]   [Exit]

5.    Enter the Repeater Offset.
         Press [Menu]   2 6   [Menu]
         Enter  0 0 6 0 0
         Press  [Menu]   [Exit]

6.   Enter the Transmit Frequency Shift.
        Press  [Menu]   2 5   [Menu]
        Enter  2  for Minus shift. ( or    to  - )
        Press  [Menu]   [Exit]  

7.   Set CTCSS or DCS codes for Transmit. 
         ( example = CTCSS TX tone 123.0 Hz )
            Press  [Menu]   1 3   [Menu]
            Enter  1 2 3 0   [Menu]   [Exit]

8.   Enter the repeater output frequency,  1 4 6 . 7 0 0 

9.   Store RX frequency
        Press  [Menu]   2 7   [Menu] 
        Enter   9 9   (Memory Channel)  ( 000 to 127 )    
            This is the channel that was cleared in step 4. 
        Press  [Menu]   [Exit] 

10.  Press the [ * Scan ] button.     
         This activates  Reverse Mode and displays the TX frequency.

11.   Press  [Menu]   2 7   [Menu] 
         Enter the same Memory Channel entered above. 
         Press  [Menu] 

12.   Press the  [* Scan] again to exit the Reverse Mode.

13.   Press  [Exit]

This will now appear it in the channel list when you switch to Channel Mode. (MR)
Boafeng UV-VF5 Circuit diagram

REF http://www.uv3r.com/images/Schematic-Baofeng-UV5R.pdf

Radio programing details
here is a link to the Chirp program http://chirp.danplanet.com

Which antenna is best?

 It's all personal preference, but a good rule of thumb is:
 The longer the radiator, the better the range, especially on transmit.
 Short stubby antennas use a coil to match TX to 50 ohm, not radiate.
 The closer to 1/4 wavelength in the air, the better the performance.

NOTE:
      A field test was performed between 31 popular antennas.
     The results can be found HERE.   

Sunday, February 23, 2014

How to run Android Applications on your windows Desktop (BlueStacks)

How to run Android Applications on your windows Desktop

Don't you have a favorite applications on your Android phone / Tab and you wish you could run it on your windows desktop. Well you can. ;-).

Bluestacks Android Desktop.
So how do you do it ?
1) Install the application from http://www.bluestacks.com/bstk-download-success-2.htm 

Click on Download xp visa windows green icon
Install the downloaded Application called  BlueStacks-SplitInstaller_native.exe

Here is the direct URL http://cdn.bluestacks.com/public/beta-1/BlueStacks-SplitInstaller_native.exe

You will the see this screen. (except conditions and select continue)
Select continue


You will need the first two options to install your favorite application on the BlueStacks desktop.

Installing the BlueStacks form internet. (some flashing adverts while installing)
I the got a worming about screen driver that was outdated and needs to be updated.

Graphics Warning menu

Installing Graphics driver.

Graphics driver install menu
After you have installed the application you should have a menu item in your start menu Start BlueStack

Run the Start BlueStacks menu item

You will then get a Android Tab desktop on your screen.

BlueStacks Tab Desktop

Wait a white the Desktop connects to the internet to download the default applications.

Install your Apps 

Enable your Google sink and apps-store functionality in stetting.

Install your favorite applications. (in my case Pocket RXTX from app store)



Here is my favorite webSDR Application where I listen to my HF stations on my desktops.

Pocket RXTX SDR radio on your virtual TAB
Here is a link to this app https://play.google.com/store/apps/details?id=ro.yo3ggx.rxtx&hl=en

If you want to connect you RTL dongle or VNA device to your PC and make it work you can here is the details.

Because Bluestacks currently do not support the USB or Bluetooth devices, you need a COM redirector application, a trail version of tcp2com program which can be downloaded for free from here:
http://www.astrogeeks.com/AstroGeeks/COM2TCP/download.html (a trial for 45 days).
Some other free redirectors are available too.

Then you need to run BlueVNA in WiFi mode and connect to the local host, using the port configured in the COM redirector.