Subscribe: UnixStuff
http://deansunixstuff.blogspot.com/feeds/posts/default
Added By: Feedage Forager Feedage Grade B rated
Language: Danish
Tags:
awk  check  dev  exec  file  files adsk  files  find exec  find  largest files  new  nis  show  sort largest  sort  system  usr  xterm 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: UnixStuff

UnixStuff



A blog that takes its roots from simply how to do something. It is good practice to write down the things that we do as sysadmins, because we all forget from time to time and it is nice to have a quick reference



Updated: 2018-03-06T14:43:08.156+09:00

 



How to Deny users Telnet or FTP access.

2008-06-21T11:46:12.197+09:00

vi /etc/inetd.conf

Comment the line starts with Telnet or
FTP. Save the file and exit.

Stop and start the inetd daemon now by
following commands:

/etc/rc2.d/S72inetsvc stop

/etc/rc2.d/S72inetsvc start

(Your flavor may be /etc/init.d)

or
send a hang-up (HUP) signal to the inetd process to force it to reread the configuration file:

# pkill -HUP inetd

From now on, no one can telnet or FTP to your
server from outside network.



How to change someones shell in NIS+

2008-01-22T21:24:22.642+09:00

nistbladm -e shell=/bin/tcsh '[name=username]'passwd.org_dir



Find

2008-01-22T21:20:39.206+09:00

The -exec extension to the find command is a very useful and
flexible utility.

You can use it to get a nice list of all the files in a directory
tree:

find . -type f -exec ll {} \;

or to copy all the files in a directory tree into one, large
directory:

find . -type f -exec cp -p {} /newdir \;

Or say now that you've copied all those files into one directory
there are too many .bak files to delete all at once with the 'rm'
command (yes, that's possible):

find . -name \*bak -exec rm {} \;



CHECKING FOR FILESYSTEMS THAT ARE FULL

2008-01-22T21:18:19.268+09:00

Many times we have a file
systems which is too full.
To quickly find out which
are the file system
We could use:

df -k|awk '{if ( $4 >= 90 ) print $4," " $7 }'


Check the fields on your
flavor, it may not be $4 or $7.
Yours could be different.



basic subnetting

2008-01-22T21:16:22.663+09:00

subnet 101

TCP/IP

0 - 255 = 256

4 -2
8-6
16 -14
32 - 30
64 - 62
128 - 126
256 - class C

example : I need 18 new IPs so:

256 - 32 = 224 since you have to round off to the next highest.

.224 will be the new subnet

therefore I have 30 available to use on the new 224 subnet. 32 + 30 = 62

.32 .33 .34 .35 .36 .37 .38 ....... .62



How to view the time that it takes for a packet to cross the network

2007-12-31T20:57:00.818+09:00

# ping -s (ip)



how to change a timestamp on a file?

2007-12-31T19:41:30.887+09:00

# passwd -n 14 -x 84 -w 14 (file)



How to duplicate a drive--diskdup

2007-12-31T19:40:12.095+09:00

# dd if =/dev/rdsk/(input file ex. c1t1d0s2) of= /dev/rdsk/(outputfile ex.c1t2d0s2) bs=64k



How to sort largest files first

2007-12-31T19:37:33.043+09:00

# du -adsk | sort -rn | more



How to see if the account is locked in Nis

2007-12-31T19:35:24.730+09:00

If you are running nis or nis+ and want to see if a user is locked out

do

# niscat passwd.org_dir | grep -i (user name)



To check CPU utilization

2007-12-31T19:33:01.935+09:00

log on to the system

# su -

/usr/ucb/ps -aux | more

./ps -aux | more



how to bring up another xterm

2007-12-31T19:31:21.200+09:00

# /usr/openwin/bin/xterm &


do a # which xterm to find your path, but most should be the above.



how to eject a tape

2007-12-31T19:29:53.483+09:00

# mt -f /dev/rmt/0 offline

or
# mt -f off works also



some system checks

2007-12-29T16:26:41.381+09:00

The first thing I do when I take over a new system , is write a check script.
You can check several things and tailor it to your system, but here are a few to get you started:

check for users and groups that are equal with root

# grep ':00*:' /etc/passwd

check for invalid passwords
# grep invalid /usr/adm/syslog

list the last 20 logins

# last | head -20


#/usr/platform/sun4u (uname -n)/sbin/prtdiag -v

will show you useful hardware information.

#df -k -F ufs

will show you only local disks , and show you the total space used space, and free space


#/usr/sbin/psrinfo -v

will show you the cpus adn their speed.



see how many users are logged in

2007-12-29T00:12:35.598+09:00

ps -ef | awk `{print $1}` | sort|uniq| wc -l



sort largest files first

2007-12-29T00:10:38.185+09:00

# du -adsk | sort -rn | more



global replace in vi

2007-12-29T00:08:59.895+09:00

nice bit of information , although who uses vi any more ? gvim, nedit maybe.

# : / $ s /(search for this)/( replace with this) / g



zero out a file

2007-12-29T00:00:19.643+09:00

most sysadmins know this , but I am not sure who my audience is going to be yet.

anyway in order to zero out a file ...wtmp for example

cat /dev/null > wtmp (filename)



send an xterm

2007-12-28T23:57:48.262+09:00

often in my business I have to tell customers to send me an xterm.

here is how

/usr/openwin/bin/xterm -display (ip):0.0 &



only second column of /etc/hosts

2007-12-28T23:54:35.557+09:00

just a quick one to get things started
a command to look at only the second column(ie host names) in the /etc/ hosts file?

more /etc/hosts | awk `{print $2}`