Sie sind auf Seite 1von 5

Some Unix commands

HELP type Displays the description of the command : man c <command> General system help : smit Very basic help : help Display terminal settings keyboard settings : stty a These are typical results : intr = ^C; quit = ^\; erase = ^H; kill = ^U; eof = ^D; eol = ^@ start = ^Q; stop = ^S; susp = ^Z; dsusp = ^Y; reprint = ^R discard = ^O; werase = ^W; lnext = ^V Line continuation character = / Configuration / Environment type To list all volume groups : lsvg Use the results to get the logical volumes in a volume group : lsvg l <volumegroup> Use that output to get detailed information on for a particular logical volume : lslv <logical volume> To list the file systems in a volume group : lsvgfs <volumegroup> Which file systems are mounted in each volume group To display the currently mounted file systems in Kb: df k To list the physical volumes (the hard disks): lspv To list details about a hard disk, such as unallocated space: lspv hdisk2 System values: lsattr El mem0 lsattr El sys0 lsattr El proc0 Devices, such as processors smit lsdev - or lsdev -C

178989257.doc

Last printed 8/27/2004 09:31:00 AM

Users & Groups List the users and the groups they belong to : lsuser f a groups ALL OR lsuser f a pgrp groups home shell ALL Where the list of attributes following a come from those defined in the chuser command. List all groups : lsgroup f ALL List all processes : ps e -f Change a password: Passwd Commands Display current directory : pwd Display contents of current directory : ls -al The columns are mode, number of links, owner, group, size (bytes), time Display a file, one screen at a time : pg $ - go to end-of-file -n go back n pages +n go forward n pages Page at a time output : <command> | pg Switch to a different user : su <username> Use Ctrl-D to return Delete a file : del <filename> Search for a pattern in a file : grep Make a group : mkgroup a db2iadm3 Find a file in a given path find <path> -name <pattern> Example: find /db2/db2inst3 name db2c* -print

178989257.doc

Last printed 8/27/2004 09:31:00 AM

DB2 stuff Get the current db2 instance : db2 get instance Return the path to the db2cmd program (implies instance) : which db2 To see some DB2 "stuff" - list some information about the licensed software, such as version and fix pack level: lslpp -l | grep db2 You can get most of the same information with: db2level Create a new instance : cd /usr/lpp/db2_07_01/install ./db2setup Instance name db2inst3 New users db2inst3 db2fenc3 New groups db2iadm3 db2fadm3 Tcp/ip port = 3906 service name = db2inst3 Be sure to use an * to override all user and group id numbers To change instance (not advised) : DB2INSTANCE=db2inst3 export DB2INSTANCE Note the use of capital letters To change your path (not advised) : ./db2/db2inst3/sqllib/db2profile Others: Reboot the system : log on as root shutdown Fr Create a new directory in the current directory : mkdir <directory name> Copy a file from the current directory to a different directory : copy i <file name> <path to target directory> To copy myfile from the current directory to a different directory and rename it newfile : copy i myfile /db2/logs/newfile To move a file from the current directory : mv <file name> <target directory> To delete a file : rm <file name> del

178989257.doc

Last printed 8/27/2004 09:31:00 AM

Some performance monitoring commands: sar P ALL 15 iostat 15 vmstat 15 ps fu <user> set o vi esc (to k j h l x i esc (to activate edit mode) = up (back) = down = left = right = delete (at the cursor position) = insert at the cursor position (esc to turn it off) get out of edit mode) [allow all (default) to read, write, execute] [allow ALL (a) to execute (x) the file] [allow all to read, write, execute]

To grant rights to a file: chmod +rwx <file name> chmod a+x <file name> chmod 777 <file name>

Change ownership of a file: chown newowner:newgroup <filename> Get the last system boot time: uptime who b TAR, compress, uncompress, TAR a database backup tar cvf db2setup.tar DB2SETUP.0.-------.001 compress db2setup.tar uncompress db2setup.tar.Z tar xvf db2setup.tar Contents of a TAR: Tar vtf db2setup.tar To get some memory usage parameters: topas (as root only) monitor Try to look this up in v5.1. It should give usage values Smit look in here also to show process status and report system

Look at roots crontab: crontab l Get some information about processes running on the system: ps ps ef | grep db2inst3 Some info on message queues and shared memory segments; ipcs

178989257.doc

Last printed 8/27/2004 09:31:00 AM

ipcs | grep db2inst1

Kill a process (job) where pid = process_id: Kill -9 <pid> -9 = sigkill Some notes on system backup, but dont know how good they are: As root: smit mksysb <enter> Select Backup device or file <f4 for list> Select the tape drive (scsi is 20GB on old Louisville) <enter> <enter> Allocating space: As root: smit jfs Go to change / show I think allocation is in 512 byte chunks 2 = 1k 2000 = 1MB 2,000,000 = 1GB set -o noclogger To prevent redirection from overwrititng files cmd & Use the ampersand ( &) at the end of the command to run it in the background grep using this without specifying the input parameter will search all files in the current directory - I think cmd | tee > output.log writes to the log file and also displays it on the screen

178989257.doc

Last printed 8/27/2004 09:31:00 AM

Das könnte Ihnen auch gefallen