Sie sind auf Seite 1von 6

du -sk

du -k
IMP UNIX COMMANDS USED IN WEBSPERE
1. ls -ltr list current directory
ls -la to show all files and directory including ones s
tarting with . eg: . and .. and .ssh and .profile etc.
ls -ltr /bin/usr | grep "nav$" to search the files in 'usr' dir
ectory of ending with 'nav'
2. uname -a shows the OS for Solaris
oslevel -r shows the OS for AIX
3. df -k shows the (file system)partition space
df -kh to show in GB of partition space (h options not
available on all systems)
4. du -k | sort -n to show tree structure directory --- (total spac
e & Avaialable) WRONG
df -k /tmp to know the spcae available in filesystem where
/tmp directory resides.
du -sk directory size
5. netstat -an displays the port & local address & foreign addr
ess state
netstat -an | grep 9091 to search for 9091 port
6. nslookup shows IP & hostname
7. ps -eaf | grep PID shows the process ID by filtering
8. find . -name myFileName search file by name myFileName is current direct
ory which is denoted by .
9. find . -exec ls -lrt execute the command (eg here ls -lrt) on the res
ult of the previous command here (find . -> means all files and directories in c
urrent dir)
find / | grep "log$" displays all files ends with 'log' in the whole
system (need root authority)
find / | grep "robert" displays all files which has 'robert' in its nam
e in the whole system. (need root authority)
10. ln -s lmsi2w_i2 lmsi2w soft link -- first file (actual physical file)
is linked to second file(just a pointer like a shortcut).
11. hostname displays the name of host(machine)
12. touch changes the file time stamp or creates a new fil
e if it does not already exist
13. rm -r recursively remove directories & files
14. chmod -R changes the permissions of the file recursively
15. chown -R changes the owner(and group) of the file recursi
vely
16. cd - changes the directory to previous directory
17. cd ~ or cd changes the home directory of the currently logg
ed in user
18. ssh - hostname connects to that particular host as the currentl
y logged in user
ssh tempuser@hostname connects to that particular host as the user nam
ed tempuser
19. kill -9 <PID> kills the particular process ID.
20. kill -3 <PID> to take (java) Thread dump.
21. > <file name> to pass (redirect) the output to "file name" Ex:
- #banner naveen >lnav
22. cat /dev/null > file to empty file
23. sleep x wait "X" amount of seconds.
24. & to run in back ground. Ex- #startnode.sh & (to
run script in backgorund) or ^z after commnad runs
25. bg continuous stopped job in the back ground
26. fg conti...stopped job in the foreground.
27. tar -cvf x.tar a b c Create tar file x.tar consisting of files or dir
ectories a, b, c
28. tar -xvf x.tar untar (unzip) tar file x.tar in current director
y
29. tar -tvf x.tar just display contents of x.tar to screen without
untarring it
30. java -version displays the Java version (finds java from your
path). if you want version of a specific java installation on you machine, go to
the directory where it is installed and issue ./java -version.
31. compress, uncompress compresses file having extension -- .z
32. users I dont think there is a command like this
33. diff a b prints the lines that are different
34. gzip <filename> compress the file.
gzip -9 <filename> max compression but long time
35. gunzip <filename> uncompress the file.
36. more <filename> Displays file one page at a time.
37. passwd allows you to change the password.
38. wc counts the no of lines (-l) words (-w) and bytes
or characters (-c) for each file
39. who shows who is logged in
40. uptime shows how long the system has been up.
41. finger scott gives the full name of logged in user with usern
ame as scott
42. tail filename shows the last 10 lines of the file.
43. tail -f filename -f shows the last 4 lines with process going lin
es means if more lines are written it will keep showing them. Control will not c
ome back to command prompt. You have to hit Ctrl+C to get it back. Otherwise it
will keep waiting there and will list out the new lines as they are being writte
n.
tail -5 filename shows last 5 lines.
44. tail -50f last 50 lines + show running text
head -5 shows the first 5 of the file.
45. cat to view the entire file.
46. ; to execute 'n' no of commands. ex:- ls -lrt ; pw
d ----> list and path
47. crontab -l list the crontab file which contains list of com
mands that you want to run on a regular schedule.
crontab -e edit the above file
48. ps -eaf | grep <sysname> | awk '{print $2}' to show PID only
one excluding "grep PID" & show only PID no.
49. ps -eaf | grep <sysname> | awk '{print $2}' | xargs kill -9 <pid>
2 commands at once - show & kill.
50.* /usr/ucb/ps -auxww | grep java | grep -v grep (for solaris)
/usr/ucb/ps -auxww | grep dmgr
lsof -i:60040 lists the connections of the port 60040

51. less <filename> To see the contents of the file like MORE comman
d. but is more useful than MORE. just type vi to enter vi mode.
52. sudo
53 su switch user to act as another user
54. alias nav="ls" the alias ls given to nav,so when u enter nav it
lists files.
55. alias to see all the alias names.
56. unalias nav to remove alias for nav.
57. . Present working directory
58. id or whoami displays who am i loogged in as.
59. $PWD/
60 cd - goes to previous directory
61. ssh <username>@boxname login to another machine from current box.
62. ftp <HOST IP> To login to another machine
63. ftp>!pwd to show the path in the local machine
64. ftp>pwd to show the path of remote machine.
64. scp to copy file from one box to another box
scp -pr root@ws02.akt.com:/apps/software/* <target>
scp rrobert@ws02.akt.com:/tmp/software.tar . ---> secure copy
64. echo $SHELL to check the shell name (bsh,csh,ksh)
65. . .profile to run profile.
66. export PS1='#' to change the prompt
67 grep -i ravi * to find lines in all files in current dir which
contain string "ravi"
find / -name <f.n> to find a file with its name in the dir / i.e in
the whole system
find / | grep *.tar or "tar$"
history | grep grep
shell
export PS1='nav' to change prompt to 'nav'
env show the environment variables
echo $PATH
cd ../../bin to go to 2 directories back and entering into "b
in" in that
ifconfig -a to check the IP address of this host
sun uname -a to see O/S & version.
Aix oslevel -r to see the version of Aix
groups to check the group of your user.
groups wasadmin to show the group of the user called wasadmin
top see the processor usage for top cpu consuming pr
ocesses
umask file mode creation mask - display it to screen
telnet <H.N> or user@<H.N>
SSH <H.N> or user@<H.N>
nslookup www.yahoo.com
mkdir -p /tmp1/tmp2/tmp3 this creates dir tmp1 and dir tmp2 insid
e it and dir tmp3 inside it.
which cd displays which dir "cd" command is found in - in
your PATH
which grep displays which dir "grep" command is found in -
in your PATH
which ps displays which dir "ps" command is found in - in
your PATH
env shows the environment variables
ls -lrt /usr/bin | grep "ps$" shows the files which ends with "ps"
groupadd <wasadmin>
useradd -g wasadmin -d /home/wasadmin -s /bin/bash -c
usermod wasadmin nrobert to add existing user "nrobert" t
o "wasadmin" group
last To show the users logged in
prtconf Solaris system conf
lsof -i:port See what process is listening on this port.
echo $? to check exit status of previous commnad ******
0 for success, 1 for failure, 2 for other or incomplete
pkginfo to view all installed packages (softwares)
pkgadd to add / install packages
pkgrm to remove /uninstall packages
Sol pkginfo | grep -i websphere to search for packages of websphere in s
ol
Aix lslpp -al | grep -i websphere to search for packages of websphere in A
ix
rm -r <Directory of F.n> To delete all files in directory recursively
export DISPLAY=192.168.1.1:1 to set the display path for the X
window of hummingburd
ps -ef | grep httpd to see http webserver is running
jobs To see the what jobs are running
^z or Ctrl+Z to get control back and put the running process
in background
^c or Ctrl+C to cancel or come out of a command
^D or Ctrl+D to log out or exit from the shell or system
Sol pkginfo | grep -i websphere To check websphere inst
all in Solaris
more /var/sadm/pkg/WSBAA51/pkginfo | grep BASEDIR | cut -d= -f2
To know the path of the WSBAA51
Aix lslpp -aL | grep -i websphere To check websphere insta
ll in Aix
grep WSBJAAA /usr/lib/objrepos/vpd.properties
To know the path of the WSBJAAA

ANY-ANY ********** FTP COMMANDS *************


Some useful FTP commands available on most systems include:
ascii Switch to ASCII mode. ASCII mode is the default mode; us
e it for transferring text files.
bin or binary Switch to binary mode. Use to transfer binary files, inc
luding files ending in ear zip tar Z and gz, executable programs, and graphics f
iles.
bye Close the connection to the remote computer and exit FTP
.
cd Change the directory on the remote computer.
close Close the connection to the remote computer.
del Delete files from the remote computer.
dir (or ls) List the files in the current directory on the remote co
mputer.
get Copy a file from the remote computer to the local comput
er.
hash Displays a # on the screen for every block of bytes tran
sferred. A block is 1024 bytes in some cases, 2048 in others, but is between
1024 and 4096 in most cases. Check FTP's online help for the number represented
in the FTP program you are using.
help (or ?) Lists or provides help on the use of FTP com
mands.
lcd Change the directory on the local computer.
lpwd Show the current directory (present working directo
ry) on the local computer. This command is not available in all FTP versions.
On Unix systems, try !pwd if lpwd doesn't work.
mdel Delete multiple files on the remote computer.
mget Copy multiple files from the remote computer to the loca
l computer.
mkdir Create a directory on the remote host.
mput Copy multiple files from the local computer to the remot
e computer.
open Open a connection to a remote computer.
prompt Turn on (or turn off) file transfer prompting. Often use
d to turn off prompting when using mdel, mput, or mget so that you are not
required to confirm the transfer of each file before it is transferred.
put Copy a file from the local computer to the remote comput
er.
pwd Show the current directory (present working directory) o
n the remote computer.
rmdir Remove a directory on the remote host (the directory usu
ally has to be empty).
user Log into the remote computer to which you are currently
connected. FTP will ask for a login name and possibly a password.
! In Unix, exit to the shell prompt, where you can enter c
ommands. Enter exit to get back to FTP. If you follow ! with a command (e.g.,
!pwd), FTP will execute the command without dropping you to the Unix prompt.

UX-UX scp -rp recursively "r" for whole directory "p" to preserve perm
issions.
scp -rp readme nrobert@ws02.akt.com: - copy readme file (or if it is
a dir , the dir itslef and recursively everything under it while preserving perm
issions of all dirs and permissions) to box called ws02.akt.com and log in as us
e nrobert to that box and put the file in home directory of that user- this is b
ecause of there is nothing after the last ":" symbol after the boxname.
scp nrobert@ws02.akt.com:/tmp/software.tar . - copy the file from the bo
x ws02.akt.com by connecting to that box as nrobert and copy the file software.t
ar from /tmp directory in that box to currect directory ( because of "." ) in th
e currect box.
WN-UX pscp - you should download this from putty download page.
groupadd wasadmin
useradd -g wasadmin -d /home/wasadmin -s/bin/bash -c
usermod -g wasadmin nrobert --> to add existing user to wasadmin gro
up.
find . -type d Display directories
find . -type f Display files
find / -size +9999 | more --> search files which are more than 9999kb
find / -name <f.n> to search file name
find . -exec ls -lrt () \; To display all files in a current directory
like TREE
prstat same like top command, displays process statistics
cp -pr * toSomePlace copy all with preserve Attributes recorsive

#set semsys:seminfo_semume = 256


#/usr/ucb/ps -auxww | grep java | grep -v grep | awk '{print $2}' ---> to show t
he PID ony one excluding 'GREP PID' & awk..shows PID no only..
#/usr/ucb/ps -auxww | grep java | grep -v grep | awk '{print $NF}' --> to show
the all java process except grep process by printing last field name.
#/usr/ucb/ps -auxww | grep java | grep -v grep | awk '{print $NF}' | xargs /apps
/WebSphere/app/v51/bin/stopServer.sh to issue stopServer command to all runni
ng app servers and nodeagent and dmgr -- note that this will also grep out the o
peratins system java processes and we will get some error like no such server fo
und in configuration.
process of the JAVA and filtering the grep proce
ss and ---------and stopping the server in single commnad.
#/usr/ucb/ps -auxww | grep java | grep -v grep | awk '{print $NF}' | xargs ls -l
rt --->
#/usr/ucb/ps -auxww | grep java | grep -v grep | awk '{print $NF}' | xargs echo
" this server is "
#ls -lrt /apps/WebSphere/app/v51/config/cells/ws02.akt.com/nodes/ws02.akt.com/se
rvers/ | grep -v total
#ls -lrt /apps/WebSphere/app/v51/config/cells/ws02.akt.com/nodes/ws02.akt.com/se
rvers/ | grep -v total | awk '{print $NF}'
#for i in `ls -lrt /apps/WebSphere/app/v51/config/cells/ws02.akt.com/nodes/ws02.
akt.com/servers/ | grep -v total | awk '{print $NF}'`; do /apps/WebSphere/app/v5
1/bin/startServer.sh $i; done

**************************see below for SENDING AUTOMATIC MAIL PROBLEM IN SCRIPT


***********
$which sendmail
no sendmail in /usr/bin /usr/ucb /etc .
$ echo $PATH
/usr/bin:/usr/ucb:/etc:.
$ ls -lrt /usr/sbin/sendmail
lrwxrwxrwx 1 root root 15 Jan 24 20:21 /usr/sbin/sendmail -> ../
lib/sendmail
@@@@@@@@@ set path in the /usr/sbin/sendmail in the script @@@@@@@@@@@@@

cat was_install_prep.052507162806 | mail naveenrobert@akt.com -> to send thi


s text to mail.

Das könnte Ihnen auch gefallen