cmd.xls
1.1 alias
Create an alias for a command or shows which aliases exist. v.s. unalias.
Syntax alias [name = [“command”]]
Option or argument | Function |
Name | Specifies the alias name. |
Command | Specifies the command the name should be an alias for. |
Sample:
Type alias d=’ls –l’, you have just created a new command, d, which is the same as ls –l. To see which aliases you have defined, just type alias.
alias dir='ls -tFg |more'
1.2 aclget
show access control (AIX), similar with getfacl in solaris. (ls –l just show base information)
1.3 basename
Syntax: basename pathname [suffix].
Return filename only.
e.g.
basename /u/dee/desktop/cns.boo cns.boo result: cns.boo
basename /u/dee/desktop/cns.boo .boo result: cns
sh_name=`basename $0 | cut -f1 -d'.'`
1.4 bc
Precition.
Option or argument | Function |
-l | Set the scale variable to 20. |
Sample:
echo "9/2" | bc
4
echo "9.5/2" | bc
4
echo "9/2" | bc -l
4.50000000000000000000
echo "9.5/2" | bc -l
4.75000000000000000000
1.5 cat
Displays a file on-screen. stop at the bottom of file. Relate: more.
Syntax cat filename
Option or argument | Function |
-n | Add line number. |
Sample:
Type >cat bonus.plan
You can also use the cat command (which stands for catenate) to combine two or more files, like this:
cat file1 file2 file3 > one.big.file
cat test.sh test.sh test.sh | wc
1.6 cd
Changes the current working directory to the directory you indicate.
To move back to your home directory, type cd without any arguments.
To move to a directory that is not a subdirectory of the current working directory, you can use a full pathname – one that begins with a slash. For example, to look around in the /home directory (where all home directories are stored on some systems), type >cd /home
If you want to move to the last directory you were in, type >cd -.
Syntax cd [directory]
Option or argument | Function |
directory | Specifies the directory you want to move to. This directory becomes your current working directory. If you don’t use this option, you move to your home directory. |
Sample:
You log in and do some work in your home directory. Next you want to move into your budget directory to see which files are there. Type cd budget.
Type cd .. to move back up to the parent directory of budget. Sometime you might want to go up to more than one level of the parent directory, type “cd ../..”, you can go back up two levels of parent directory.
Type cd to move back default path (check default path via echo $HOME).
1.7 chgrp
Changes the group ownership of a file or directory.
chgrp [parameter] Group {File | Directory}
1.8 chmod
Changes the permissions for a file/directory. You have to own the file or directory to use this command.
If you leave the who letter out of the permission, chmod assigns the permission to everyone.
Refer to any detail, see Section 2.3.2 of this document.
Syntax chmod [-Rcfv] [-recursive] [-changes] [-silent] [-quiet] [verbose]
permission - drwxrwxrwx
d - directory
x - can use the file name as an argument in a command
first rwx - for owner
second rwx - for group
third rwx - for other (except the group)
r = 4, w = 2, x = 1.
e.g.
chmod 744 /hsbc/bcn/load/cmb_ocpr_pl_mh_conv1.id = -rwxr--r—
ls -l | awk '{if($1=="-rw-r-----") print $9}' | xargs chmod 644
Change mode in a batch.
1.9 chown
Changes the owner or group associated with a file.
Chown [parameter] Owner [:Group] {File | Directory }
1.10 clear
Clears the screen. This command does not affect files or jobs – it just clears the clutter from your screen.
Syntax clear
1.11 cmp
compare 2 binary files. Refer diff.
1.12 cp
Copies files/directory. Unlike in DOS, if you want to copy a file to current directory, you have to use a period (.) at the end of the command like, such as “cp file101”.
Syntax cp [-i] oldfiles newfiles
cp [-i] [-R] oldfiles directory[/newfiles]
Option or argument | Function |
-i | Asks before you replace an existing file with a copied file. |
-r | Copies file hierarchies under the file or directory specified by the SourceFile or SourceDirectory parameter (recursive copy). |
-R | When you copy a directory, also copies its subdirectories and creates new subdirectories as necessary. |
-f | Specifies removal of the target file if it cannot be opened for write operations. |
-h | Forces the cp command to copy symbolic links. |
-p | Duplicates characteristics like time, permission, user /group ID. |
oldfiles | Specifies the name of the file you want to copy. |
newfiles | Specifies the name to give to the new copy. |
directory | Specifies the name of the directory in which you want to store a copy. |
Sample:
Type cp /home/harold/margys.feb.expenses february.expenses
By including both a path and a filename to copy to, you tell cp to copy the file from the /home/harold/ directory and to name the new copy february.expenses.
cp -Rph /hsbc/bsg/databak/. /hsbc/bsg/data
1.13 ctmfw
ctmfw FILE(absolute path)
< mode (CREATE|DELETE)> Default: CREATE
< minimum detected size <number>
[' '|Bytes(B)|Kilo(K)|Mega(M)|Giga(G)] >Default:0
< interval between file search (seconds) > Default: 60sec
< interval between filesize comparison iterations (seconds) > Default: 10sec
< number of iterations while the size is static > Default: 3 iterations
< time limit for the process (minutes).> Default: 0 (no time limit)
Effective while the file does not exists or,
the file size is static and the minimum size
was not reached >
< monitor file size , minimal and maximal age, when wildcard is used > Default: N
< starting time for detecting files (HHMM or YYYYMMDDHHMM > Default: NOW
< absolute stop time (HHMM or YYYYMMDDHHMM > Default: +0000 ( No stop time )
< minimal age of file (modified time)
format:xxxxYxxxxMxxxxDxxxxHxxxxMin > Default: NO_MIN_AGE
< maximal age of file ( timestamp monitoring )
format:xxxxYxxxxMxxxxDxxxxHxxxxMin > Default: NO_MAX_AGE
e.g. ctmfw /hsbc/wsd/indata/qwin/pdb2/tbbstxdh.ok CREATE 0 300 10 30 60)
1.14 cut
Option or argument | Function |
-d Character | specify delimiter. Default tab. E.g. cut -f1 -d'.' |
-f List | e.g. -f 1,7 writes out only the first and seventh fields of each line. If a line contains no field delimiters, passes them. |
1.15 date
%H Displays the hour (24-hour clock) as a decimal number (00-23).
%M Displays the minutes as a decimal number (00-59).
%Y Displays the four-digit year as a decimal number.
e.g. date +%H%M