2022年11月17日星期四

check file changed or not by md5 hash code

windows powershell command:

PS C:\Users\test> certutil -hashfile destfile.zip md5

MD5 hash (対象 destfile.zip):

f6cb78afe66b417cd3f79df8d1c86444 

CertUtil: -hashfile コマンドは正常に完了しました。

linux command:

md5sum destfile.zip

 f6cb78afe66b417cd3f79df8d1c86444 destfile.zip


2022年11月11日星期五

git clone -b branchname url

git clone -b branchname https://domainname/group/project.git 


git clone -b branchname https://userid:token@domainname/group/project.git 


2022年11月8日星期二

Linux refresh .bashrc immediately source ~/.bashrc

 source ~/.bashrc 

linux shell setfacl /getfacl

$ setfacl --help

setfacl 2.2.51 -- set file access control lists Usage: setfacl [-bkndRLP] { -m|-M|-x|-X ... } file ... -m, --modify=acl modify the current ACL(s) of file(s) -M, --modify-file=file read ACL entries to modify from file -x, --remove=acl remove entries from the ACL(s) of file(s) -X, --remove-file=file read ACL entries to remove from file -b, --remove-all remove all extended ACL entries -k, --remove-default remove the default ACL --set=acl set the ACL of file(s), replacing the current ACL --set-file=file read ACL entries to set from file --mask do recalculate the effective rights mask -n, --no-mask don't recalculate the effective rights mask -d, --default operations apply to the default ACL -R, --recursive recurse into subdirectories -L, --logical logical walk, follow symbolic links -P, --physical physical walk, do not follow symbolic links --restore=file restore ACLs (inverse of `getfacl -R') --test test mode (ACLs are not modified) -v, --version print version and exit -h, --help this help text

#ex: $ setfacl -m u:testuser :rw test1.log
setfacl: Option -m incomplete
$ setfacl -m u:testuser:rw test1.log
$ getfacl test1.log
# file: test1.log # owner: ec2-user # group: ec2-user user::rw- user:ec2-user:rwx group::rw- mask::rwx other::r--

2022年11月1日星期二

shell if and or

 

  • && (AND) : if [ condition1 ] && [ condition2 ]; then 
       if [ -f $src/* ] && [ -d $dest ]; then 

          echo "there are files under $src"
          cp -rf $src/* $dest/
       else
          echo " directory $
dest is not found, or no files under $src" 
       fi


  • || (OR) : if [ condition1 ] || [ condition2 ]; then