diff --git a/pages/common/autojump.md b/pages/common/autojump.md index f2318485f..73f11eefc 100644 --- a/pages/common/autojump.md +++ b/pages/common/autojump.md @@ -3,18 +3,18 @@ > Quickly jump among the directories you visit the most. > Aliases like j or jc are provided for even less typing. -- Jump to a directory that contains the given pattern. +- Jump to a directory that contains the given pattern: `j {{pattern}}` -- Jump to a sub-directory (child) of the current directory that contains the given pattern. +- Jump to a sub-directory (child) of the current directory that contains the given pattern: `jc {{pattern}}` -- Remove non-existing directories from the autojump database. +- Remove non-existing directories from the autojump database: `j --purge` -- Show the entries in the autojump database. +- Show the entries in the autojump database: `j -s` diff --git a/pages/common/autossh.md b/pages/common/autossh.md index bd30b4ea5..c3dcf509e 100644 --- a/pages/common/autossh.md +++ b/pages/common/autossh.md @@ -3,26 +3,26 @@ > Runs, monitors and restarts SSH connections. > Auto-reconnects to keep port forwarding tunnels up. Accepts all ssh flags. -- Open an SSH session, restarting when a monitoring port fails return data. +- Open an SSH session, restarting when a monitoring port fails return data: `autossh -M {{monitor_port}} {{ssh_command}}` -- Open an SSH session which forwards a local port to a remote one, restarting if necessary. +- Open an SSH session which forwards a local port to a remote one, restarting if necessary: `autossh -M {{monitor_port}} -L {{local_port}}:localhost:{{remote_port}} {{user}}@{{host}}` -- Fork before executing ssh (runs in the background) and don't open a remote shell. +- Fork before executing ssh (runs in the background) and don't open a remote shell: `autossh -f -M {{monitor_port}} -N {{ssh_command}}` -- Run autossh in the background, with no monitoring port instead relying on SSH keep-alives every 10secs to detect failure. +- Run autossh in the background, with no monitoring port instead relying on SSH keep-alives every 10secs to detect failure: `autossh -f -M 0 -N -o "ServerAliveInterval 10" -o "ServerAliveCountMax 3" {{ssh_command}}` -- Run autossh in the background, with no monitoring port, no remote shell, exiting if the port forward fails. +- Run autossh in the background, with no monitoring port, no remote shell, exiting if the port forward fails: `autossh -f -M 0 -N -o "ServerAliveInterval 10" -o "ServerAliveCountMax 3" -o ExitOnForwardFailure=yes -L {{local_port}}:localhost:{{remote_port}} {{user}}@{{host}}` -- Run autossh in the background with debug output logged to a file, ssh verbose output logged to a second file. +- Run autossh in the background with debug output logged to a file, ssh verbose output logged to a second file: `AUTOSSH_DEBUG=1 AUTOSSH_LOGFILE={{log_file}} autossh -f -M {{monitor_port}} -v -E {{ssh_logfile}} {{ssh_command}}` diff --git a/pages/common/bmaptool.md b/pages/common/bmaptool.md index fd284e5ae..e92595d69 100644 --- a/pages/common/bmaptool.md +++ b/pages/common/bmaptool.md @@ -2,18 +2,18 @@ > Create or Copy blockmaps intelligently (and therefore faster than `cp` or `dd`). -- Create a blockmap from image file. +- Create a blockmap from image file: `bmaptool create -o {{blockmap.bmap}} {{source.img}}` -- Copy an image file into sdb. +- Copy an image file into sdb: `bmaptool copy --bmap {{blockmap.bmap}} {{source.img}} {{/dev/sdb}}` -- Copy a compressed image file into sdb. +- Copy a compressed image file into sdb: `bmaptool copy --bmap {{blockmap.bmap}} {{source.img.gz}} {{/dev/sdb}}` -- Copy an image file into sdb without using a blockmap. +- Copy an image file into sdb without using a blockmap: `bmaptool copy --nobmap {{source.img}} {{/dev/sdb}}` diff --git a/pages/common/file.md b/pages/common/file.md index c298b5377..66098ff65 100644 --- a/pages/common/file.md +++ b/pages/common/file.md @@ -10,10 +10,10 @@ `file -z {{foo.zip}}` -- Allow file to work with special or device files. +- Allow file to work with special or device files: `file -s {{filename}}` -- Don't stop at first file type match; keep going until the end of the file. +- Don't stop at first file type match; keep going until the end of the file: `file -k {{filename}}` diff --git a/pages/common/for.md b/pages/common/for.md index 2e83b0305..81523ec48 100644 --- a/pages/common/for.md +++ b/pages/common/for.md @@ -1,11 +1,11 @@ # for -> Shell loop over parameters +> Shell loop over parameters. -- Perform a command with different arguments. +- Perform a command with different arguments: `for argument in 1 2 3; do {{command $argument}}; done` -- Perform a command in every directory. +- Perform a command in every directory: `for d in *; do (cd $d; {{command}}); done` diff --git a/pages/common/glances.md b/pages/common/glances.md index 3d65af5af..e4c2bab4a 100644 --- a/pages/common/glances.md +++ b/pages/common/glances.md @@ -2,22 +2,22 @@ > A cross-platform system monitoring tool. -- run in terminal. +- Run in terminal: `glances` -- run in web server mode to show results in browser. +- Run in web server mode to show results in browser: `glances -w` -- run in server mode to allow connections from other Glances clients. +- Run in server mode to allow connections from other Glances clients: `glances -s` -- connect to a Glances server. +- Connect to a Glances server: `glances -c {{hostname}}` -- require a password in (web) server mode. +- Require a password in (web) server mode: `glances -s --password` diff --git a/pages/common/if.md b/pages/common/if.md index 47ca99b5d..25e6252df 100644 --- a/pages/common/if.md +++ b/pages/common/if.md @@ -1,11 +1,11 @@ # if -> Simple shell conditional +> Simple shell conditional. -- Echo a different thing depending on a command's success. +- Echo a different thing depending on a command's success: `{{command}} && echo "success" || echo "failure"` -- Full if syntax. +- Full if syntax: `if {{condition}}; then echo "true"; else echo "false"; fi` diff --git a/pages/common/lsof.md b/pages/common/lsof.md index 6fcfe7ac4..18e4908e1 100644 --- a/pages/common/lsof.md +++ b/pages/common/lsof.md @@ -1,7 +1,7 @@ # lsof -> Lists open files and the corresponding processes -> Note: In most cases, you need root privilege (or use sudo) because you want to list files opened by others +> Lists open files and the corresponding processes. +> Note: In most cases, you need root privilege (or use sudo) because you want to list files opened by others. - Find the processes that have a given file open: @@ -11,14 +11,14 @@ `lsof -i :{{port}}` -- only output the process PID +- Only output the process PI: `lsof -t {{/path/to/file}}` -- list files opened by the given user +- List files opened by the given use: `lsof -u {{username}}` -- list files opened by the given command or process +- List files opened by the given command or proces: `lsof -c {{process_or_command_name}}` diff --git a/pages/common/pg_dump.md b/pages/common/pg_dump.md index 4921d5bfc..6afd1fa34 100644 --- a/pages/common/pg_dump.md +++ b/pages/common/pg_dump.md @@ -1,6 +1,6 @@ # pg_dump -> Extract a PostgreSQL database into a script file or other archive file +> Extract a PostgreSQL database into a script file or other archive file. - Dump database into a SQL-script file: diff --git a/pages/common/sails.md b/pages/common/sails.md index c5e1b077b..8aa994875 100644 --- a/pages/common/sails.md +++ b/pages/common/sails.md @@ -2,22 +2,22 @@ > Sails.js is a realtime enterprise level MVC framework built on top of Node.js. -- Start Sails +- Start Sail: `sails lift` -- Create new Sails project +- Create new Sails projec: `sails new {{projectName}}` -- Generate Sails API +- Generate Sails AP: `sails generate {{name}}` -- Generate Sails Controller +- Generate Sails Controlle: `sails generate controller {{name}}` -- Generate Sails Model +- Generate Sails Mode: `sails generate model {{name}}` diff --git a/pages/common/ssh-keygen.md b/pages/common/ssh-keygen.md index f5bfdb1d2..bc0f948c1 100644 --- a/pages/common/ssh-keygen.md +++ b/pages/common/ssh-keygen.md @@ -1,19 +1,19 @@ # ssh-keygen -> Generate ssh keys user for authentication, password-less logins, and other things +> Generate ssh keys user for authentication, password-less logins, and other things. -- generate a key interactively +- Generate a key interactivel: `ssh-keygen` -- generate a DSA 2048 bit (default) key +- Generate a DSA 2048 bit (default) ke: `ssh-keygen -t dsa` -- generate an RSA 4096 bit key with your email as a comment +- Generate an RSA 4096 bit key with your email as a commen: `ssh-keygen -t rsa -b 4096 -C "{{email}}"` -- Retrieve the key fingerprint from a host (useful for confirming the authenticity of the host when first connecting to it via SSH) +- Retrieve the key fingerprint from a host (useful for confirming the authenticity of the host when first connecting to it via SSH: `ssh-keygen -l -F {{remote_host}}` diff --git a/pages/common/su.md b/pages/common/su.md index be69c1def..2cf2a4dd1 100644 --- a/pages/common/su.md +++ b/pages/common/su.md @@ -10,6 +10,6 @@ `su` -- Switch to user {{username}} and simulate a full login shell +- Switch to user {{username}} and simulate a full login shel: `su - {{username}}` diff --git a/pages/common/telnet.md b/pages/common/telnet.md index c0c8df872..3eac87ee0 100644 --- a/pages/common/telnet.md +++ b/pages/common/telnet.md @@ -12,7 +12,7 @@ - Default escape character: -`CTRL` + `]` +`CTRL + ]` - Specify an escape character (x is the escape character): diff --git a/pages/common/while.md b/pages/common/while.md index 053affebb..066290c91 100644 --- a/pages/common/while.md +++ b/pages/common/while.md @@ -1,11 +1,11 @@ # while -> Simple shell loop +> Simple shell loop. -- Read stdin and perform an action on every line. +- Read stdin and perform an action on every line: `while read line; do echo "$line"; done` -- Execute a command forever once every second. +- Execute a command forever once every second: `while :; do {{command}}; sleep 1; done` diff --git a/pages/linux/apt-key.md b/pages/linux/apt-key.md index 31ed7856a..5614fc406 100644 --- a/pages/linux/apt-key.md +++ b/pages/linux/apt-key.md @@ -1,19 +1,19 @@ # apt-key -> Key management utility for the APT Package Manager on Debian and Ubuntu +> Key management utility for the APT Package Manager on Debian and Ubuntu. -- List trusted keys +- List trusted key: `apt-key list` -- Add a key to the trusted keystore +- Add a key to the trusted keystor: `apt-key add {{public_key_file.asc}}` -- Delete a key from the trusted keystore +- Delete a key from the trusted keystor: `apt-key del {{key_id}}` -- Add a remote key to the trusted keystore +- Add a remote key to the trusted keystor: `wget -qO - {{https://host.tld/filename.key}} | apt-key add -` diff --git a/pages/linux/chroot.md b/pages/linux/chroot.md index f55a93f24..00156aa28 100644 --- a/pages/linux/chroot.md +++ b/pages/linux/chroot.md @@ -2,10 +2,10 @@ > Run command or interactive shell with special root directory. -- Run command as new root directory +- Run command as new root director: `chroot {{/path/to/new/root}} {{command}}` -- specify user and group (ID or name) to use +- Specify user and group (ID or name) to us: `chroot −−userspec={{user:group}}` diff --git a/pages/linux/lsblk.md b/pages/linux/lsblk.md index 99765d28b..3aaaed210 100644 --- a/pages/linux/lsblk.md +++ b/pages/linux/lsblk.md @@ -1,27 +1,27 @@ # lsblk -> lists information about devices +> Lists information about devices. -- list all storage devices in a tree-like format. +- List all storage devices in a tree-like format: `lsblk` -- Also list empty devices. +- Also list empty devices: `lsblk −a` -- Print the SIZE column in bytes rather than in a human-readable format. +- Print the SIZE column in bytes rather than in a human-readable format: `lsblk −b` -- Output info about filesystems. +- Output info about filesystems: `lsblk −f` -- Use ASCII characters for tree formatting. +- Use ASCII characters for tree formatting: `lsblk −i` -- Output info about block-device topology. +- Output info about block-device topology: `lsblk −t`