Shutdown ubuntu/esx/redhat server From windows using plink

The easiest way to execute any command from windows using putty installation.

The example below you can shutdown your linuxbox server from windows using shutdown command

Example:

“C:Program Files”puttyplink.exe -ssh root@ip -pw ****** shutdown -h now

Usage: plink [options] [user@host [command]

Options:

-V print version information and exit

-pgpfp print PGP key fingerprints and exit

-v show verbose messages

-load sessname Load settings from saved session

-ssh -telnet -rlogin -raw

force use of a particular protocol

-P port connect to specified port

-l user connect with specified username

-batch disable all interactive prompts

The following options only apply to SSH connections:

-pw passw login with specified password

-D [listen-IP:]listen-port

Dynamic SOCKS-based port forwarding

-L [listen-IP:]listen-port:host:port

Forward local port to remote address

-R [listen-IP:]listen-port:host:port

Forward remote port to local address

-X -x enable / disable X11 forwarding

-A -a enable / disable agent forwarding

-t -T enable / disable pty allocation

-1 -2 force use of particular protocol version

-4 -6 force use of IPv4 or IPv6

-C enable compression

-i key private key file for authentication

-m file read remote command(s) from file

-s remote command is an SSH subsystem (SSH-2 only)

-N don’t start a shell/command (SSH-2 only)

Skype problem

In the meantime, you can follow the steps below to fix the problem manually.
Windows

If the Skype icon is displayed in the system tray at the bottom right of the screen, right-click it and select Quit.

Click Start, type “run” and press Enter. (On Windows XP: Click Start and then Run.)

Type “%appdata%skype” and click OK.

Locate and delete the file shared.xml. The file may be displayed as shared if file extensions are not displayed by default on your computer.

If you cannot find this file:

Click Start, type “run” and press Enter. (On Windows XP: Click Start and then Run.)

Type “control folders” and click OK.

In the View tab, ensure that Show hidden files and folders is enabled.

Repeat the instructions from the beginning.

Restart Skype.

Mac

Open Finder and locate the following folder:

~/Library/Application Support/Skype

Delete the file shared.xml.

Restart Skype.

The ~ sign means your home folder. You can find your home folder by opening Finder and selecting Go > Home from the menu bar or pressing Command (Apple), Shift and H keys at the same time.
Linux

Go to the following folder:

/home/YourLinuxUserName/.Skype

Delete the file shared.xml.

Restart Skype.

The Skype folder is a hidden folder – please check Show hidden files in your file browser to view and access it.

HowTo – Batch Image Resize on Linux

Suppose you want resize every your photos to put it on web. As you know, you can’t upload your photos on a web page with the highest resolution because a web gallery became inaccessible and too slow to load. Suppose that you have a folder containing every photos of you holidays and you want resize it at 640 of width maintaining original aspect ratio. To make a resize there are many tools but I suggest a command line tool called “mogrify”. This tool will be installed with ImageMagick Libraries, so you have to install ImageMagick on you Linux.

sudo apt-get install imagemagick

Now you can go to your home folder which you have saved your photos and do :

mogrify -resize 640×480! *.jpg

Thank

Top command Description

Description of few parameters of top command:

wa = Waiting for I/O
us = User space
sy = system/kernel
ni = Nice Process
id = Idle
hi = Hardware Interrupts
si = Software Interrupts

EDIT:

1. us -> User CPU time: The time the CPU has spent running users’ processes that are not niced.
2. sy -> System CPU time: The time the CPU has spent running the kernel and its processes.
3. ni -> Nice CPU time: The time the CPU has spent running users’ proccess that have been niced.
4. wa -> iowait: Amount of time the CPU has been waiting for I/O to complete.
5. hi -> Hardware IRQ: The amount of time the CPU has been servicing hardware interrupts.
6. si -> Software Interrupts.: The amount of time the CPU has been servicing software interrupts.

Find Duplicate IP address

Log in as root and type the following

# arping -D -I eth0 -c 2 10.5.70.2

ARPING 10.5.70.2 from 0.0.0.0 eth0

Unicast reply from 10.5.70.2 [00:02:55:C7:1D:49] for 10.5.70.2 [00:02:55:C7:1D:49] 4.222ms

Sent 1 probes (1 broadcast(s))

Received 1 response(s)

[root@govath-pc ~]# echo $?

1

Facebook Chat Now Available with XMPP Pidgin

Configure Pidgin . Do Ctrl+A to open the ‘Accounts’ window, then ‘Add’. On the ‘Basic’ tab, select the XMPP Protocol.
Username: Your Facebook username
Domain: chat.facebook.com
Resource: Pidgin
Password: your Facebook password
Local alias: Alias

On the Advanced tab, then enter the following:
Connect port: 5222
Connect server: chat.facebook.com
Uncheck ‘Require SSL/TLS’

You’re now set to use XMPP ‘Jabber’ with Pidgin

Linux Setfacl Getfacl ACL examples

Some Basic examples of setting permissions to Files.

Granting an additional user read access

$ setfacl -m u:lisa:r file

Revoking write access from all groups and all named users (using the effective rights mask)

$ setfacl -m m::rx file

Removing a named group entry from a file’s ACL

$ setfacl -x g:staff file

Copying the ACL of one file to another

Methond 1:

$ getfacl file1 | setfacl --set-file=- file2

Method 2:

$ getfacl file1 > acls.txt
$ setfacl -f acls.txt file2

Copying the access ACL into the Default ACL

getfacl --access dir | setfacl -d -M- dir

Remove screen saver from linux

Linux disable screen blanking i.e. preventing screen going blank

It is easy to disable screen saver under X window. But when it comes to text based login or terminal you will not find easy way to disable text based power saving mode (i.e. when your screen goes blank after a few minutes).

So how do I disable the blank screen mode, which activated after a few minutes? Answer is use setterm command.

setterm writes to standard output a character string that will invoke the specified terminal capabilities. Where possible terminfo database (terminfo is a data base describing terminals, used by screen-oriented programs and libraries such as ncurses) is consulted to find the string to use.

By default, the Linux kernel will use screen-save option to disable it you need to type command (it turns off monitor VESA powersaving features):

$ setterm -powersave off -blank 0

If it dumps back you with an error that read as follows:

cannot (un)set powersave mode

You need to shutdown X window system and rerun the above command. Better, add following two commands to your ~/.xinitrc file:

setterm -blank 0 -powersave off -powerdown 0

xset s off

This command also supports other useful options:

Resets the terminal to its power on state:

$ setterm -reset

Alternatively, initialize terminal:

$ setterm -initialize

Turns the terminal’s cursor on or off:

$ setterm -cursor [on|off]

Turns automatic line-wrapping on or off (virtual consoles only)

$ setterm -linewrap [on|off]

Sets the foreground text color (virtual consoles only):

$ setterm -foreground blue

Sets the background text color (virtual consoles only):

$ setterm -background red

Enables or disables the sending of kernel printk() messages to the console (virtual consoles only). Useful if you get lots message from iptables firewall:

$ setterm -msg [on|off]

how to check folder/directory capacity in linux

NAME
du – estimate file space usage
SYNOPSIS
du [OPTION]… [FILE]…
DESCRIPTION

Summarize disk usage of each FILE, recursively for directories.

Mandatory arguments to long options are mandatory for short options too.

-a, –all
write counts for all files, not just directories
-B, –block-size=SIZE use SIZE-byte blocks
-b, –bytes
print size in bytes
-c, –total
produce a grand total
-D, –dereference-args
dereference FILEs that are symbolic links
-h, –human-readable
print sizes in human readable format (e.g., 1K 234M 2G)
-H, –si
likewise, but use powers of 1000 not 1024
-k
like –block-size=1K
-l, –count-links
count sizes many times if hard linked
-L, –dereference
dereference all symbolic links
-S, –separate-dirs
do not include size of subdirectories
-s, –summarize
display only a total for each argument
-x, –one-file-system
skip directories on different filesystems
-X FILE, –exclude-from=FILE
Exclude files that match any pattern in FILE.
–exclude=PATTERN Exclude files that match PATTERN.
–max-depth=N

EXAMPLE

du -s -h /home/user

du -h /home/user

du /home/user