Difference between revisions of "Useful Linux commands"

From Chuckipedia
Jump to: navigation, search
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
== diskutil ==
 +
 +
diskutil unmount /dev/disk1s2  <ref>http://osxdaily.com/2013/05/13/mount-unmount-drives-from-the-command-line-in-mac-os-x/</ref>
 +
 +
== rsync ==
 +
 +
<code>
 +
--chown=USER:GROUP
 +
</code>
 +
 +
This option forces all files to be owned by USER with group GROUP. This is a simpler interface than using --usermap and --groupmap directly, but it is implemented using those options internally, so you cannot mix them. If either the USER or GROUP is empty, no mapping for the omitted user/group will occur. If GROUP is empty, the trailing colon may be omitted, but if USER is empty, a leading colon must be supplied.<ref>https://download.samba.org/pub/rsync/rsync.html</ref>
 +
 +
== chown ==
 +
 +
<code>
 +
chown -R nobody:users /mnt/disk1/Download <ref>https://wiki.unraid.net/Un-Official_UnRAID_Manual</ref>
 +
</code>
 +
 
== grep ==
 
== grep ==
  
Line 36: Line 54:
  
 
* (h)uman readable (s)ummary for disk usage of foldername <ref>https://www.ostechnix.com/find-size-directory-linux/</ref>
 
* (h)uman readable (s)ummary for disk usage of foldername <ref>https://www.ostechnix.com/find-size-directory-linux/</ref>
 +
 +
== lsof -ad3-999 -c rsync ==
 +
 +
* to see what files rsync currently has opened <ref>https://askubuntu.com/questions/323775/monitor-watch-running-rsync-process/323782</ref>
  
 
== References ==
 
== References ==
  
 
<references />
 
<references />

Latest revision as of 14:29, 5 March 2019

diskutil[edit]

diskutil unmount /dev/disk1s2 [1]

rsync[edit]

--chown=USER:GROUP

This option forces all files to be owned by USER with group GROUP. This is a simpler interface than using --usermap and --groupmap directly, but it is implemented using those options internally, so you cannot mix them. If either the USER or GROUP is empty, no mapping for the omitted user/group will occur. If GROUP is empty, the trailing colon may be omitted, but if USER is empty, a leading colon must be supplied.[2]

chown[edit]

chown -R nobody:users /mnt/disk1/Download [3]

grep[edit]

grep -nr 'yourString*' .

The dot at the end searches the current directory. Meaning for each parameter:

-n            Show relative line number in the file
'yourString*' String for search, followed by a wildcard character
-r            Recursively search subdirectories listed
.             Directory for search (current directory)

How to grep ps output with headers [4][edit]

ps -ef | egrep "Download|PID"

FreeBSD[edit]

  • su:
     The su utility requests appropriate user credentials via PAM and switches
     to	that user ID (the default user is the superuser).  A shell is then
     executed.

pstree[edit]

  • shows a tree of processes! [5]

du -sh foldername[edit]

  • (h)uman readable (s)ummary for disk usage of foldername [6]

lsof -ad3-999 -c rsync[edit]

  • to see what files rsync currently has opened [7]

References[edit]