Editing files over ssh in vim

archlinux-logo-dark-200dpi.b42bd35d5916

Need a quick file edit on remote server. With vim it’s easy, use:

vim scp://username@host:port//path/to/file

…or within vim:

:e scp://username@host:port//path/to/file

…or if you are not sure about name of the file, browse remote directory with:

:e vim scp://username@host:port//path/to/directory/

Directory path must end with /.Remote home directory is invoked with:

:e scp://username@host:port/~/

Use rcp instead of scp for ftp access.
Happy hacking….

kodi – network ports

kodi-helix-14.1-600x336

If you use XBMC or now Kodi, those are the ports that should be open for full network access:
tcp 8080 – web interface, can be changed,
udp 1900 – dlna,
other ports:
tcp: 1084, 1308, 1131,
tcp (ipv6): 9090 (optional if you use ipv6 connections),
udp: 9777, 12374.
Those are ports that I opened and can be seen with console command:
netstat -ntulp
If you use iptables those are commands:

iptables -A TCP -p tcp --match multiport --dports 1084,1131,1308,8080 -m comment --comment "kodi" -j ACCEPT
iptables -A UDP -p udp --match multiport --dports 1900,9777,12374 -m comment --comment "kodi" -j ACCEPT
iptables-save > /etc/iptables/iptables.rules
systemctl reload iptables

…as root.
Happy hacking…

Weather in Console

weather

Weather is app which shows decoded METAR (Meteorological Aerodrome Reports) data from NOAA (the USA National Oceanic and Meteorological Administration) and forecasts or alerts from NWS (the USA National Weather Service) and is part of weather-utils pack.The usage is strait forward, first get your weather station code from NOAA and then just run command:

$ weather -l NOAA code

…and that’s it for start. There are a few more options like using config files for various places, aliases with a plenty of options. help can be found with weather -h or man weather with additional help using various configured variants.
The second one is Weatherman that displays weather from weatherbug and is written in bash so it will run on almost any UNIX/Linux system. The usage, simple and efficient:

 $ weatherman "city, country"

…and if you are satisfied with output just add option -S and save unit and location setting to ~/.weathermanrc. The options and help can be found with weatherman -h or man weatherman.

cursetheweather

cursetheweather – ncurses client for retrieving weather forecasts with use of the weather.com code:

 ctw --refresh=15 city code

Related apps:
atpdec – console NOAA and POES weather satelite image software decoder,
cliweather and cweather – simple CLI for Google weather API,
weathercli – bash script to retrieve weather from weatherbug.com,

Console process/network/usage viewers for Linux

Htop

Htop is ncurses text-mode application (for console or X terminals) for displaying different information for running processes, memory and CPU usage, load averages… It is based on top process viewer (which is already bundled in Linux distributions), with added functionality, mouse support, improved loading and starting.

atop

Atop – ASCII full-screen performance monitor that is capable of reporting the activity of all processes (even if processes have finished during the interval), daily logging of system and process activity for long-term analysis, highlighting overloaded system resources by using colors, etc. In combination with the optional kernel module Netatop, it even shows network activity per process/thread.

ntop

Ntop – a network traffic probe that shows the network usage, similar to what the popular top Unix command does. ntop is based on libpcap and users can use a web browser  to navigate through ntop (that acts as a web server) traffic information and get a dump of the network status.

iotop

Iotop – Iotop is a Python program with a top like UI used to show of behalf of which process is the I/O going on.

nload

Nload – console application which monitors network traffic and bandwidth usage in real-time. It visualizes the in- and outgoing traffic using two graphs and provides additional info like total amount of transfered data and min/max network usage.

iftop

Iftop – does for network usage what top does for CPU usage. It listens to network traffic on a named interface and displays a table of current bandwidth usage by pairs of hosts.

iptstate

Iptstate – a top-like interface to your netfilter connection-tracking table. Using iptstate you interactively watch where traffic crossing your netfilter/iptables firewall is going, sort by various criteria, limit the view by various criteria, as of version 2.2.0 you can even delete states from the table.

nethogs

Nethogs – small ‘net top’ tool. Instead of breaking the traffic down per protocol or per subnet, like most tools do, it groups bandwidth by process. NetHogs does not rely on a special kernel module to be loaded. If there’s suddenly a lot of network traffic, you can fire up NetHogs and immediately see which PID is causing this. This makes it easy to identify programs that have gone wild and are suddenly taking up your bandwidth.

Some other utilites: LTTng, Nettop, Jnettop, Arm, Memcache-top, RadeonTop, ….

…and with gui: Qps, Top, ….

“So long and thanks for all that fish.”