Tuesday, October 21, 2008

Usefull Unix | Linux commands

Below is a list of command with switches that I commonly use, but I still sometimes forget I hope you find this usefull as I do, I know some of them is pretty common but its good reference for me.

Gzip - removes the files after gzipping
gzip -9

Check top 8 process using PRSTAT
prstat -s cpu -a -n 8

Vi - Search and Replace /g is for global

tcpdump -xx -vv -n host -i and

Remount without Unmounting
mount -o remount /mounteddirectory

Disk Usage
du -sm //-s - summarize
du -cam --max-depth=1 //-c - give a total -a - include files (not just directories) -m - display in megabytes

Print Environment VAriable
printenv | less
env | less

Print Shell Variables
set | less

Find command - finding files more than 5mb on a directory
/usr/bin/find -size +50000000c -exec ls -lt {} \;

Find command - Find file and send error message to /dev/null
find -name 2>/dev/null

To check the duplex:
ndd /dev/hme link_mode

Where a return value of 0 = half duplex, and 1 = full duplex
To force to full duplex:
ndd -sec /dev/hme adv_100fdx_cap
ndd -set /dev/hme adv_autoneg_cap 0

To force to half duplex:
ndd -sec /dev/hme adv_100hdx_cap
ndd -set /dev/hme adv_autoneg_cap 0

Thats it.

Computer and Network problem | How to below:

1 comment:

Anonymous said...

"gzip -9" is used to make gzip do best compression to the archive, not remove the files after zipping.

nice quick commands.

For suggestion and concerns E-mail