This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # get a list of ssh sessions running | |
| sudo ss -lnp | grep sshd |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -r searches directories and subdirectories | |
| # -l display only file names | |
| # -i case insensitive | |
| grep -r -l -i "findme" ./here/ | |
| # -in display line numbers | |
| grep -r -i -in "findme" ./here/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ===[ Secure Copy (via ssh) ]=== | |
| #Copy the file "foobar.txt" from a remote host to the local host | |
| scp [email protected]:foobar.txt /some/local/directory | |
| #Copy the file "foobar.txt" from the local host to a remote host | |
| scp foobar.txt [email protected]:/some/remote/directory |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # remove directory | |
| rm -rf <name-of-directory> | |
| # Windows, remove directory using robocopy | |
| robocopy "a_empty_dir" <dir-to-delete> /MIR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ===[ Compression/7z ]=== | |
| # make a 7z archive file out of a directory | |
| # a: add to archive | |
| # -t7z: use 7z file type | |
| # -mx5: | |
| # -mmt: multithread the operation | |
| 7z a -t7z <name-of-new-file>.7z <directory-to-be-compressed> -mx5 -mmt | |
| # extract |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var arr = [1,2,3,4,5]; | |
| for (var i = 0, len = arr.length; i < len; i++) { | |
| (function(i){ | |
| console.log(arr[i]); | |
| })(i); | |
| }; |
NewerOlder