Skip to content

Instantly share code, notes, and snippets.

@byteshiva
Created March 18, 2017 05:23
Show Gist options
  • Save byteshiva/eee0564ad514c4f6df46e0217b79cd01 to your computer and use it in GitHub Desktop.
Save byteshiva/eee0564ad514c4f6df46e0217b79cd01 to your computer and use it in GitHub Desktop.
FAQs Shell scripts
Set all files to zero.
```
ls | xargs -I {} sh -c '> {}'
```
@byteshiva
Copy link
Author

@byteshiva
Copy link
Author

byteshiva commented Mar 20, 2017

rsync between servers(ie, from remote to local).

rsync -avz -e ssh [email protected]://root/somefolder/ .

rsync between servers(ie, from local to remote).

rsync -avz -e /root/someFolder1/ ssh [email protected]://root/somefolder1/

@byteshiva
Copy link
Author

byteshiva commented Mar 24, 2017

How many cores are there in a process?

pgrep chrome | xargs  -I {} sh -c 'cat /proc/{}/status | grep Threads'  | more 

ref: http://ask.xmodulo.com/number-of-threads-process-linux.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment