Tag Archives: terminal

How to Find Server Public IP Address in Linux Terminal

root@test:/var/log/nginx# wget -qO – icanhazip.com
www.xxx.yyy.zzz
root@test:/var/log/nginx# wget -qO- http://ipecho.net/plain | xargs echo
www.xxx.yyy.zzz
root@test:/var/log/nginx# wget -qO – icanhazip.com
www.xxx.yyy.zzz
root@test:/var/log/nginx# curl icanhazip.com
www.xxx.yyy.zzz
root@test:/var/log/nginx#

How do I extend the terminal width or set term variables with ksh? / Not Getting the full command info from ps in Unix terminal ?

To identify processes to kill we need to view the FULL output from the ps command (we use the comm field). But by default we are not able to view full command.  So here is the solution..

Solaris :

/usr/ucb/ps -awux

You may need two “w” options. From ps(1b):

-w Uses a wide output format (132 columns rather than 80). If the option letter is repeated, that is, -ww, uses arbitrarily wide output. This information is used to decide how much of long commands to print.

AIX / Linux :

I have a putty remote session or any terminal session with ksh shell. When I insert a long command I can see ‘<‘ suddenly appear on the line and my command begins to scroll horizontally between prompt and ‘<‘ sign while I keep on writing it.

I want to make it clear: a ‘<‘ sing does not appear at the end of the visible line (ie. limited by putty window) but in the middle of it. Is there a way to change it to higher value? I tried TERM, but did not set it.

Answer: You have to define $COLUMNS after you login or in .kshrc. Similarly, you can also define $LINES.

Open your .kshrc or edit .kshrc, and add

# echo $SHELL
/usr/bin/ksh
# export COLUMNS=1000
# ps -ef

 

How do I extend the terminal width or set term variables with ksh? / Not Getting the full command info from ps in Unix terminal ?

To identify processes to kill we need to view the FULL output from the ps command (we use the comm field). But by default we are not able to view full command.  So here is the solution..

Solaris :

/usr/ucb/ps -awux

You may need two “w” options. From ps(1b):

-w Uses a wide output format (132 columns rather than 80). If the option letter is repeated, that is, -ww, uses arbitrarily wide output. This information is used to decide how much of long commands to print.

AIX / Linux :

I have a putty remote session or any terminal session with ksh shell. When I insert a long command I can see ‘<‘ suddenly appear on the line and my command begins to scroll horizontally between prompt and ‘<‘ sign while I keep on writing it.

I want to make it clear: a ‘<‘ sing does not appear at the end of the visible line (ie. limited by putty window) but in the middle of it. Is there a way to change it to higher value? I tried TERM, but did not set it.

Answer: You have to define $COLUMNS after you login or in .kshrc. Similarly, you can also define $LINES.

Open your .kshrc or edit .kshrc, and add

# echo $SHELL
/usr/bin/ksh
# export COLUMNS=1000
# ps -ef