June 2012
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

Categories

June 2012
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

JBOSS AUTO RESTART SCRIPT

JBOSS AUTO RESTART SCRIPT

set –xv

Shell script with Debug command inside:

Add set –xv inside the shell script now to debug the output as shown below.

$ cat filesize.sh #!/bin/bash set -xv for filesize in $(ls -l . | grep “^-” | awk ‘{print $5}’) do let totalsize=$totalsize+$filesize done echo “Total file […]

sgid

SGID attribute

Setting the SGID attribute on a directory : chmod g+s

If the SGID (Set Group Identification) attribute is set on a directory, files created in that directory inherit its group ownership.

If the SGID is not set the file’s group ownership corresponds to the user’s default group.

In order to set the SGID […]

Link commands

delete symbolic link

When using the rm or unlink command to remove a symbolic link to a directory, make sure you don’t end the target with a ‘/’ character because it will create an error. Example:

$ mkdir dirtest $ ln -s dirtest lntest $ rm lntest/ rm cannot remove directory ‘lntest/’ : Is a […]

File /Folder Permissions

File /Folder Permissions

These are the numeric values and its related permissions in a linux system.

4000 – Setuid on execution 2000 – setgid on execution 1000 – set sticky bit 0400 – read by owner 0200 – write by owner 0100 – execute by owner 0040 – read by group 0020 – wrrite by […]

Kill processes for user

Kill processes for user

To easily kill all processes running under a user

ps -u USER | awk ‘{print $1}’ | xargs kill -9

or

pkill -u USER

replacing USER with the username.

To kill all specific processes such as php running under a user run,

ps -u USER | grep PROCESS |awk ‘{print $1}’ […]

Hide Commands in Shell

Hide Commands in Shell

To hide the commands you are entering in shell, use “stty” command 🙂

#stty -echo

Now, all commands that you type are invisible. To disable this mode, issue the following command at the shell prompt:

#stty echo

Nmap Command

Nmap Command

User can scan entire network or selected host or single server. Nmap is also useful to test your firewall rules. namp is metwork exploration tool and security / port scanner. According to nmap man page: It is an open source tool for network exploration and security auditing. It was designed to rapidly scan […]

Port scanning with netcat (nc) command

Port scanning with netcat (nc) command

How do I find out which ports are opened on my own server? How do I run port scanning using nc command?

A. It may be useful to know which ports are open and running services on a target machine. You can use nmap command for port scanning.

[…]

Hard Disk Specs details on Linux

Hard Disk Specs details on Linux

Open the terminal and type the command: # hdparm -I /dev/sda OR $ sudo hdparm -I /dev/sda

[root@localhost thermal_zone]# hdparm -I /dev/sda

/dev/sda:

ATA device, with non-removable media Model Number: VBOX HARDDISK Serial Number: VB81a9afe9-f59293fa Firmware Revision: 1.0 Standards: Used: ATA/ATAPI-6 published, ANSI INCITS 361-2002 Supported: 6 5 […]

Windows Shortcut commands

Windows Shortcut commands

Start Menu >> Run

Accessibility Controls – access.cpl Add Hardware Wizard – hdwwiz.cpl Add/Remove Programs – appwiz.cpl Administrative Tools – control admintools Automatic Updates – wuaucpl.cpl Bluetooth Transfer Wizard – fsquirt Calculator – calc Certificate Manager – certmgr.msc Character Map – charmap Check Disk Utility – chkdsk Clipboard Viewer – clipbrd […]