Wednesday, April 30, 2008

Useful Unix Commands for PS Admin activity

**************************************************************************

du -skh * // summarize disk usage...

du -skh . // summarize disk usage...

// displays number of free disk blocks and free files of of PWD's file system

df -kh .

// displays number of free disk blocks and free files of all file systems

$df -kh

$ uname -a // print name of current system

SunOS frc25k8d13z1 5.10 Generic_118833-02 sun4u sparc SUNW,Sun-Fire-15000

// looks for the filenames starting with appsrv* in PWD (.)

$find . -name appsrv* -print

// looks for the filenames starting with appsrv* in directory DirName

$find DirName -name appsrv* -mtime +15 –print

//command to know the nature of the OS (SunOS/Solaris only)

$isainfo -b

example:

$echo "Welcome to "`isainfo -b`"-bit Solaris"





# Output can be directed to another program or to a file.

# send output to a file

command > /tmp/output.log



# redirect error output

command > /tmp/output.log 2> /tmp/errors.log



# send output to grep program

command PIPE grep "something"

(PIPE Command should pe replaced by vertical line... not able to publish PIPE command through blogspot)



# Date formatting... Grab the date from the system and format it, to a YYYYMMDD format

filename=`date +'%Y%m%d'`



# Scan a file in shell script

for VALUE in `cat value.dat`

do

echo "Value in file: " $VALUE

done




# Backspace key's settings... depends on emulator

$stty erase ^?

**************************************************************************

2 comments:

jotawolf said...

The -h (human readeable mode) is not present in older *NIX systems. The post should be usefull commands for Linux. Also not much related with ps (proccesses?). Just some tips.
Regards

Rakesh Parwal said...

Thanks a lot for you comments Mr. Jotawolf... Yeah, the commands are not universal across various flavors of Unix... commands written here are most relevant to SunOS 5.10 (Solaris 10) #.

Regarding more commands (ps and others), I would certainly post most of the useful commands asap.

Also, I would appreciate your effort to keep sharing your comments, suggestions and knowledge stuff in the blog.

~Rakesh

# SunOS is a version of the Unix operating system developed by Sun Microsystems. The SunOS name is used to refer to versions 1.0 to 4.1.4 of SunOS. These versions were based on BSD Unix. SunOS version 5.0 and later are based on UNIX System V Release 4 and are referred as Solaris. The latest Solaris release is Solaris 10 and incorporates SunOS 5.10.

OCI - Attach Block Volume to Windows VM

Tip: Although creating and attaching Block Storage to a Windows VM is pretty straightforward (OCI documentation is pretty good for that), th...