Skip to content

Instantly share code, notes, and snippets.

@nguyensach
Forked from hofmannsven/README.md
Created September 7, 2018 03:23
Show Gist options
  • Save nguyensach/d6bf5f6868edcbc31a0ca5a6e4fe8a8f to your computer and use it in GitHub Desktop.
Save nguyensach/d6bf5f6868edcbc31a0ca5a6e4fe8a8f to your computer and use it in GitHub Desktop.

Revisions

  1. @hofmannsven hofmannsven revised this gist Mar 24, 2018. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion vim.md
    Original file line number Diff line number Diff line change
    @@ -144,4 +144,9 @@ Create file: `%`

    ### NERDTree

    Toggle sidebar: `:NERDTreeToggle`
    Toggle sidebar: `:NERDTreeToggle`


    ### CtrlP

    Switch from file to file: `ctrl + p`
  2. @hofmannsven hofmannsven revised this gist Mar 13, 2018. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions vim.md
    Original file line number Diff line number Diff line change
    @@ -11,6 +11,9 @@ Vim CLI Basics
    ## Config
    Custom config: `~/.vimrc`

    ## Colorschemes
    - https://github.com/rakr/vim-one

    ## Commands

    ### Navigation
  3. @hofmannsven hofmannsven revised this gist Mar 13, 2018. 1 changed file with 41 additions and 4 deletions.
    45 changes: 41 additions & 4 deletions vim.md
    Original file line number Diff line number Diff line change
    @@ -8,9 +8,6 @@ Vim CLI Basics
    ## Cheatsheet
    - https://vim.rtorr.com/

    ## MacVim
    Open app: `mvim`

    ## Config
    Custom config: `~/.vimrc`

    @@ -50,6 +47,9 @@ Jump to beginning of the file: `gg`

    Jump to end of the file: `G`

    Browser current working directory: `:e .`
    (allows browsing and searching with `/`)

    Search word: `/` (Use `n` and `N` to navigate)

    Insert as new line: `o` and `O`
    @@ -104,4 +104,41 @@ Jump down: `ctrl + j`

    Jump left: `ctrl + h`

    Jump right: `ctrl + l`
    Jump right: `ctrl + l`


    ## Apps

    ### MacVim

    Open app: `mvim`


    ## Plugins


    ### Vundle

    Download: https://github.com/VundleVim/Vundle.vim

    Command: `:PluginInstall`


    ### Vinegar

    Browser current working directory: `-`

    Go up one folder: `-`

    Create directory: `d`

    Delete directory: `D` (asks for confirmation)

    Delete selected file: `D` (asks for confirmation)

    Create file: `%`


    ### NERDTree

    Toggle sidebar: `:NERDTreeToggle`
  4. @hofmannsven hofmannsven revised this gist Mar 13, 2018. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions vim.md
    Original file line number Diff line number Diff line change
    @@ -8,6 +8,9 @@ Vim CLI Basics
    ## Cheatsheet
    - https://vim.rtorr.com/

    ## MacVim
    Open app: `mvim`

    ## Config
    Custom config: `~/.vimrc`

  5. @hofmannsven hofmannsven revised this gist Mar 8, 2018. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions vim.md
    Original file line number Diff line number Diff line change
    @@ -57,6 +57,8 @@ Replace char: `r`

    Delete: `d`

    Cut whole line: `dd`

    Cut text e.g. next word: `dw`

    Undo: `u`
  6. @hofmannsven hofmannsven revised this gist Feb 26, 2018. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions vim.md
    Original file line number Diff line number Diff line change
    @@ -85,6 +85,8 @@ Force quit (without saving): `ESC` + `:q!`

    Source current file: `:so %`

    Compare two files: `vim -d index1.php index2.php`

    ### Split view

    Horizontal split: `:sp`
  7. @hofmannsven hofmannsven revised this gist Dec 8, 2017. 1 changed file with 15 additions and 1 deletion.
    16 changes: 15 additions & 1 deletion vim.md
    Original file line number Diff line number Diff line change
    @@ -83,4 +83,18 @@ Save and exit: `ESC` + `:x`

    Force quit (without saving): `ESC` + `:q!`

    Source current file: `:so %`
    Source current file: `:so %`

    ### Split view

    Horizontal split: `:sp`

    Vertical split: `:vsp`

    Jump up: `ctrl + k`

    Jump down: `ctrl + j`

    Jump left: `ctrl + h`

    Jump right: `ctrl + l`
  8. @hofmannsven hofmannsven revised this gist Dec 8, 2017. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions vim.md
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,9 @@ Vim CLI Basics
    ## Related tutorial
    - https://laracasts.com/series/vim-mastery

    ## Cheatsheet
    - https://vim.rtorr.com/

    ## Config
    Custom config: `~/.vimrc`

  9. @hofmannsven hofmannsven revised this gist Dec 8, 2017. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion vim.md
    Original file line number Diff line number Diff line change
    @@ -54,7 +54,7 @@ Replace char: `r`

    Delete: `d`

    Cut text e.g. next word: `dw` (use `p` to paste in again)
    Cut text e.g. next word: `dw`

    Undo: `u`

    @@ -64,6 +64,12 @@ Repeat last command: `.`

    Switch to visual mode: `v` and `V` (select entire line)

    Copy selected: `y`

    Copy entire line: `yy`

    Paste: `p`

    Save changes: `:w`

    Quit Vim: `:q`
  10. @hofmannsven hofmannsven revised this gist Dec 6, 2017. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions vim.md
    Original file line number Diff line number Diff line change
    @@ -2,14 +2,15 @@ Vim CLI Basics
    ===============


    ## Related tutorials
    ## Related tutorial
    - https://laracasts.com/series/vim-mastery

    ## Config
    Custom config: `~/.vimrc`

    ## Commands
    Startup vim: `vim filename.txt`

    ### Navigation

    Insert mode: `i`

  11. @hofmannsven hofmannsven revised this gist Nov 19, 2017. 1 changed file with 15 additions and 3 deletions.
    18 changes: 15 additions & 3 deletions vim.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,14 @@
    Vim CLI Basics
    ===============


    ## Related tutorials
    - https://laracasts.com/series/vim-mastery

    ## Config
    Custom config: `~/.vimrc`

    ## Commands
    Startup vim: `vim filename.txt`

    Insert mode: `i`
    @@ -39,10 +47,12 @@ Search word: `/` (Use `n` and `N` to navigate)

    Insert as new line: `o` and `O`

    Delete chars: `x` and `X`
    Cut chars: `x` and `X`

    Replace char: `r`

    Delete: `d`

    Cut text e.g. next word: `dw` (use `p` to paste in again)

    Undo: `u`
    @@ -51,7 +61,7 @@ Redo: `ctrl + r`

    Repeat last command: `.`

    Switch to visual editor: `v`
    Switch to visual mode: `v` and `V` (select entire line)

    Save changes: `:w`

    @@ -61,4 +71,6 @@ Quit without saving: `:q!`

    Save and exit: `ESC` + `:x`

    Force quit (without saving): `ESC` + `:q!`
    Force quit (without saving): `ESC` + `:q!`

    Source current file: `:so %`
  12. @hofmannsven hofmannsven revised this gist Oct 30, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -159,7 +159,7 @@ Write to file (will overwrite existing content): `cat > sample-filename.txt` (qu

    Search for a filename (not content!) in the current directory: `find sample-filename.txt`

    Search for a string (not filename!) inside all files in the current directory: `ack "string"`
    Search for a string (not filename!) inside all files in the current directory: `ack "string" --php` ([documentation](https://beyondgrep.com/documentation/))

    Search for a string inside all files in the current directory and subdrectories: `grep -r "string" *`

  13. @hofmannsven hofmannsven revised this gist Sep 29, 2017. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -124,6 +124,8 @@ Create symlink: `ln -s source-dirname destination-dirname`

    Update symlink: `ln -sfn source-dirname destination-dirname`

    Remove symlink: `unlink sample-dirname`

    - `-s`: Create a symbolic link.
    - `-f`: If the target file already exists, then unlink it.
    - `-F`: If the target file already exists and is a directory, then remove/overwrite it.
  14. @hofmannsven hofmannsven revised this gist Sep 29, 2017. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -122,6 +122,8 @@ Browsing directories: `pushd sample-dirname` / `popd` / `dirs`

    Create symlink: `ln -s source-dirname destination-dirname`

    Update symlink: `ln -sfn source-dirname destination-dirname`

    - `-s`: Create a symbolic link.
    - `-f`: If the target file already exists, then unlink it.
    - `-F`: If the target file already exists and is a directory, then remove/overwrite it.
  15. @hofmannsven hofmannsven revised this gist Sep 25, 2017. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -122,11 +122,11 @@ Browsing directories: `pushd sample-dirname` / `popd` / `dirs`

    Create symlink: `ln -s source-dirname destination-dirname`

    `-s`: Create a symbolic link.
    `-f`: If the target file already exists, then unlink it.
    `-F`: If the target file already exists and is a directory, then remove/overwrite it.
    `-h`: If the target file or directory is a symbolic link, do not follow it.
    `-n`: Same as `-h`, for compatibility with other `ln` implementations.
    - `-s`: Create a symbolic link.
    - `-f`: If the target file already exists, then unlink it.
    - `-F`: If the target file already exists and is a directory, then remove/overwrite it.
    - `-h`: If the target file or directory is a symbolic link, do not follow it.
    - `-n`: Same as `-h`, for compatibility with other `ln` implementations.



  16. @hofmannsven hofmannsven revised this gist Sep 25, 2017. 1 changed file with 11 additions and 0 deletions.
    11 changes: 11 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -118,6 +118,17 @@ Checkout directory: `cd sample-dirname`
    Browsing directories: `pushd sample-dirname` / `popd` / `dirs`
    (see http://unix.stackexchange.com/a/77081)

    ### Symlinks

    Create symlink: `ln -s source-dirname destination-dirname`

    `-s`: Create a symbolic link.
    `-f`: If the target file already exists, then unlink it.
    `-F`: If the target file already exists and is a directory, then remove/overwrite it.
    `-h`: If the target file or directory is a symbolic link, do not follow it.
    `-n`: Same as `-h`, for compatibility with other `ln` implementations.



    Files
    -----------
  17. @hofmannsven hofmannsven revised this gist Sep 16, 2016. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -154,6 +154,10 @@ MD5 hash for files: `md5 sample-filename.txt`

    MD5 hash for folders: `tar c folder | md5sum`

    Encrypt file: `openssl enc -aes-256-cbc -e -in sample-filename.txt -out sample-encrypted.txt`

    Decrypt file: `openssl enc -aes-256-cbc -d -in sample-encrypted.txt -out sample-filename.txt`


    Server
    -----------
  18. @hofmannsven hofmannsven revised this gist Jul 28, 2016. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -150,7 +150,9 @@ Search for a string inside all files in the current directory and subdrectories:

    Search and replace within file: `sed -i '' 's/original-text/new-text/g' sample-filename.txt`

    Validate MD5 hash: `md5 sample-filename.txt`
    MD5 hash for files: `md5 sample-filename.txt`

    MD5 hash for folders: `tar c folder | md5sum`


    Server
  19. @hofmannsven hofmannsven revised this gist Jul 11, 2016. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -150,6 +150,8 @@ Search for a string inside all files in the current directory and subdrectories:

    Search and replace within file: `sed -i '' 's/original-text/new-text/g' sample-filename.txt`

    Validate MD5 hash: `md5 sample-filename.txt`


    Server
    -----------
  20. @hofmannsven hofmannsven revised this gist Jul 5, 2016. 1 changed file with 10 additions and 5 deletions.
    15 changes: 10 additions & 5 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,17 @@
    Command Line Crash Course
    ===============
    # Command Line Crash Course

    Related tutorial: http://cli.learncodethehardway.org/book/

    CodeCademy: https://www.codecademy.com/courses/learn-the-command-line
    ## Related tutorials
    - http://cli.learncodethehardway.org/book/
    - https://www.codecademy.com/courses/learn-the-command-line

    Official cheatsheet: http://cd64.de/linux

    ## Cheatsheets
    - [Linux auf einem Blatt](http://helmbold.de/artikel/Linux-auf-einem-Blatt.pdf)
    - [Fasd](https://gist.github.com/hofmannsven/a502e525ba9f9e5fe348480183364ad8)


    ## Usage
    Note: Hold option (`alt`) and click a position in the current line to move your cursor to that position.

    Clear history: `ctrl + l`
  21. @hofmannsven hofmannsven revised this gist May 10, 2016. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -206,6 +206,8 @@ Show site IP: `dig +short google.com`

    Show A Record: `dig a google.com` (Returns: `google.com. 43 IN A 123.123.123.123` aka `public-name ttl internet record-type server-address`)

    Webservice: https://www.whatsmydns.net/


    Tools
    -----------
  22. @hofmannsven hofmannsven revised this gist May 10, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -204,7 +204,7 @@ Check site feedback: `ping google.com`

    Show site IP: `dig +short google.com`

    Show A Record: `dig a google.com`
    Show A Record: `dig a google.com` (Returns: `google.com. 43 IN A 123.123.123.123` aka `public-name ttl internet record-type server-address`)


    Tools
  23. @hofmannsven hofmannsven revised this gist May 10, 2016. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -204,6 +204,8 @@ Check site feedback: `ping google.com`

    Show site IP: `dig +short google.com`

    Show A Record: `dig a google.com`


    Tools
    -----------
  24. @hofmannsven hofmannsven revised this gist Feb 23, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -97,7 +97,7 @@ List directory (wildcard matching): `ls *.txt`
    List all files of type: `find . -name "*.txt" -print`


    Switch/toggle between dirs: `cd -`
    Go back to previous directory: `cd -`


    Make (empty) directory: `mkdir sample-dirname`
  25. @hofmannsven hofmannsven revised this gist Feb 22, 2016. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -29,6 +29,12 @@ Finding Help: `apropos directory` / `apropos search` (...)

    Define custom startup screen: `sudo nano /etc/motd`

    Run a script as background process: `python script.py &`

    List all running process's: `ps aux`

    Kill a running process: `sudo kill 12345`


    System
    -----------
  26. @hofmannsven hofmannsven revised this gist Jan 21, 2016. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -35,6 +35,10 @@ System

    Get the current path: `pwd`

    Copy to clipboard: `pwd | pbcopy`

    Paste: `pbpaste`

    Get the current hostname: `hostname`

    Get the current users: `users`
  27. @hofmannsven hofmannsven revised this gist Jan 17, 2016. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -198,4 +198,10 @@ Show site IP: `dig +short google.com`
    Tools
    -----------

    [Tree](http://mama.indstate.edu/users/ice/tree/tree.1.html): `brew install tree`
    [Tree](http://mama.indstate.edu/users/ice/tree/tree.1.html): `brew install tree`


    Security
    -----------

    Fix OpenSSH Client Bug: https://www.digitalocean.com/community/questions/openssh-client-bug-cve-2016-0777-and-cve-2016-0778
  28. @hofmannsven hofmannsven revised this gist Jan 14, 2016. 1 changed file with 11 additions and 0 deletions.
    11 changes: 11 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -63,6 +63,17 @@ Change owner: `chown root index.php` (`root` is the username)
    Change group: `chgrp www-data index.php` (`www-data` is the groupname)


    WordPress Files/Folder Permissions
    -----------

    Let apache be owner: `chown www-data:www-data -R *`

    Change directory permissions rwxr-xr-x: `find . -type d -exec chmod 755 {} \;`

    Change file permissions rw-r--r--: `find . -type f -exec chmod 644 {} \;`

    (see http://stackoverflow.com/a/18352747/1815847)


    Directories
    -----------
  29. @hofmannsven hofmannsven revised this gist Jan 6, 2016. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -108,6 +108,8 @@ Copy/Page folder with content: `cp -a folder/ new_folder`

    Move/Rename file: `mv current-filename.txt new-filename.txt`

    Move/Rename file and prompt before overwriting an existing file: `mv -i current-filename.txt new-filename.txt`

    Remove file: `rm sample-filename.txt`

    View file: `less sample-filename.txt` / `more sample-filename.txt`
  30. @hofmannsven hofmannsven revised this gist Oct 25, 2015. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -175,6 +175,13 @@ Functions
    Calculate (returns only `int`): `echo $((123/2))`


    Web
    -----------
    Check site feedback: `ping google.com`

    Show site IP: `dig +short google.com`


    Tools
    -----------