Showing posts with label command line. Show all posts
Showing posts with label command line. Show all posts

Thursday, 23 November 2017

RoboCopy for maximum throughput

Another one of those notes to self:

Below command is very useful to achieve high throughput on a copy process on Microsoft platforms (do play around with MT )

As the MT[:N] argument creates  multi-threaded copies with N threads and will depend on your machines processor and memory configuration.

Example to keep to a local folder in sync with a remote source:

robocopy \\source\Calibre\eBooks\ F:\Calibre\eBooks /MT:64 /MIR /Z

Technet artice on RoboCopy here.

Friday, 25 November 2016

Apple OS X - command line network commands




How to show the routing table:

netstat -nr

How to add a route:

sudo route -n add [ip address]/[subnet] [gateway]
e.g.

$ sudo route -n add 10.0.0.0/24 172.16.0.1

List open files (Determine what target IP and application/process is connected to)

$ lsof -i
e.g. To determine what IP a Citrix session is connecting to:
$ lsof -i | grep -E "Citrix"




Saturday, 9 November 2013

Command line diff example

I had to compare some files for changes and used the diff command, thought I would add an example for reference.

File 1:

user@pc:~$ cat test1.txt
aa
aa
aa

File 2:
 user@pc:~$ cat test2.txt
aa
aa
bb
cc
dd
user@pc:~$

 Then the compare:

user@pc:~$ diff -rupN test1.txt test2.txt
--- test1.txt    2013-01-01 22:50:09.918800341 +0000
+++ test2.txt    2013-01-01 22:52:28.214796256 +0000
@@ -1,3 +1,5 @@
 aa
 aa
-aa
+bb
+cc
+dd
user@pc:~$
 Creating a patch file that will contain the difference:

user@pc:~$ diff -rupN test1.txt test2.txt > test3.diff
user@pc:~$ cat test3.diff
--- test1.txt    2013-01-01 22:50:09.918800341 +0000
+++ test2.txt    2013-01-01 22:52:28.214796256 +0000
@@ -1,3 +1,5 @@
 aa
 aa
-aa
+bb
+cc
+dd

Then to patch file 1:
user@pc:~$ patch test1.txt < test3.diff
patching file test1.txt

user@pc:~$ cat test1.txt
aa
aa
bb
cc
dd
user@pc:~$ 

 And if you need to reverse the patch:
user@pc:~$ patch -R test1.txt < test3.diff
patching file test1.txt

user@pc:~$ cat test1.txt
aa
aa
aa
user@pc:~$