Wednesday, February 1, 2017

reboot vs shutdown -r now

Generally shutdown -r now is safer.

In most of the unix distributions they perform exactly the same actions except for Mac OSX. On Mac OSX reboot performs an instant reboot. There is no unmounting and no syncing. So, to avoid headaches, play safe and do not use reboot.

Syntax of shutdown command:

shutdown [OPTION] [TIME] [MESSAGE]

To reboot the system right now safely write:

shutdown -r now


Tuesday, January 24, 2017

Tail command with color

tail -f myfile.log | perl -pe 's/.*TEXT_TO_FIND.*/\e[1;31m$&\e[0m/g'

\e[1;31m will give you the red color. If you would like some yellow, use \e[1;33m, and for green use \e[1;32m. The \e[0m restores the normal text color.

SOURCE: http://unix.stackexchange.com/questions/8414/how-to-have-tail-f-show-colored-output
(Answer <37>)


Monday, November 28, 2016

Test TCP and UDP with Netcap


Testing TCP connection

Create TCP listener:
$ nc -l 9999
Create TCP Client:
$ nc -vt 192.168.5.12 9999
Ncat: Version 6.40 ( http://nmap.org/ncat )
Ncat: Connected to 192.168.5.12:9999.


Testing UDP connection

Create UDP listener:
$ nc -ul 9999
Create UDP Client:
$ nc -vu 192.168.5.12 9999
Ncat: Version 6.40 ( http://nmap.org/ncat )
Ncat: Connected to 192.168.5.12:9999.

Test UDP Connection only:
$ nc -zvu 192.168.5.12 9999
Connection to 192.168.5.12 9999 port [udp/*] succeeded!

Friday, November 4, 2016

Thursday, November 3, 2016

sysctl to change kernel system settings

To list all settings configurable in the /proc/sys/ directory:

/sbin/sysctl -a


To assign values to writable files in the /proc/sys/ directory:


sysctl -w [parameter] = [value]

Example:

sysctl -w kernel.sysrq="1"

This only works for testing purposes. Special settings within /proc/sys/ are lost when the 
machine is rebooted. To preserve custom settings, add them to the /etc/sysctl.conf file.
Each time the system boots, the init program runs the /etc/rc.d/rc.sysinit script.
This script contains a command to execute sysctl using /etc/sysctl.conf to determine the
values passed to the kernel.




Popular Posts

Recent Posts

Unordered List

Text Widget

Pages

Search This Blog

Powered by Blogger.