Skip to content

Linux Command Shortcuts

What this page tells you

Linux snippets: cp -Rvn to copy without overwriting, ls | wc -l to count files, and chown -R :davisgroup to fix group ownership on BSC. Includes pasted terminal output listing the davisgroup members.

Useful Shortcuts

  • Copy from one directory to another without overwriting existing files

    cp -Rvn folder1 folder2
    
  • Count files in directory

    $ ls | wc -l
    

    As an example, let’s say that you want to count the number of files present in the “/etc” directory.

     $ ls /etc | wc -l
    

chown -R :davisgroup sub-RIDXXXX/
chown -R :davisgroup nifti_BIDS_missing_3T/

[asuncion@bscsub1 nifti_BIDS_missing_3T]$ groups
asuncion sftp cntaccess bsclpc davisgroup cnt_staff_group gugger cnt_gpu

[asuncion@bscsub1 nifti_BIDS_missing_3T]$ getent group davisgroup
davisgroup:*:54740:holder,sudas,guggerj,nishants,arevell,chenyzh,allucas,mjaskir,bjprager,asuncion,ezou626,agowd,ethaneis,kkermani,nahu,smouchta,kulickc,mjosyula,phadar,tamjid,geasley,dilinir1,cheymach,pattnaik,audluo,stevennb,jenayej,erinconr,daviska