Wednesday, 31 August 2016

Process running in background

Keeping a process running after ending ssh session could be very useful.

The best way is often the simplest.
nohup long-running-command &
It was made specifically for this, it even logs stdout to nohup.log
man nohup
If you want to "background" some already running tasks, then your best bet is to ctrl+z then run
bg (this will background your most recent suspended task, allowing it to continue running)
then a quick disown should keep the process running after you log out.
screen and others can do it, but that's not what they're for. I recommend nohup for tasks you know your going to leave behind and bg for tasks your already running and don't want to re-start.
Keep in mind, both are bash specific. If you're not using bash, then the commands could be different.
Extracted from

Friday, 26 August 2016

Tip - place for scripts

* A place for putting common scripts (with execution permission) that must be available for all the system is

It can be called in any location.   

* Also,when trying to run commands or scripts on startup you can put the required command to run inside the file
~/.bashrc for a local command
/etc/bash.bashrc for a global command (for example a command that requires sudo). 

Both of the above commands will ask for the sudo passwork. If you do not put sudo, the script will not run if it requires administrative priviledges

You can also put a command that requires sudo inside your local .bashrc but you will be asked to put the sudo password everytime your start a command line or the .bashrc is processed (for example when running source ~/.bashrc)

* Also, to run an administrative command without having to put the admin password and that you want to be executed at the end of each multiuser runlevel, put your command in the file

Also, take into account that you do not need to put sudo, the execution of this file has already administrative priviledges .
Do not forget to finish the command by providing an exit value. 0 means sucess and any other value means error.
exit 0 
* For other related information, visit:

Friday, 19 August 2016

Setting static ip for your network card
 Edit the file /etc/network/interfaces and add this:

auto wlan0
iface wlan0 inet static

wpa-ssid 'mynetwork'
wpa-psk '12345'

In order for this to take effect the networking service must be restarted
$ sudo /etc/init.d/networking restart

For more info, look here->

Thursday, 18 August 2016

Computers in a network

Arp-scan can scan the computers in a network
* Using Wi-Fi:
sudo arp-scan -l --interface=wlan0
* Using ethernet:
sudo arp-scan -l --interface=eth0 
* Connection by usb 
sudo arp-scan -l --interface=usb0
Answer from system:
Interface: usb0, datalink type: EN10MB (Ethernet)
Starting arp-scan 1.8.1 with 256 hosts ( 02:00:86:9b:2a:ad (Unknown)

1 packets received by filter, 0 packets dropped by kernel
Ending arp-scan 1.8.1: 256 hosts scanned in 1.289 seconds (198.60 hosts/sec). 1 responded