no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
Next revision | |||
— | pandoc:introduction-to-vsc:03_linux_primer:linuxprimer [2017/10/18 11:42] – Pandoc Auto-commit pandoc | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Linux Primer ====== | ||
+ | |||
+ | * Article written by Balázs Lengyel (VSC Team) < | ||
+ | |||
+ | |||
+ | ===== Filesystems ===== | ||
+ | |||
+ | ==== Filesystem 101 ==== | ||
+ | |||
+ | |||
+ | - Everything starts at the root | ||
+ | * the root is a directory | ||
+ | * "'' | ||
+ | - the filesystem has different kinds of objects | ||
+ | - files | ||
+ | - directories | ||
+ | * containers for multiple objects | ||
+ | - links to objects, which either | ||
+ | * add a second name for the same object | ||
+ | * point to a position in the filesystem | ||
+ | - objects can be referenced by their path | ||
+ | * absolute: '' | ||
+ | * relative: '' | ||
+ | - special objects in directories: | ||
+ | * '' | ||
+ | * '' | ||
+ | - the system may consist of multiple filesystems | ||
+ | * filesystems may be mounted at any (empty) directory | ||
+ | |||
+ | |||
+ | ==== Further concepts ==== | ||
+ | |||
+ | * Attributes | ||
+ | * Ownership | ||
+ | * Access rights | ||
+ | * Filesystem limits | ||
+ | * Size | ||
+ | * Timestamps | ||
+ | |||
+ | |||
+ | * Special files | ||
+ | * device | ||
+ | * fifo pipe | ||
+ | * socket | ||
+ | |||
+ | |||
+ | * Advanced FS features | ||
+ | * data integrity | ||
+ | * device managment | ||
+ | * subvolume support | ||
+ | |||
+ | |||
+ | |||
+ | ==== Filesystem tree ==== | ||
+ | |||
+ | {{pandoc: | ||
+ | |||
+ | < | ||
+ | <!-- | ||
+ | ### Mountpoints | ||
+ | |||
+ | > Linux presents only one tree for file access - but every filesystems has its own tree! | ||
+ | |||
+ | #### Attaching a filesystem to the current tree: {.incremental} | ||
+ | |||
+ | > - takes a filesystem | ||
+ | > - **`FS`** usually a device file or a network address | ||
+ | > - takes an empty directory in the current tree | ||
+ | > - usually `/mnt/XXX` or `/mnt` | ||
+ | > - makes the root of the new filesystem available in place of the empty directory | ||
+ | > - **`FS`** `-> /mnt/` | ||
+ | |||
+ | <div class=incremental> | ||
+ | > This process is called mounting. | ||
+ | </ | ||
+ | --> | ||
+ | </ | ||
+ | ==== Special filesystems used on VSC ==== | ||
+ | |||
+ | === NFS === | ||
+ | |||
+ | |||
+ | * old and reliable network filesystem | ||
+ | * much slower than any local filesystem | ||
+ | * simultaneous usage possible | ||
+ | |||
+ | === TMPFS === | ||
+ | |||
+ | |||
+ | * very fast filesystem | ||
+ | * uses RAM instead of other media | ||
+ | * lost at shutdown | ||
+ | |||
+ | |||
+ | ===== Shell ===== | ||
+ | |||
+ | ==== Prompt ==== | ||
+ | |||
+ | > This is how the prompt looks by default: | ||
+ | |||
+ | {{pandoc: | ||
+ | |||
+ | <code bash> | ||
+ | [myname@l3_ ~]$ | ||
+ | </ | ||
+ | |||
+ | |||
+ | * tells you: | ||
+ | * who you are | ||
+ | * which computer you're on | ||
+ | * which directory you're in | ||
+ | * can be configured | ||
+ | * variable '' | ||
+ | * default: '' | ||
+ | |||
+ | > Ways to get help when you're stuck: | ||
+ | |||
+ | |||
+ | * '' | ||
+ | * manual for specified topic | ||
+ | * find man-pages: '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * most commands support a '' | ||
+ | * colleagues are often helpful | ||
+ | * the internet is often helpful | ||
+ | |||
+ | |||
+ | ==== Execution ==== | ||
+ | |||
+ | To execute a program, we call it: | ||
+ | |||
+ | <code python> | ||
+ | gcc FizzBuzz.c -o FizzBuzz | ||
+ | ./FizzBuzz | ||
+ | module load non-existent-module | ||
+ | echo $? | ||
+ | </ | ||
+ | |||
+ | * Every command that is executed will provide a return-value on exit. | ||
+ | * {{pandoc: | ||
+ | * {{pandoc: | ||
+ | |||
+ | |||
+ | === History === | ||
+ | |||
+ | {{pandoc: | ||
+ | |||
+ | > Your shell keeps a log of all the commands you executed. | ||
+ | |||
+ | |||
+ | * the '' | ||
+ | * for fast reuse of commands try the '' | ||
+ | |||
+ | |||
+ | ==== Parameters ==== | ||
+ | |||
+ | For most commands you can combine multiple single-character arguments. This doesn' | ||
+ | |||
+ | <code bash> | ||
+ | # works: | ||
+ | COMMAND -a -b -c -d -e | ||
+ | COMMAND -abcde | ||
+ | |||
+ | # works partially: | ||
+ | COMMAND -j 2 -a -b | ||
+ | COMMAND -j 2 -ab | ||
+ | |||
+ | # doesn' | ||
+ | COMMAND --long-parameter --flag-parameter=< | ||
+ | </ | ||
+ | One thing to look out for is the order of parameters. Most of the time no specific order is required, but you should look out for things like copying the target over the source file. | ||
+ | |||
+ | <code bash> | ||
+ | # order does matter here: | ||
+ | COMMAND <SRC> < | ||
+ | </ | ||
+ | |||
+ | ==== Aliases ==== | ||
+ | |||
+ | Whenever you have a command | ||
+ | |||
+ | |||
+ | - run often and it | ||
+ | * has a long list of parameters you always use | ||
+ | * is dangerous | ||
+ | - which is an aggregate of many other commands | ||
+ | * but you don't want to write a script | ||
+ | |||
+ | you can define an alias for it: | ||
+ | |||
+ | <code bash> | ||
+ | alias ll='ls -alh' | ||
+ | alias rm ='rm -i' | ||
+ | alias myProject=' | ||
+ | </ | ||
+ | |||
+ | ==== Patterns ==== | ||
+ | |||
+ | > Patterns and expansions define multiple arguments with little overhead: | ||
+ | |||
+ | |||
+ | * the most important patterns are: | ||
+ | * **?** --- matches one character | ||
+ | * ***** --- matches any character sequence | ||
+ | * the most important expansions are: | ||
+ | * **A{1,9}Z** --- expands to A1Z A9Z | ||
+ | * **A{1..9}Z** --- expands to A1Z A2Z ... A9Z | ||
+ | |||
+ | |||
+ | <code bash> | ||
+ | ls file.??? | ||
+ | ls *.* | ||
+ | </ | ||
+ | <code bash> | ||
+ | echo {{A..Z}, | ||
+ | echo {{A, | ||
+ | </ | ||
+ | <code bash> | ||
+ | echo {A..Z}, | ||
+ | echo {A,B}{X,Y} | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== Regular Expressions ==== | ||
+ | |||
+ | > Used in many programs, to define matching rules for filters or other text transfomations: | ||
+ | |||
+ | <code python> | ||
+ | .+ | ||
+ | \. | ||
+ | (A|a)p{2}le | ||
+ | ^[^aeiouAEIOU]+$ | ||
+ | </ | ||
+ | < | ||
+ | Match any character, once or more | ||
+ | match a dot | ||
+ | apple, Apple | ||
+ | any line of only non-vowels | ||
+ | </ | ||
+ | |||
+ | > Example usage of regex: | ||
+ | |||
+ | <code bash> | ||
+ | egrep -i ' | ||
+ | </ | ||
+ | For a detailed explanation see [[https:// | ||
+ | |||
+ | If you want to challenge yourself, try [[https:// | ||
+ | |||
+ | |||
+ | ==== Control Flow ==== | ||
+ | |||
+ | === Chaining Commands === | ||
+ | |||
+ | <code bash> | ||
+ | false ; echo " | ||
+ | false && echo " | ||
+ | false || echo " | ||
+ | </ | ||
+ | <code bash> | ||
+ | Should I be Printed? | ||
+ | |||
+ | Should I be Printed? | ||
+ | </ | ||
+ | |||
+ | === Loops === | ||
+ | |||
+ | <code bash> | ||
+ | for i in * | ||
+ | do | ||
+ | mv $i{,.bak} | ||
+ | done | ||
+ | </ | ||
+ | <code bash> | ||
+ | while true | ||
+ | do | ||
+ | echo " | ||
+ | sleep 3 | ||
+ | done | ||
+ | </ | ||
+ | |||
+ | <code bash> | ||
+ | for i in *; do mv $i{,.bak}; done | ||
+ | while true; do echo " | ||
+ | </ | ||
+ | |||
+ | ==== Streams ==== | ||
+ | |||
+ | === Redirects === | ||
+ | |||
+ | > Write **output** to a **file** or **file-descriptor** | ||
+ | |||
+ | ^Command^Redirect | ||
+ | |program|'' | ||
+ | |program|'' | ||
+ | |program|'' | ||
+ | |||
+ | |||
+ | === Pipes === | ||
+ | |||
+ | > Write **output** into the **input**-stream of another process | ||
+ | |||
+ | ^Command^Pipe | ||
+ | |program|'' | ||
+ | |program|'' | ||
+ | |program|'' | ||
+ | |||
+ | |||
+ | ===== Environment Variables ===== | ||
+ | |||
+ | ==== Setting, getting and unsetting ==== | ||
+ | |||
+ | === Set === | ||
+ | |||
+ | <code python> | ||
+ | LANG=en_US.UTF-8 bash | ||
+ | export LANG=en_US.UTF-8 | ||
+ | </ | ||
+ | |||
+ | === Get === | ||
+ | |||
+ | <code python> | ||
+ | env | ||
+ | echo ${LANG} | ||
+ | echo $PWD | ||
+ | </ | ||
+ | |||
+ | === Unset === | ||
+ | |||
+ | <code python> | ||
+ | unset LANG | ||
+ | env -u LANG | ||
+ | </ | ||
+ | |||
+ | ==== Use cases ==== | ||
+ | |||
+ | > Some variables that could affect you are: | ||
+ | |||
+ | <code python> | ||
+ | $EDITOR | ||
+ | $PAGER | ||
+ | $PATH # program paths, in priority order | ||
+ | </ | ||
+ | > if you're aiming for programming, | ||
+ | |||
+ | <code python> | ||
+ | $LIBRARY_PATH | ||
+ | $LD_LIBRARY_PATH | ||
+ | $CC # sometimes used to set default C compiler | ||
+ | $CFLAGS | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | <div class=" | ||
+ | <div> | ||
+ | <hr color=" | ||
+ | </ | ||
+ | > if you have a lot of self-compiled binaries: | ||
+ | |||
+ | <code python> | ||
+ | export PATH=" | ||
+ | </ | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | ===== Basic command line programs ===== | ||
+ | |||
+ | ==== Looking around ==== | ||
+ | |||
+ | > Looking through files is done with the '' | ||
+ | |||
+ | By default (meaning without parameters) the '' | ||
+ | |||
+ | < | ||
+ | $ ls # shows files and directories | ||
+ | testdir | ||
+ | |||
+ | $ ls -a # includes hidden ones | ||
+ | . .. testdir | ||
+ | |||
+ | $ ls -l # detailed view | ||
+ | drwxr-xr-x 1 myuser p12345 0 Apr 13 2017 testdir | ||
+ | -rw-r--r-- 1 myuser p12345 4 Apr 13 11:55 test | ||
+ | |||
+ | $ ls /tmp/ | ||
+ | allinea-USERNAME | ||
+ | ssh-6E553lWZCM | ||
+ | ssh-C6a754pJ1d | ||
+ | systemd-private-a4214393983d448fbdc689791806519c-ntpd.service-LrAgBP | ||
+ | tmp7CJZRA | ||
+ | yum_save_tx.2017-04-03.12-07.VCUowf.yumtx | ||
+ | |||
+ | $ ls -alh ~ | ||
+ | drwxr-xr-x | ||
+ | -rw------- | ||
+ | -rw-r----- | ||
+ | drwx------ | ||
+ | drwx------ | ||
+ | </ | ||
+ | |||
+ | ==== Moving around ==== | ||
+ | |||
+ | > Moving through directories is done with the '' | ||
+ | |||
+ | The '' | ||
+ | |||
+ | < | ||
+ | $ cd /bin # go to an absolute directory | ||
+ | |||
+ | $ cd [~] # go home | ||
+ | |||
+ | $ cd - # go to previous directory | ||
+ | </ | ||
+ | |||
+ | ==== Copying & moving files around ==== | ||
+ | |||
+ | > Copying and moving files and directories is done with the '' | ||
+ | |||
+ | Both commands take at least two parameters, which correspond to the '' | ||
+ | |||
+ | > Beware of the pitfalls! you can overwrite data and therefor lose it, without getting any confirmation prompt! If in doubt use '' | ||
+ | |||
+ | < | ||
+ | $ mv old | ||
+ | |||
+ | $ mv old | ||
+ | |||
+ | $ mv file1 file2 # overwrite file2 with file1 | ||
+ | # (BEWARE) | ||
+ | </ | ||
+ | < | ||
+ | $ cp -i input input.bak | ||
+ | |||
+ | $ cp -i input backup/ | ||
+ | |||
+ | $ cp -a dir1/ dir2 # exact copy of dir1 | ||
+ | |||
+ | </ | ||
+ | |||
+ | ==== Creating and deleting ==== | ||
+ | |||
+ | === directories === | ||
+ | |||
+ | > creating directories is done with the '' | ||
+ | |||
+ | The '' | ||
+ | |||
+ | > deleting directories is done with the '' | ||
+ | |||
+ | This command removes the specified directory, but only if it's already empty. it can also take an optional '' | ||
+ | |||
+ | |||
+ | ==== Finding stuff ==== | ||
+ | |||
+ | > To look at everything | ||
+ | |||
+ | |||
+ | - in your home directory | ||
+ | - and nested up to three levels deep inside it | ||
+ | - that ends in '' | ||
+ | - or starts with '' | ||
+ | - and is an ordinary file | ||
+ | - concatenated as one stream: | ||
+ | |||
+ | <code bash> | ||
+ | find \ | ||
+ | ~ \ | ||
+ | -maxdepth 3 \ | ||
+ | -iname " | ||
+ | -or -iname " | ||
+ | -type f \ | ||
+ | -exec cat ' | ||
+ | </ | ||
+ | <code bash> | ||
+ | find \ | ||
+ | ~ \ | ||
+ | -maxdepth 3 \ | ||
+ | -iname " | ||
+ | -or -iname " | ||
+ | -type f \ | ||
+ | -exec cat ' | ||
+ | </ | ||
+ | |||
+ | ==== Contents of files ==== | ||
+ | |||
+ | > **viewing** is done by the **'' | ||
+ | |||
+ | > **concatenating** is done by the **'' | ||
+ | |||
+ | |||
+ | < | ||
+ | $ less file.txt | ||
+ | |||
+ | $ less -R file.txt | ||
+ | |||
+ | $ cat file1 file2 | less | ||
+ | </ | ||
+ | < | ||
+ | $ cat file | ||
+ | |||
+ | $ cat -A printable | ||
+ | |||
+ | $ cat -n numbered | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | $ echo "VSC is great" > file | ||
+ | $ cat file | ||
+ | VSC is great | ||
+ | </ | ||
+ | < | ||
+ | $ echo "VSC is awesome" | ||
+ | $ cat file | ||
+ | VSC is great | ||
+ | VSC is awesome | ||
+ | </ | ||
+ | < | ||
+ | $ cat file | grep awesome | ||
+ | VSC is awesome | ||
+ | </ | ||
+ | < | ||
+ | $ grep awesome file | ||
+ | VSC is awesome | ||
+ | </ | ||
+ | |||
+ | ==== Space accounting ==== | ||
+ | |||
+ | > viewing **used space** is done by the **'' | ||
+ | |||
+ | > viewing **free space** is done by the **'' | ||
+ | |||
+ | |||
+ | < | ||
+ | $ du -h file1 file2 # human readable output | ||
+ | |||
+ | $ du -s dir # summarize | ||
+ | </ | ||
+ | < | ||
+ | $ df -h # human readable output | ||
+ | |||
+ | $ df -t nfs # only list filesystems of a type | ||
+ | </ | ||
+ | |||
+ | {{pandoc: | ||
+ | |||
+ | ==== Recap ==== | ||
+ | |||
+ | < | ||
+ | $ mv space.log space.log.bak | ||
+ | </ | ||
+ | < | ||
+ | $ df -h | grep " | ||
+ | </ | ||
+ | < | ||
+ | $ cat space.log | ||
+ | </ | ||
+ | < | ||
+ | nfs05.ib.cluster:/ | ||
+ | nfs04.ib.cluster:/ | ||
+ | </ | ||
+ | > we do this often, let's wrap it up! | ||
+ | |||
+ | |||
+ | ==== Recap++ ==== | ||
+ | |||
+ | < | ||
+ | $ mv space.log space.log.bak | ||
+ | </ | ||
+ | < | ||
+ | $ df -h | grep " | ||
+ | </ | ||
+ | < | ||
+ | $ cat space.log | ||
+ | </ | ||
+ | < | ||
+ | nfs05.ib.cluster:/ | ||
+ | nfs04.ib.cluster:/ | ||
+ | </ | ||
+ | > we do this often, let's wrap it up! | ||
+ | |||
+ | |||
+ | < | ||
+ | $ echo '# | ||
+ | |||
+ | $ echo 'mv space.log space.log.bak' | ||
+ | |||
+ | $ echo 'df -h | grep " | ||
+ | |||
+ | $ echo 'cat space.log' | ||
+ | </ | ||
+ | < | ||
+ | $ chmod +x spacelog.sh | ||
+ | </ | ||
+ | < | ||
+ | $ ./ | ||
+ | </ | ||
+ | |||
+ | ==== Sed and awk ==== | ||
+ | |||
+ | > **sed** (stream editor) and **awk** are powerful tools when working with the command line | ||
+ | |||
+ | < | ||
+ | $ mycommand | sed " | ||
+ | </ | ||
+ | < | ||
+ | $ mycommand | awk ' | ||
+ | </ | ||
+ | |||
+ | > Using sed and awk in action | ||
+ | |||
+ | ^program | ||
+ | |sed | '' | ||
+ | |sed | '' | ||
+ | |awk | '' | ||
+ | |||
+ | Example script: | ||
+ | |||
+ | |||
+ | <code bash> | ||
+ | #!/bin/bash | ||
+ | |||
+ | mv space.log space.log.bak | ||
+ | df -h | grep " | ||
+ | cat space.log | ||
+ | |||
+ | |||
+ | </ | ||
+ | <code bash> | ||
+ | #!/bin/bash | ||
+ | |||
+ | mv space.log space.log.bak | ||
+ | df -h | grep " | ||
+ | cat space.log | sed " | ||
+ | | awk ' | ||
+ | | column -t | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | <!-- | ||
+ | ### Sort and uniq | ||
+ | |||
+ | > **sort** and **uniq** (unique) are used to sort and uniquify adjacent lines | ||
+ | --> | ||
+ | </ | ||
+ | ===== Scripting ===== | ||
+ | |||
+ | ==== Ownership and Permissions ==== | ||
+ | |||
+ | > Just to ensure that you are able to run your scripts | ||
+ | |||
+ | === chown === | ||
+ | |||
+ | > Change the owner of files and directories by: | ||
+ | |||
+ | <code bash> | ||
+ | chown -R user:group dirs files | ||
+ | # only works with root privilages | ||
+ | </ | ||
+ | === chmod === | ||
+ | |||
+ | > Change the mode of files and directories by: | ||
+ | |||
+ | <code bash> | ||
+ | chmod -R u=rwx, | ||
+ | chmod 640 files | ||
+ | chmod 750 dirs | ||
+ | chmod 750 executables | ||
+ | </ | ||
+ | ==== Shebang ==== | ||
+ | |||
+ | A little test program, which we mark as executable and hand it over to the corresponding interpreter: | ||
+ | |||
+ | <code bash> | ||
+ | cat << EOF > test.sh | ||
+ | |||
+ | echo " | ||
+ | echo " | ||
+ | EOF | ||
+ | </ | ||
+ | <code bash> | ||
+ | chmod +x test.sh | ||
+ | </ | ||
+ | <code bash> | ||
+ | bash test.sh | ||
+ | </ | ||
+ | |||
+ | > Don't we have an OS, capable of executing everything it recognises as an executable? | ||
+ | |||
+ | > Yes, we do! | ||
+ | |||
+ | <code bash> | ||
+ | cat << EOF > test.sh | ||
+ | #!/bin/bash | ||
+ | echo " | ||
+ | echo " | ||
+ | EOF | ||
+ | </ | ||
+ | <code bash> | ||
+ | chmod +x test.sh | ||
+ | </ | ||
+ | <code bash> | ||
+ | ./test.sh | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== Functions (more like procedures) ==== | ||
+ | |||
+ | Programming in bash would be cumbersome without functions, so here we go: | ||
+ | |||
+ | <code bash> | ||
+ | allNumbersFromTo () { | ||
+ | echo "1 2 3" | ||
+ | } | ||
+ | </ | ||
+ | > This isn't good, as were only getting a fixed amount of numbers. Let's try a recursive approach: | ||
+ | |||
+ | <code bash> | ||
+ | allNumbersFromTo () { | ||
+ | num=$1 | ||
+ | max=$2 | ||
+ | echo " | ||
+ | if [ $num -lt $max ]; then | ||
+ | allNumbersFromTo " | ||
+ | fi | ||
+ | } | ||
+ | </ | ||
+ | <code bash> | ||
+ | allNumbersFromTo () { | ||
+ | min=$1 | ||
+ | max=$2 | ||
+ | for num in $(seq $min $max) | ||
+ | do | ||
+ | echo " | ||
+ | done | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | <code bash> | ||
+ | allNumbersFromTo 1 10 | ||
+ | </ | ||
+ | |||
+ | ===== Editors ===== | ||
+ | |||
+ | ==== General ==== | ||
+ | |||
+ | |||
+ | * Many different editors | ||
+ | * Unique (dis-)advantages | ||
+ | * Different look and feel | ||
+ | * Editors should provide us with | ||
+ | - Simple text editing | ||
+ | - Copy and paste | ||
+ | - Search and replace | ||
+ | - Saving changes | ||
+ | - Wide availability | ||
+ | |||
+ | === Two editors that satisfy our needs: === | ||
+ | |||
+ | |||
+ | * nano | ||
+ | * vim | ||
+ | |||
+ | === Common starting point === | ||
+ | |||
+ | <code bash> | ||
+ | nano filename | ||
+ | </ | ||
+ | <code bash> | ||
+ | vim filename | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== Nano ==== | ||
+ | |||
+ | {{pandoc: | ||
+ | |||
+ | ==== Nano explained ==== | ||
+ | |||
+ | > This editor is focused on being easy to use, but still providing every feature a user might need. | ||
+ | |||
+ | === Interface === | ||
+ | |||
+ | > The interface consists of four parts, namely from top to bottom: | ||
+ | |||
+ | |||
+ | * Title bar | ||
+ | * Text area | ||
+ | * Command line | ||
+ | * Key bindings | ||
+ | |||
+ | === Usage === | ||
+ | |||
+ | > Nothing special, key-bindings visible while editing | ||
+ | |||
+ | ^Feature | ||
+ | |Navigation | ||
+ | |Actual editing| | ||
+ | |Cut/Paste line| '' | ||
+ | |... | ||
+ | |||
+ | |||
+ | |||
+ | === Short === | ||
+ | |||
+ | > Use this editor if you are new to the command line.\\ | ||
+ | > It is straight forward, but can be extended on the way. | ||
+ | |||
+ | * Auto-indentation | ||
+ | * Syntax highlighting | ||
+ | * Multi-buffer | ||
+ | |||
+ | |||
+ | {{pandoc: | ||
+ | |||
+ | ==== Vi(m) ==== | ||
+ | |||
+ | {{pandoc: | ||
+ | |||
+ | ==== Vi(m) explained ==== | ||
+ | |||
+ | > This editor is focused on productivity and efficiency, providing everything a user might need. | ||
+ | |||
+ | === Interface === | ||
+ | |||
+ | > The simple interface consists of two parts: | ||
+ | |||
+ | |||
+ | |||
+ | * Text area | ||
+ | * Command line | ||
+ | |||
+ | > Since this editor is very easy to extend, after setting up a few plugins, it will probably look quite different! | ||
+ | |||
+ | |||
+ | === Usage === | ||
+ | |||
+ | > This is a multimode editor, you'll have to switch modes whenever you change what you want to do. | ||
+ | |||
+ | ^Feature | ||
+ | |Navigation| | ||
+ | |Writing | ||
+ | |Commands | ||
+ | |... | ||
+ | |||
+ | |||
+ | |||
+ | === Short === | ||
+ | |||
+ | > Use this editor if you like a challenge.\\ | ||
+ | > It is fast and very nice --- but you'll sometimes get hurt on the way. | ||
+ | |||
+ | * Auto-indentation, | ||
+ | * File/ | ||
+ | * Use a plugin manager | ||
+ | |||
+ | |||
+ | {{pandoc: | ||
+ | |||
+ | ==== Vi(m) modes and keys ==== | ||
+ | |||
+ | * any mode: | ||
+ | * back to the **default mode**: **'' | ||
+ | * command mode (followed by '' | ||
+ | * **save** current file: **'' | ||
+ | * **quit** the editor | ||
+ | * after saving: **'' | ||
+ | * without confirmation: | ||
+ | * **help**: **'' | ||
+ | * **search and replace**: **'' | ||
+ | * //default mode//: | ||
+ | * enter **input mode**: **'' | ||
+ | * enter **command mode**: **'' | ||
+ | * **mark** | ||
+ | * **character**-wise: | ||
+ | * **line**-wise: | ||
+ | * **delete** | ||
+ | * **character**-wise: | ||
+ | * **line**-wise: | ||
+ | * **marked content**: **'' | ||
+ | * **search**: **'' | ||
+ | |||
+ | |||
+ | [[http:// | ||
+ | |||
+ | ===== .bashrc ===== | ||
+ | |||
+ | ==== .bashrc ==== | ||
+ | |||
+ | <code bash> | ||
+ | # .bashrc | ||
+ | |||
+ | # Source global definitions | ||
+ | if [ -f /etc/bashrc ]; then | ||
+ | . /etc/bashrc | ||
+ | fi | ||
+ | |||
+ | # User specific aliases and functions | ||
+ | alias sq=' | ||
+ | alias rm='rm -i' | ||
+ | |||
+ | export PATH=" | ||
+ | </ | ||
+ | < | ||
+ | <!-- | ||
+ | ## Legal {.slidy} | ||
+ | |||
+ | ### Copyleft & Copyright {.slidy} | ||
+ | |||
+ | <div class=slidy> | ||
+ | - wikipedia --- " | ||
+ | - [CC-Attribution-ShareAlike (CC-BY-SA)](https:// | ||
+ | - [Directory Tree](https:// | ||
+ | - VSC --- Lengyel Balazs: | ||
+ | - No explicit license | ||
+ | - Screenshots | ||
+ | </ | ||
+ | --> | ||
+ | </ | ||