Nerdplanet - Linux for Nerds
  • About Me

Linux Process States

By Mohan On November 8, 2010 · Leave a Comment

Linux process states for each program. you can find it out by running “man ps” and look for PROCESS STATE CODES

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
PROCESS STATE CODES
Here are the different values that the s, stat and state output specifiers (header
"STAT" or "S") will display to describe the state of a process:
 
D uninterruptible sleep (usually IO)
R running or runnable (on run queue)
S interruptible sleep (waiting for an event to complete)
T stopped, either by a job control signal or because it is being traced
W paging (not valid since the 2.6.xx kernel)
X dead (should never be seen)
Z defunct ("zombie") process, terminated but not reaped by its parent
 
For BSD formats and when the stat keyword is used, additional characters may be
displayed:
 
< high-priority (not nice to other users)
N low-priority (nice to other users)
L has pages locked into memory (for real-time and custom IO)
s is a session leader
l is multi-threaded (using CLONE_THREAD, like NPTL pthreads do)
+ is in the foreground process group

Continue Reading →

Autossh to maintain ssh tunnel disconnects

By Mohan On October 10, 2010 · Leave a Comment

Use autossh to reconnect ssh tunnel disconnects automatically, lets say you maintain a ssh tunnel to visit few websites blocked on the firewall using foxyproxy from restricted network.

1. setup an ssh key login from the restricted machine to the home machine.

2. configure foxy proxy and setup a wild card expression. ex: http://*linkedin.com/*  to [...]

Continue Reading →

ssh client configuration for auto selecting user name and port

By Mohan On September 25, 2010 · Leave a Comment

Set up ssh client configuration file for auto selecting username and port

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
mkdir -pv ~/.ssh/connections
 
cat ~/.ssh/config
 
#connect to default port with different user than what you have logged into shell
Host host1 host2 host3
        User mohanb
 
#use a custom port
Host nixgate1.homeip.net
         User mohan
         port 443
 
#set control path to establish second connection immediately
Host *
        Compression yes
        CompressionLevel 7
        Cipher blowfish
        ControlMaster auto
        ControlPath ~/.ssh/connections/%r_%h_%p

Continue Reading →

ethtool to change interface statistics

By Mohan On September 4, 2010 · Leave a Comment

Use ethtool to change interface statistics.

Installation

1
root@gateway:~# apt-get install ethtool

Syntax

1
2
3
4
5
6
7
8
root@gateway:~# ethtool -h
 
Usage:
ethtool DEVNAME Display standard information about device
 
ethtool [options] devicename
ethtool devicename
ethtool eth0

Continue Reading →

wget – mirror a website recursively

By Mohan On August 22, 2010 · Leave a Comment

Mirror a website recursively:

1
wget --mirror --no-parent --no-host-directories -erobots=off --cut-dirs=4 http://variyas.com/

Download files recursively from a http mirror:

1
2
3
4
5
6
7
#Download files recursively:
 
wget --mirror --no-parent --no-host-directories -erobots=off --cut-dirs=4 http://variyas.com/files/
 
#Delete the html files as part of clean up
 
find . -iname 'index.html*' -print -exec rm -fv {} \;

Note: we are ignoring the robots.txt file or else the download will fail

Continue Reading →

Configuring SendMail To Act As A SmartHost & To Rewrite From Address

By Mohan On August 3, 2010 · Leave a Comment

Configuring SendMail To Act As A SmartHost

 

This Tutorial explains how to configure a sendmail server to forward all mails generated from localhost to an another SMTP server for sending mails to remote recipients. Also it explains how to rewrite the from address of [email protected] to the [email protected]

 

Example Scenario:

You have a production server [...]

Continue Reading →

Configuring Persistent Static Routes in Smoothwall Firewall

By Mohan On July 22, 2010 · Leave a Comment

Creating Persistent STATIC ROUTES IN SMOOTHWALL Firewall

First login to the system and move to /etc/rc.d folder create a file named: rc.staticroute or any name of your convineince

open the created file

vi /etc/rc.d/staticroute

then go into the append mode and create these entries

1
2
3
4
5
6
7
8
9
10
#------------- Starting line------------------#
#Author: Mohan
#Purpose: static routes created for reason
 
#!/bin/sh
 
route add -net 192.168.10.0  netmask 255.255.255.0 gw 192.168.1.1
route add -host 192.168.8.10 netmask 255.255.255.0 gw 192.168.2.1
 
#-------------- Ending Line--------------------#

Add as many routes as you want in that [...]

Continue Reading →

Access Windows PC Remotely from linux using rdesktop

By Mohan On July 8, 2010 · Leave a Comment

Access Windows PC Remotely from linux using rdesktop:-
————————————————————–

NOTE: This process applies to Redhat/CentOS/SuSE distributions

First check whether rdesktop package is installed

1
2
linuxidiot@hostbox:# rpm -qa | grep rdesktop
rdesktop-1.5.0-79

It should show something like rdesktop-1.x.x-xx version if installed else download the rpm from any of the available download locations like http://rpm.pbone.net or http://rpmfind.net download the rdesktop package for your distribution.

1
linuxidiot@hostbox:# rpm -ivh rdesktop-1.5.0-79.rpm

if [...]

Continue Reading →
← Previous Entries
  • Recent Posts

    • Linux Process States
    • Autossh to maintain ssh tunnel disconnects
    • ssh client configuration for auto selecting user name and port
    • ethtool to change interface statistics
    • wget – mirror a website recursively
  • Tags

    add additional apache bash convert curl database demo desktop dialog download ethtool find getopts grant http linux mail mp3 mysql mysqldb permissions rapidshare rdesktop remote revoke scan screen screen.rc script sendmail shell signals smarthost smoothwall ssh subnet trap tricks user vnc vnc server wget wma xargs
  • Categories

    • Bash (5)
    • Database (1)
    • Linux (15)
    • Mail (1)
    • Shell Tricks (10)
    • ssh (2)
    • Uncategorized (1)
    • Windows (1)
  • Archives

  • Recent Comments

    • Meta

      • Log in
      • Entries RSS
      • Comments RSS
      • WordPress.org
    "And miles to go before I sleep!" — tuxfight3r

    Nerdplanet – Linux for Nerds

    • About Me
    All Rights Reserved. Copyright © 2013 by Nerdplanet.