here are the commands needed while working with websphere
ssh username@<hostname/ip address>
telnet <hostname/ip address>
scp username@<hostname/ip address>:<src file path> <trgt path>
ftp <hostname/ip address>
uname -n
uname -a
cat /etc/*-release ----> only for linux. not working for AIX,
ping <hostname/ipaddress>
Some time it is necessary to increase or decrease timeouts on TCP sockets. You can use/proc/sys/net/ipv4/tcp_keepalive_time to setup new value.
ulimit ---- tcp connection limit
ssh username@<hostname/ip address>
telnet <hostname/ip address>
scp username@<hostname/ip address>:<src file path> <trgt path>
ftp <hostname/ip address>
uname -n
uname -a
cat /etc/*-release ----> only for linux. not working for AIX,
ping <hostname/ipaddress>
Some time it is necessary to increase or decrease timeouts on TCP sockets. You can use/proc/sys/net/ipv4/tcp_keepalive_time to setup new value.
ulimit ---- tcp connection limit
Most used commands in
WAS
1) Tell me the
command to find RAM size in AIX/Unix?
A)
prtconf only for AIX.
2) Command to find
disk free space?
A)
df -k or m
3) In ls -lrt, what t
stands for and r stands for l stands for?
-l shows you huge amounts of information
(permissions, owners, size, and when last modified.)
-r reverses the order of how the files are
displayed.
-t shows you the files in modification time
4) How to check a
particular port is listening or not in UNIX?
A)
netstat -a| grep 80
5) How do you perform
heap dump and thread dump?
A)
kill -3 <pid>
6). How to check disk
usage in Linux or UNIX?
A)
du -k
7). How to check the
multiple NIC in Unix or Linux?
A)
ifconfig -a
8). How to identify
and kill a process ID?
A)
ps -ef
10) To find the no.of
running JAVA process
A)
ps -ef | grep java| wc -l
11)
How to find out that a port is listening on remote Box ?
A)
telnet Hostname 80
12) What to see only
last 10 lines of a log file ?
A)
tail -10 logfilename
Files
ls –l lists
your files in 'long format', which contains lots of useful information, e.g.
the exact size of the file, who owns the file and who has the right to look at
it, and when it was last modified.
ls –a lists all files,
including the ones whose filenames begin in a dot, which you do not always want
to see.
ls –altr a option is to show
the hidden files
more filename shows
the first part of a file, just as much as will fit on one screen. Just hit the
space bar to see more or q to quit. You can use /pattern to search for a
pattern.
emacs filename is an editor that lets you create
and edit a file.
rm -f file name to delete files without interation
cp file1 file2 copies file1 to file2
chmod 777 filename to give all permissions (read 4, Write 2,
execute 1)
chmod 644 filename to give write permissions
diff filename1
filename2 compares files, and shows where they
differ
wc filename tells you how many lines,
words, and characters there are in a file
File Compression:
Making Archive file:
tar -cvf tarfilename(samlogserver).tar
file1 file2
To make tar file of
files1,file2....
gzip filename compresses
files, so that they take up much less space. Usually text files compress to
about half their original size, but it depends very much on the size of the
file and the nature of the contents. There are other tools for this purpose,
too (e.g. compress), but gzip usually gives the highest compression rate. Gzip
produces files with the ending '.gz' appended to the original filename.
gunzip filename uncompresses files compressed by
gzip.
gzcat filename lets you look at a gzipped file
without actually having to gunzip it (same as gunzip -c). You can even print it
directly, using gzcat
filename lpr
gzcat tarfilename
tar-xvf
gzip tarfilename (
Compresses the archived tar file)
gunzip gzfilename
jar -tvf jar file
name It shows list of
classes in the jar file
zip filename.zip
filename Zipping a file and
opening a file in windows
Disk Size:
du -hs file
name/directory To get the size of the
file/directory
df –h size of
each mount
du -hs SUNWam To get the size of SUNWam
file/directory
Finding things
ff --- find files
anywhere on the system. This can be extremely useful if you've forgotten in
which directory you put a file, but do remember the name. In fact, if you use
ff -p you don't even need the full name, just the beginning. This can also be
useful for finding other things on the system, e.g. documentation.
grep string
filename(s)
--- looks for the string in the files. This can be useful a lot of purposes,
e.g. finding the right file among many, figuring out which is the right version
of something, and even doing serious corpus work. grep comes in several
varieties (grep, egrep, and fgrep) and has a lot of very flexible options.
Check out the man pages if this sounds good to you
find ./ -name
'direcorty or file name' ----------------- finds the given direcorty or file
name.
find . -name *.log
-exec grep -il oracle {} ;
find . name *.* -exec
grep -il 'Enter new PIN, containing 4 to 8 characters' {};
find . | xargs grep
"p-level Policy Admin Role,ou=role,dc=dupont,dc=com,amsdkdn=cn"
find . | xargs grep
stg
Miscellanious:
lsof | grep slapd |
grep LISTEN -------- to find
portnumber of the various slapd instances
lsof | grep ldaprole
| grep LISTEN -------- to find
portnumber of various ldaprole instances
ps -ef | grep slapd --------- to find the
DS Instances are running or not
export PATH=$PATH:/opt/sfw/bin --------- to export the bin path
nohup Run the command in
the background & Run the command even if Putty gets logged out
Roles:
id
to get the current ID
sudo
su - eisadmin ---------to get
eisadmin permissions
sudo
stop/start
sudo
-l to get the list of sudo permissions
sudo
su - root ------ to get the root permissions
sudo
su - ldaprole to get ldaprole permission
About Other People
w --- Tells you who's logged in, and
what they're doing. Especially useful: the 'idle' part. This allows you to see
whether they're actually sitting there typing away at their keyboards right at
the moment.
who --- Tells you who's logged on, and where
they're coming from. Useful if you're looking for someone who's actually
physically in the same building as you, or in some other particular location.
finger username --- Gives you lots of information
about that user, e.g. when they last read their mail and whether they're logged
in. Often people put other practical information, such as phone numbers and
addresses, in a file called .plan. This information is also displayed by
'finger'.
last -1 username --- Tells you when
the user last logged on and off and from where. Without any options, last will
give you a list of everyone's logins.
talk username --- lets you have a (typed) conversation
with another user
write username --- lets you exchange one-line messages with
another user
elm --- lets you send
e-mail messages to people around the world (and, of course, read them). It's
not the only mailer you can use, but the one we recommend. See the elm page,
and find out about the departmental mailing lists (which you can also find in
/user/linguistics/helpfile).
About Your Self
whoami --- returns your
username. Sounds useless, but isn't. You may need to find out who it is who
forgot to log out somewhere, and make sure *you* have logged out.
finger & .plan
files
of
course you can finger yourself, too. That can be useful e.g. as a quick check
whether you got new mail. Try to create a useful .plan file soon. Look at other
people's .plan files for ideas. The file needs to be readable for everyone in
order to be visible through 'finger'. Do 'chmod a .plan' if necessary. You
should realize that this information is accessible from anywhere in the world,
not just to other people on turing.
passwd --- lets you change
your password, which you should do regularly (at least once a year). See the
LRB guide and/or look at help password.
ps -u yourusername --- lists your
processes.
quota -v --- show what your
disk quota is (i.e. how much space you have to store files), how much you're
actually using, and in case you've exceeded your quota (which you'll be given
an automatic warning about by the system) how much time you have left to sort
them out (by deleting or gzipping some, or moving them to your own computer).
du filename --- shows the disk
usage of the files and directories in filename (without argument the current
directory is used). du -s gives only a total.
last yourusername --- lists your last
logins. Can be a useful memory aid for when you were where, how long you've
been working for, and keeping track of your phonebill if you're making a
non-local phonecall for dialling in.
Connecting To The
Outside World
nn --- allows you to
read news. It will first let you read the news local to turing, and then the
remote news. If you want to read only the local or remote news, you can use nnl
or nnr, respectively. To learn more about nn type nn, then \tty{:man}, then
\tty{=.*}, then \tty{Z}, then hit the space bar to step through the manual. Or
look at the man page. Or check out the hypertext nn FAQ - probably the easiest
and most fun way to go.
rlogin hostname --- lets you connect
to a remote host.
telnet hostname --- also lets you
connect to a remote host. Use rlogin whenever possible.
ftp hostname --- lets you download
files from a remote host which is set up as an ftp-server. This is a common
method for exchanging academic papers and drafts. If you need to make a paper
of yours available in this way, you can (temporarily) put a copy in /user/ftp/pub/TMP.
For more permanent solutions, ask Emma. The most important commands within ftp
are get for getting files from the remote machine, and put for putting them
there (mget and mput let you specify more than one file at once). Sounds
straightforward, but be sure not to confuse the two, especially when your
physical location doesn't correspond to the direction of the ftp connection
you're making. ftp just overwrites files with the same filename. If you're
transferring anything other than ASCII text, use binary mode.Â
lynx --- lets you browse
the web from an ordinary terminal. Of course you can see only the text, not the
pictures. You can type any URL as an argument to the G command. When you're
doing this from any Stanford host you can leave out the .stanford.edu part of
the URL when connecting to Stanford URLs. Type H at any time to learn more
about lynx, and Q to exit
date --- shows the
current date and time.Â
cal --- shows a calendar
of the current month. Use e.g., 'cal 10 1995' to get that for October 95, or
'cal 1995' to get the whole year
VI Editor Commands:
Saving a file:
:w write
current contents to file named in original
vi call.
:w newfile write current contents to a new file
named newfile.
:w! prevfile write current contents over a pre-existing
file named prevfile.
Exit vi:
:x quit vi, writing out modified file to file
named in original invocation.
:wq quit vi, writing out modified file to file
named in original invocation.
:q quit (or exit) vi
:q! quit vi even though latest changes have not
been saved for this vi call
Moving
the Cursor:
j [or down-arrow] move cursor down one
lineÂ
k [or
up-arrow] move cursor up one lineÂ
0 (zero)
move cursor to start of current line (the one with the cursor)Â
$ move
cursor to end of current lineÂ
:0 or 1G move cursor to first line in
fileÂ
:$ or G move cursor to last line in
fileÂ
Screen Manipulation:
^f
move forward one screen
^b
move backward one screen
Text
Editor:
U UNDO WHATEVER YOU JUST DID; a simple
toggle
i insert text before cursor,
until hit
I insert text at beginning of current
line, until hit
a append text after cursor,
until hit
A append text to end of current line,
until hit
o open and put text in a new line below
current line, until hit
O open and put text in a new line above
current line, until hit
r replace single character under cursor
(no needed)
x delete single character under cursor
dd delete entire current line
D delete the remainder of the line,
starting with current cursor position
yy copy (yank, cut) the current line into
the buffer
p put (paste) the line(s) in the buffer
into the text after the current line
/string search forward for occurrence of string in
text
?string search backward for occurrence of string in
text
Crontab
Cron
is a unix, solaris utility that allows tasks to be automatically run in the
background at regular intervals by the cron daemon. These tasks are often
termed as cron jobs in unix , solaris.
Crontab
(CRON TABle) is a file which contains the schedule of cron entries to be run
and at specified times.
Commands
export
EDITOR=vi ;to specify a editor to open crontab file.
crontab
-e Edit your crontab file, or create one if it doesn't already exist.
crontab
-l Display your crontab file.
crontab
-r Remove your crontab file.
crontab
-v Display the last time you edited your crontab file. (This option is only
available on a few systems.)
Syntax
A
crontab file has five fields for specifying day , date and time followed by the
command to be run at that interval.
*
* * * * command to be executed
|
| | | |
|
| | | +---- day of week (0 - 6) (Sunday=0)
|
| | +------ month (1 - 12)
|
| +-------- day of month (1 - 31)
|
+---------- hour (0 - 23)
+------------
min (0 - 59)
*
in the value field above means all legal values as in braces for that column.
The
value column can have a * or a list of elements separated by commas. An element
is either a number in the ranges shown above or two numbers in the range separated
by a hyphen (meaning an inclusive range).Â
Ex:
01
* * * * root echo "This command is run at one min past every hour"
17
8 * * * root echo "This command is run daily at 8:17 am"
17
20 * * * root echo "This command is run daily at 8:17 pm"
00
4 * * 0 root echo "This command is run at 4 am every Sunday"
*
4 * * Sun root echo "So is this"
42
4 1 * * root echo "This command is run 4:42 am every 1st of the
month"
01
* 19 07 * root echo "This command is run hourly on the 19th of July"
Example
A
line in crontab file like below removes the tmp files from /home/someuser/tmp
each day at 6:30 PM.
30
18 * * * rm /home/someuser/tmp/*
Changing
the parameter values as below will cause this command to run at different time
schedule below :
min
hour day/month month day/week Execution time
30
0 1 1,6,12 * -- 00:30 Hrs on 1st of Jan, June & Dec.
:
0
20 * 10 1-5 --8.00 PM every weekday (Mon-Fri) only in Oct.
:
0
0 1,10,15 * * -- midnight on 1st ,10th & 15th of month
:
5,10
0 10 * 1 -- At 12.05,12.10 every Monday & on 10th of every month
:
Note
: If you inadvertently enter the crontab command with no argument(s), do not
attempt to get out with Control-d. This removes all entries in your crontab
file. Instead, exit with Control-c.
Generate log file
To
collect the cron execution execution log in a file :
30
18 * * * rm /home/someuser/tmp/* > /home/someuser/cronlogs/clean_tmp_dir.log
New
df, du, and ls Options
The
df, du, and ls commands have a new h option for displaying disk usage and file
or file system sizes that are easy to understand.
The
default form of the df command displays file system size in blocks (512 bytes).
The df output, in kilobytes, follows:
$
df -k / /usr
Filesystem
kbytes used avail capacity Mounted on
/dev/dsk/c0t0d0s0
192056 94788 78063 55% /
/dev/dsk/c0t0d0s6
1982988 829966 1093533 44% /usr
The
same file system sizes displayed in powers of 1024 follows:
$
df -h / /usr
Filesystem
size used avail capacity Mounted on
/dev/dsk/c0t0d0s0
188M 93M 76M 55% /
/dev/dsk/c0t0d0s6
1.9G 811M 1.0G 44% /usr
The
default form of the du command displays disk space in blocks (512 bytes). The
du output, in blocks, follows:
%
du -s k*
100
kadmin
98
kadmin.local
98
kdb5_util
90
keyserv
10
killall
The
same disk space displayed in powers of 1024 follows:
%
du -h k*
50K
kadmin
49K
kadmin.local
49K
kdb5_util
45K
keyserv
5K
killall
The
default form of the ls -l command displays file size in bytes. Use the ls -lh
command to display file size in powers of 1024:
%
ls -lh k
-r-xr-xr-x
1 root bin 49K Nov 30 03:32 kadmin
-r-xr-xr-x
1 root bin 49K Nov 30 03:32 kadmin.local
-r-xr-xr-x
1 root bin 49K Nov 30 03:32 kdb5_util
-r-xr-xr-x
1 root sys 44K Nov 25 04:37 keyserv
-r-xr-xr-x
1 root bin 4.3K Nov 25 04:36 killall
very good
ReplyDelete