ss – utility to investigate sockets.

Sometimes, you find some interesting application/command by accident, and that is just what happened a few days back. Well, I was doing a ssh and as usual made my share of mistake in typing and missed the “h” from the ssh command and saw a list of options instead of my prompt on remote server.

Now, that set me thinking and fond that its a very interesting command that comes with iproute on Fedoara, so if you want this command, then install iproute like this

1
 sudo yum install iproute

and then you can see the help with

1
man ss

 

By default, without any options you will see a list of all open sockets on your system.

There are a lot of options that you can use and couple of them are very interesting a useful.

-m — shows the memory

p — process associated with the socket.

-i — shows the TCP internal information

There are some other options which you might find useful.

Enhanced by Zemanta

[Solved] ssh works but scp does not

Structure of an SSH binary packet
Image via Wikipedia

For quite sometime now, I was having this issue, that for the home system, I was able to connect to is using ssh but it never worked. Fnally after quite some debugging finally I found that the issue was with thebashrc. So, everytime I had to do a scp I would have to move/rename bashrc and do the reverse action after the scp was done.

Finally today I fixed it and the solution was very simple. I put the offending code or rather complete bashrc in the loop as mentioned below:

 

1
2
3
4
5
6
7
if [[ $SSH_CLIENT = "" ]

then

<bashrc code here>

fi

By doing this the <dot>bashrc is never executed when a ssh session is initiated (which is what happens for scp also). 🙂

Enhanced by Zemanta

Try all colors in xterm with script before setting the color

If you are looking for testing the colors on how they would look like in the xterm before you set the color then here is a small script for you.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash -
#===============================================================================
#
#          FILE:  xterm_colors-test.sh
#
#         USAGE:  ./xterm_colors-test.sh
#
#   DESCRIPTION:  Test all the colors for xterm bg
#
#       OPTIONS:  ---
#  REQUIREMENTS:  ---
#          BUGS:  ---
#         NOTES:  ---
#        AUTHOR:   Amit Agarwal ([email protected]), aka
#       COMPANY:  Individual
#       VERSION:  1.0
#       CREATED:  02/18/2011 01:02:51 PM IST
#      REVISION:  1.0
#===============================================================================

cat /usr/share/X11/rgb.txt |sed 's/\([0-9]\{1,3\}[ \t]*\)\{3\}//'|sed 's/^ *//' &gt;~/rgb.txt
while read line
do
bg=$(echo $line)
echo $line
echo "Trying $bg color"
xterm -bg "$bg"&amp;
sleep 5
kill -9 $!
done &lt; ~/rgb.txt

This can be used in various ways but I will leave the choice to you. One option that I should probably still tell is :

Execute a command like ls to see how the settings for dircolors would look like in the terminal. To do this change the line where we are invoking xterm to the below line:

1
xterm -bg "$bg" -e "ls &amp;&amp; sleep 5"

Do remember the sleep to some suitable time according to your needs.

Hope this helps you choose the color you want for your xterm background.

Enhanced by Zemanta