Monday 2 December 2013

UNIX- Basic Utilities Commands

1) ps [options] show status of active processes
ps is used to report on processes currently running on the system. The output format and valid
options are very specific to the OS and program version in use.
Syntax
ps [options]

2) script file saves everything that appears on the screen to file until exit is executed
script creates a script of your session input and output. Using the script command, you can capture
all the data transmission from and to your terminal screen until you exit the script program. This can
be useful during the programming-and-debugging process, to document the combination of things
you have tried, or to get a printed copy of it all for later perusal.
Syntax
script [-a] [file] <. . .> exit

3) whereis [options] command report the binary, source, and man page locations for the command
named

4) which command reports the path to the command or the shell alias in use

5) who or w report who is logged in and what processes are running
J10BCPNCAP $ who
root       console      Apr 26 10:17
tibadmin   pts/17       Jun 30 09:37    (10.8.149.62)
oracle     pts/18       Jun 27 14:24    (10.8.85.140)
tibadmin   pts/19       Jun 30 10:09    (10.8.149.154)
tibadmin   pts/21       Jun 30 15:11    (10.8.149.91)
tibadmin   pts/26       Jun 30 12:10    (10.8.74.107)
tibadmin   pts/27       Jun 30 12:55    (10.8.74.107)

6) grep
 The grep utility is used to search for generalized regular expressions occurring in Unix files.The egrep utility provides searching capability using an extended set of meta-characters. The syntax of the grep utility, some of the available options, and a few examples are
shown below.
Syntax
grep [options] regexp [file[s]]
Common Options
-i ignore case
-c report only a count of the number of lines containing matches, not the
matches themselves
-v invert the search, displaying only lines that do not match
-n display the line number along with the line on which a match was found
-s work silently, reporting only the final status:
0, for match(es) found
1, for no matches
2, for errors
-l list filenames, but not lines, in which matches were found

7) whoami
J10BCPNCAP $ whoami
tibadmin

8) who am i
J10BCPNCAP $ who am i
tibadmin   pts/21       Jun 30 15:11    (10.8.149.91)

9) id
The purpose of
this command is to tell you what group or groups you’re in and the numeric identifier for your account name (known as your user ID number or user ID). Enter id and see what you get. I get the following result:
% id
uid=211(taylor) gid=50(users0) groups=50(users0)
%
J10BCPNCAP $ id
uid=1005(tibadmin) gid=1(other)

10) users-which lists the account names of all people using the system:
J10BCPNCAP $ users  
root tibadmin oracle tibadmin tibadmin tibadmin tibadmin

11) w
 w is a complex command which summarizes information
This is a much more complex command, offering more information than either users or who. Notice that the output is broken into different areas. The first line summarizes the status of the system and, rather cryptically, the number of programs that the computer is running at one time. Finally, for each user, the output indicates the user name, the tty, when the user logged in to the system, how long it’s been since the user has done anything (in minutes and seconds), the combined CPU time of all jobs the user has run, and the amount of CPU time taken by the
current job. The last field tells you what you wanted to know in the first place: what are the users doing?



  3:18pm  up 65 day(s), 11:12,  7 users,  load average: 1.39, 1.42, 1.43
User     tty           login@  idle   JCPU   PCPU  what
root     console      26Apr1165days                -sh
tibadmin pts/17        9:37am  5:40      1      1  tail -100f SUBSCRIPTION_DTH-Proc
oracle   pts/18       Mon 2pm 3days                oracleSDP (DESCRIPTION=(LOCAL=YE
tibadmin pts/19       10:09am  5:09      1      1  tail -f SUBSCRIPTION_DTH-Process
tibadmin pts/21        3:11pm                      w
tibadmin pts/26       12:10pm  3:07                -sh
tibadmin pts/27       12:55pm  2:22                less ICCM_BW-ICCM_BW.log

12) cal
shows a simple calendar for the month or year specified.
eg:
$ cal
   June 2011
 S  M Tu  W Th  F  S
          1  2  3  4
 5  6  7  8  9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30



For a particular month cal [ [month] year ]
$ cal 3 1988
   March 1988
 S  M Tu  W Th  F  S
       1  2  3  4  5
 6  7  8  9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31



cal 2007
                                2007



         Jan                    Feb                    Mar
 S  M Tu  W Th  F  S    S  M Tu  W Th  F  S    S  M Tu  W Th  F  S
    1  2  3  4  5  6                1  2  3                1  2  3
 7  8  9 10 11 12 13    4  5  6  7  8  9 10    4  5  6  7  8  9 10
14 15 16 17 18 19 20   11 12 13 14 15 16 17   11 12 13 14 15 16 17
21 22 23 24 25 26 27   18 19 20 21 22 23 24   18 19 20 21 22 23 24
28 29 30 31            25 26 27 28            25 26 27 28 29 30 31



         Apr                    May                    Jun
 S  M Tu  W Th  F  S    S  M Tu  W Th  F  S    S  M Tu  W Th  F  S
 1  2  3  4  5  6  7          1  2  3  4  5                   1  2
 8  9 10 11 12 13 14    6  7  8  9 10 11 12    3  4  5  6  7  8  9
15 16 17 18 19 20 21   13 14 15 16 17 18 19   10 11 12 13 14 15 16
22 23 24 25 26 27 28   20 21 22 23 24 25 26   17 18 19 20 21 22 23
29 30                  27 28 29 30 31         24 25 26 27 28 29 30



         Jul                    Aug                    Sep
 S  M Tu  W Th  F  S    S  M Tu  W Th  F  S    S  M Tu  W Th  F  S
 1  2  3  4  5  6  7             1  2  3  4                      1
 8  9 10 11 12 13 14    5  6  7  8  9 10 11    2  3  4  5  6  7  8
15 16 17 18 19 20 21   12 13 14 15 16 17 18    9 10 11 12 13 14 15
22 23 24 25 26 27 28   19 20 21 22 23 24 25   16 17 18 19 20 21 22
29 30 31               26 27 28 29 30 31      23 24 25 26 27 28 29
                                              30
         Oct                    Nov                    Dec
 S  M Tu  W Th  F  S    S  M Tu  W Th  F  S    S  M Tu  W Th  F  S
    1  2  3  4  5  6                1  2  3                      1
 7  8  9 10 11 12 13    4  5  6  7  8  9 10    2  3  4  5  6  7  8
14 15 16 17 18 19 20   11 12 13 14 15 16 17    9 10 11 12 13 14 15
21 22 23 24 25 26 27   18 19 20 21 22 23 24   16 17 18 19 20 21 22
28 29 30 31            25 26 27 28 29 30      23 24 25 26 27 28 29
                                              30 31




13) bc
The bc utility implements an arbitrary precision calculator.It  takes  input  from  any files given, then reads from the standard input.
J10BCPNCAP $ bc
4*2
8
5-8
-3
6+9
15
sqrt(25)         
5


14) dcThe dc command works with the postfix notation, and each number or operation must be on its own line. Further, the result of an operation isn’t
automatically shown; you have to enter p to see the most recently calculated result.


J10BCPNCAP $ dc

9
*
p
81

No comments:

Post a Comment