Difference between revisions of "Linux tips"

From CSWiki
Jump to: navigation, search
 
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
* Changing Default permissions when creating a new directory
 
* Changing Default permissions when creating a new directory
 
umask u=rwx,g=rwx,o=
 
umask u=rwx,g=rwx,o=
 +
 +
add umask in .bashrc in an "if" expression like to make rsync proper
 +
 
* Set default group
 
* Set default group
 
newgrp groupname
 
newgrp groupname
Line 15: Line 18:
 
if you want to redirect both standard out and standard error, you can use: 1>out 2>&1, where out is a filename, 1 stands for
 
if you want to redirect both standard out and standard error, you can use: 1>out 2>&1, where out is a filename, 1 stands for
 
STDOUT, and 2 for STDERR
 
STDOUT, and 2 for STDERR
 +
 +
* sync data
 +
rsync -avze ssh davinci:~/matlab-jc/ps/ ~/matlab_jc/ps/

Latest revision as of 18:10, 4 January 2009

  • Changing Default permissions when creating a new directory

umask u=rwx,g=rwx,o=

add umask in .bashrc in an "if" expression like to make rsync proper

  • Set default group

newgrp groupname

 Remark: this command will start a nested shell. If you want to use the command in a startup script like in .bashrc, to avoid
 infinite loop, you should put it in an "if" expression like this: 
 if [ `id -gn` != "object3d" ] 
 then
   newgrp object3d
   exit
 fi
  • Change default shell

chsh -s /bin/bash haosu

  • I/O Redirection

if you want to redirect both standard out and standard error, you can use: 1>out 2>&1, where out is a filename, 1 stands for STDOUT, and 2 for STDERR

  • sync data

rsync -avze ssh davinci:~/matlab-jc/ps/ ~/matlab_jc/ps/