***
Wartungsfenster jeden ersten Mittwoch vormittag im Monat
***
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Linux Primer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ASC Public
Training Materials
Linux Primer
Commits
a37453aa
Commit
a37453aa
authored
2 years ago
by
Siegel, Moritz
Browse files
Options
Downloads
Patches
Plain Diff
readme3
parent
88286ad1
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
readme.md
+1131
-0
1131 additions, 0 deletions
readme.md
with
1131 additions
and
0 deletions
readme.md
0 → 100644
+
1131
−
0
View file @
a37453aa
---
author
:
Markus Hickel, Moritz Siegel
title
:
Linux Primer
institute
:
VSC Research Center, TU Wien
date
:
\today
---
### Timetable
4 parts, each:
-
Lecture
-
Exercise
-
Demonstration
-
Break
Lunchbreak from 12 to 1 pm.
Questions? Always!
<!---
### Operating Systems
Vote: What's your
**operating systems**
?
-
**Linux**
-
**macOS**
-
**Windows**
-->
### Why Linux?

{height=80% style="float: right;"}
### What do you know about Linux?
<!---
By a show of hands:
-
Nothing
-
Terminal and command line
-
Files and directories
-
Permissions
-
Variables
-
Streams
-
Shell scripts
-->
### Terminal & Prompt
Welcome to a
**terminal**
showing the default
`bash prompt`
.
```
{.bash .numberLines startFrom=""}
myuser@mymachine: mylocation$
trainee00@l31:~$
trainee00@l41:~/mydir$
```
All the
`typewriter`
text, and all dark grey boxes mean
**code**
.
Lines that start with a
`"$"`
means a
**command in a terminal**
.
### Execution
To execute a command or run a program, we
**call**
it.
```
{.bash .numberLines startFrom=""}
$ whoami
trainee00
$ echo "hello world"
hello world
$ gcc myprogram.c
```
### History
Type
`history`
for a log of all the commands you executed so far.
```
{.bash .numberLines startFrom=""}
$ history
whoami
echo "hello world"
gcc myprogram.c
```
For the last commands try
`<Up-Arrow>`
, or type
`<CTRL>-R`
to search
for keyword.
### Completion
Type
`<TAB>`
when you enter a command to get
**suggestions**
.
```
{.bash .numberLines startFrom=""}
$ e<TAB>
e2freefrag env eu-elflint
e2fsck envsubst eu-findtextrel
e2image eodc_commands.py eu-make-debug-archive
...
```
If there is only one possible match, it gets
**completed**
.
```
{.bash .numberLines startFrom=""}
$ ec<TAB>
echo
```
### Parameters
Give your program more info: write parameters
**following**
the
program name.
1.
Single-character with dash
```
{.bash .numberLines startFrom=""}
$ mycommand -a -b -c -d -e
$ ls -1alh
```
2.
Multi-character with double dash
```
{.bash .numberLines startFrom=""}
$ mycommand --long-parameter
$ mycommand --flag-parameter=flag-value
$ ls --color=always
```
3.
Strings
```
{.bash .numberLines startFrom=""}
$ mycommand mysource mydestination
$ cp myoldfile mynewfile
```
### Order
Run
**from**
the source
**to**
the destination.
```
{.bash .numberLines startFrom=""}
$ mycommand mysource mydestination # ok
$ mycommand mydestination mysource # probably wrong
```
Keep parameters and their arguments
**together**
.
```
{.bash .numberLines startFrom=""}
$ mycommand -j 2 --color auto # ok
$ mycommand -j auto --color 2 # probably wrong
```
**Beware**
, the spaces between program name and parameter are important.
### Filesystem
The filesystem has different
**objects**
.
-
Files
-
Directories
-
Links
### Path
Everything starts at the
**root directory**
`"/"`
.
```
{.bash .numberLines startFrom=""}
/
/home/fs70824/trainee00
/home/lv70824/trainee00/mydir
```
Objects can be referenced by their
**absolute**
or
**relative**
path.
```
{.bash .numberLines startFrom=""}
/home/fs70824/trainee00/mydir/myfile
mydir/myfile
./myfile # in this directory
../myfile # in the directory above
```
### Exercise 1
-
[ ] Start a
**terminal**
and login to
**VSC**
-
[ ] What machine are you on?
-
[ ] Run these
**commands**
(without the
`"$"`
):
```{.bash .numberLines startFrom=""}
$ man
$ man man
$ echo "hello world"
```
-
[ ] Use
**completion**
to find out what this command could be:
```
{.bash .numberLines startFrom=""}
$ whoa
```
- [ ] View your command **history**
- [ ] **Search** for the `echo` command in your history
### Look Around
Type `ls` (list) to **look around**.
```{.bash .numberLines startFrom=""}
$ ls
all_numbers_from_to.sh delete_me_empty delete_me_recursive
```
```{.bash .numberLines startFrom=""}
$ ls -a
. delete_me_empty empty_dir one_string_two_words.sh
.. delete_me_nonempty fizz_buzz.c .found_me_hiding.txt
```
### Move Around
Type `pwd` (print working directory) to see your **current
position**.
```{.bash .numberLines startFrom=""}
trainee00@l40:~$ pwd
/home/fs70824/trainee00
```
Type `cd` (change directory) to **move around**.
```{.bash .numberLines startFrom=""}
$ cd /bin
$ cd mydir
$ cd .. # go to parent directory
$ cd ~ # go home
$ cd - # go to previous directory
```
### Create
Type `mkdir` to **make** a new directory.
```{.bash .numberLines startFrom=""}
$ mkdir mynewdir
```
Type `touch` **create** an empty file.
```{.bash .numberLines startFrom=""}
$ touch mynewfile # create empty file
```
There are many more ways to write to files.
### Read
Type `less` to **view** a textfile.
```{.bash .numberLines startFrom=""}
$ less myfile.txt # exit with "q"
```
Type `head` to view a the **beginning** of textfile.
```{.bash .numberLines startFrom=""}
$ head myfile.txt
```
Type `tail` to view a the **end** of textfile.
```{.bash .numberLines startFrom=""}
$ head myfile.txt
```
### Cat
Type `cat` to **concatenate** textfiles.
```{.bash .numberLines startFrom=""}
$ cat myfile
$ cat myfile1 myfile2 myfile3 ...
$ cat -n myfile1 myfile2 # line numbers
```
### Delete
Type `rmdir` to **remove** an empty directory.
```{.bash .numberLines startFrom=""}
$ rmdir myemptydir
```
Type `rm` to **remove** stuff, be careful!
```{.bash .numberLines startFrom=""}
$ rm myfile
$ rm -r mynonemptydir/
$ rm -f myfile # force, beware!
```
### Copy & Move
Type `mv` to **move stuff**.
```{.bash .numberLines startFrom=""}
$ mv myfile mydir/ # move myfile into mydir
$ mv mydir1/ mydir2/ # move whole mydir1 into mydir2
$ mv myold mynew # rename myold to mynew
$ mv myfile1 myfile2 # overwrite myfile2 with myfile1 (BEWARE)
```
Type `cp` to **copy stuff**.
```{.bash .numberLines startFrom=""}
$ cp myinput myinput.bak # copy input to input.bak
$ cp myinput mybackup/ # copy input into backup dir
$ cp -r mydir1/ mydir2 # copy whole dir1 into dir2
```
### Remote Copy
Use `scp` (secure copy) on your local machine to copy files
**to/from** a remote machine.
```{.bash .numberLines startFrom=""}
$ scp mysource mydestination
$ scp mylocalfile trainee00@vsc4.vsc.ac.at:myvscfile
$ scp -r mylocaldir trainee00@vsc4.vsc.ac.at:myvscdir
$ scp trainee00@vsc4.vsc.ac.at:myvscfile mylocalfile
```
Use `"-r"` to copy whole **directories** to/from.
### sshfs
Use `sshfs` on your local machine to **mount** a remote directory at
your local machine.
```{.bash .numberLines startFrom=""}
$ sshfs trainee00@vsc4.vsc.ac.at:myvscdir ~/mylocaldir
```
Type `mount` on your local machine to **view** mounted directories.
```{.bash .numberLines startFrom=""}
$ mount | grep sshfs
trainee02@vsc4.vsc.ac.at: on /home/m/tmp type fuse.sshfs (rw,...)
```
Type `umount` to release the remote directory.
```{.bash .numberLines startFrom=""}
umount ~/mylocaldir
```
### Filezilla
**Beware**, always use `Logon Type interactive`.
{height=80% style="float: right;"}
### WinSCP
{height=80% style="float: right;"}
### Search
Use `grep` to **search** for patterns in text.
```{.bash .numberLines startFrom=""}
$ grep foo myfile
$ grep bar myfile1 myfile2 myfile3
$ grep -r baz mydir/
$ grep "if" fizz_buzz.c
$ grep -r "a" ~
```
### Man
Type `man` to read the **manual**.
```{.bash .numberLines startFrom=""}
$ man man
$ man grep
$ man rsync
```
Type `"/"` to **search** for keyword within man, `"h"` for **help** or
`"q"` to **quit**.
### Top
Type `top` to watch all **processes**.
```{.bash .numberLines startFrom=""}
$ top
Tasks: 650 total, 3 running, 605 sleeping, 42 stopped, 0 zombie
%Cpu(s): 5.3 us, 0.8 sy, 0.0 ni, 94.0 id, 0.0 wa, 0.0 hi,
KiB Mem : 65770984 total, 9477932 free, 9133728 used, 47159324
KiB Swap: 0 total, 0 free, 0 used. 52517312
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+
20259 trainee00 20 0 258224 101832 7456 R 100.0 0.2 0:58.93
19237 trainee00 20 0 249252 88808 9484 R 84.0 0.1 5:58.72
...
```
Type `h` to get **help** within top.
Type `1` within top to watch all **cores**.
<!-- ### Top -->
<!-- Type `1t` within top to watch all **cores**. -->
<!-- ```{.bash .numberLines startFrom=""} -->
<!-- top - 15:59:40 up 55 days, 7:02, 18 users, load average: 2.75, 2.76, 2.87 -->
<!-- Tasks: 541 total, 2 running, 538 sleeping, 1 stopped, 0 zombie -->
<!-- %Cpu0 : 5.6/9.0 15[||||||||||| ] -->
<!-- %Cpu1 : 8.4/15.2 24[||||||||||||||||||| ] -->
<!-- %Cpu2 : 7.3/12.6 20[|||||||||||||||| ] -->
<!-- %Cpu3 : 5.6/11.6 17[||||||||||||| ] -->
<!-- %Cpu4 : 3.3/7.3 11[||||||||| ] -->
<!-- ``` -->
### Exercise 2
- [ ] Look around
- [ ] Copy setup script & run it with your **surname**:
```{.bash .numberLines startFrom=""}
$ cp ~training/vsc_linux_intro.sh ~
$ bash ~/vsc_linux_intro.sh myname
```
- [ ] Move into `vsc_linux_intro_myname`
- [ ] Make a directory `foo`
- [ ] Delete the directory `delete_me_empty`
- [ ] Delete the directory `delete_me_nonempty` with the help of **man**
- [ ] Copy the `vsc_linux_intro_myname` to your computer with **scp/rsync**
- [ ] Mount `vsc_linux_intro_myname` on your local machine with **sshfs**.
### Ownership and Permissions
Type `ls -lh` to **view** ownership and permissions of stuff.
```{.bash .numberLines startFrom=""}
$ ls -lh
permission # user group size date time name
drwxr-xr-x 4 training p70824 4.0K Feb 23 19:41 empty_dir
lrwxrwxrwx 1 training p70824 11 Feb 23 19:41 link... -> ./empty_dir
-rw-r--r-- 1 training p70824 375 Feb 23 19:41 fizz_buzz.c
...
```
Here `rwxr-xr-x` means the **permissions**, with **r**ead, **w**rite,
e**x**ecute.
1. `user` can `rwx`
2. `group` can `rx`
3. `others` can `rx`
Here all belongs to the is the **user** `training` (owner) and the
**group** `p70824`.
<!-- ### Ownership -->
<!-- Type `chown` (change owner) to change **ownership** of stuff. -->
<!-- ```{.bash .numberLines startFrom=""} -->
<!-- $ chown myuser myfile -->
<!-- $ chown -R myuser:mygroup mydir -->
<!-- $ chown me foo.cc -->
<!-- ``` -->
### Permissions
Type `chmod` (change mode) to **change** permissions of stuff.
```{.bash .numberLines startFrom=""}
$ chmod myoption myfile
$ chmod -R myoption mydir
$ chmod +x myexecutable
$ chmod u=rwx,g+x,o-rwx myfile
```
Where `u,g,o` means **u**ser, **g**roup and **o**thers.
### Size & Space
Type `du` (disk usage) to view the **size** of stuff.
```{.bash .numberLines startFrom=""}
$ du mydir
$ du -h myfile1 myfile2 # human readable output
$ du -s mydir # summarize
```
Type `df` (disk free) to view the **free space** of the whole system.
```{.bash .numberLines startFrom=""}
$ df
$ df -h # human readable output
$ df -t nfs # only list filesystems of a type
```
**Beware**, you cannot have more files than the **maximum number** of
files at `VSC`!
### Redirects
Use `">"` to redirect, or `">>"` to append **output** stream to a
**file**.
```{.bash .numberLines startFrom=""}
mycommand > mystd.log # redirect "stdout" to a file
mycommand >> mystd.log # append "stdout" to a file
mycommand 2> myerr.log # redirect "stderr" to a file
mycommand 2>> myerr.log # append "stderr" to a file
mycommand 2>&1 # redirect "stderr" to "stdout"
```
Use `"<"` to redirect a **file** to the **input** stream of a program.
```{.bash .numberLines startFrom=""}
mycommand < myconfig # redirect a file to "stdin"
```
### Pipe
Use `"|"` to write output stream **into** the input stream of another
process.
```{.bash .numberLines startFrom=""}
mycommand1 | mycommand2
mycommand1 | mycommand2 | mycommand3 | ...
mycommand | grep foo # pipe "stdout" into "grep"
df -h | grep data # show disk free of data fs
ls | grep "foo" | head # first "foo" in current dir
```
### Manipulate Streams
Use `sed` (stream editor) to manipulate text, like **substitute
words**.
```{.bash .numberLines startFrom=""}
$ mycommand | sed "myoption"
$ mycommand | sed "s/foo/bar/" # replace foo with bar
```
Use `awk` to manipulate structured text, like show **columns**.
```{.bash .numberLines startFrom=""}
$ mycommand | awk '{myoption}'
$ ls -l | awk '{print $1}' # print column 2 of every line
$ df | awk '{print "hello", $5, $3}' # print hello, column 5 and 3
```
### Alias
Use `alias` to define an **abbreviation** for commands.
```{.bash .numberLines startFrom=""}
$ alias myalias='mycommand myoptions'
$ alias ll='ls -alh'
$ alias rm='rm -i'
```
<!---$ alias myproject='cd $myprojectdir; make && ./myproject' -->
Now you can use the **alias** instead.
```{.bash .numberLines startFrom=""}
$ ll # Same as "ls -alh"
$ rm # Same as "rm -i"
```
<!--- $ myproject # Same as "cd $myprojectdir; make && ./myproject" -->
Type `alias` to show all **defined** aliases.
### Escapes & Quotes
1. Backslash escape:
Escapes a single character, that would have a special meaning.
```
{.bash .numberLines startFrom=""}
$ mycommand this
\
is
\
a
\
single
\
parameter
```
2. "Double Quotes":
Does some **wordmagic**: Escape all whitespace characters, expand
variables, etc.
```
{.bash .numberLines startFrom=""}
$ mycommand "$HOME will be /home/myuser"
```
3. 'Single Quotes':
Every character is treated **literally**.
```
{.bash .numberLines startFrom=""}
$ mycommand '$HOME will be $HOME'
```
### Variables
Use `"="` to **set** information as a variable.
```
{.bash .numberLines startFrom=""}
$ myvar=myvalue
$ foo=bar
```
Now use `"$"` to **get** a variable.
```
{.bash .numberLines startFrom=""}
$ mycommand $myvar
$ echo $foo
```
**Beware**, bash variables are untyped.
### Environment Variables
**Environment variables** are visible for all programs.
Use `export` to **set** a variable as environment variable.
```
{.bash .numberLines startFrom=""}
$ export myvar=myvalue
$ export LANG=en_US.UTF-8
```
**Beware** if this variable already exists, you **overwrite** it!
```
{.bash .numberLines startFrom=""}
export PATH="$HOME/bin/:$PATH"
```
Overwrite `PATH` to **add** a directory with your programs/scripts.
### Environment Variables
Type `env` to **view** all set environment variables
```
{.bash .numberLines startFrom=""}
$ env
```
Now use `"$"` to **get** a environment variable.
```
{.bash .numberLines startFrom=""}
$ mycommand $myvar
$ echo $LANG
```
Use `unset` or `env -u` to **delete** an environment variable.
```
{.bash .numberLines startFrom=""}
unset LANG # no "$" here!
env -u LANG # no "$" here!
```
### Environment Variables
Some exemplary environment variables:
```
{.bash .numberLines startFrom=""}
HOME # home directory
PATH # program paths, in priority order
LIBRARY_PATH # libraries to link by the compiler
LD_LIBRARY_PATH # libraries to link at runtime
```
### Wildcard
Use `"*"` as a placeholders for **any number** of characters.
Use `"?"` for **any single** character.
```
{.bash .numberLines startFrom=""}
$ ls
*
.pdf # list all pdf files
$ less readme.??? # read readme regardless of file type
$ cp
*
mydir/ # copy eveything into mydir
```
There are a lot of others, like `"^"` or `"$"` for beginning and end.
### Exercise 3
- [ ] Write your name into a text file `myname` using `echo`
- [ ] What is the size of **all** the files in this directory?
- [ ] How much space is left on your `$HOME` and on the `/home` file system?
- [ ] Delete **jpg** files inside directory `delete_only_jpg` **at once**
- [ ] Combine the files inside directory `cat_together` to **one** new file
- [ ] Write your name in the file `try_to_write_to_me`
- [ ] Define the **variable** `NAME` using your surname
- [ ] Export `NAME` as an **environment variable**
- [ ] Delete the **environment variable** `NAME`
### Editor
{height=80% style="float: right;"}
### Nano
Use `nano` to **read and write** text files.
- No **mouse**!
- **Search** with `<CTRL>-W`
- **Search & replace** with `<CTRL>-\`
- **Cut** line with `<CTL>-K`
- **Paste** line with `<CTL>-U`
- **Undo** with `<ALT>-U`
- **Save & quit** with `<CTRL>-X`
Complicated editors like **vim** are more powerful.
### Scripting
Write a shell script to run a **sequence of commands**, like a cooking
recipe.
```
{.bash .numberLines startFrom=""}
#!/bin/bash
echo "foo bar"
mkdir mydir
```
Call `bash` to execute a shell script.
```
{.bash .numberLines startFrom=""}
$ bash myscript.sh
```
Use `chmod +x`, then call your script directly with `./myscript`.
### Scripting
Like a cooking recipe, your shell script will **continue**, even if a
command **fails**.
**Beware, do not try this at HOME!**
```
{.bash .numberLines startFrom=""}
#!/bin/bash
cd mynotexistingdir
rm -rf
*
```
**Beware, do not try this at HOME!**
What could happen if you executed this horrible example?
### Shebang
Write a shebang in the first line of your script to tell the shell
your **language**.
```
{.bash .numberLines startFrom=""}
#!/bin/mylanguage
echo "written in foo"
```
```
{.bash .numberLines startFrom=""}
#!/bin/bash
echo "written in bash"
```
```
{.python .numberLines startFrom=""}
#!/bin/python
print "written in python"
```
### Loop
Use **loops** in `bash` scripts to loop over files, numbers.
```
{.bash .numberLines startFrom=""}
for i in
*
do
echo $i
done
```
```
{.bash .numberLines startFrom=""}
while true
do
echo "annoying hello world"
sleep 1
done
```
Or even in **one line**, separated by semicolons, in terminal.
```
{.bash .numberLines startFrom=""}
$ for i in {1..5}; do echo $i; done
```
### Expansion
Use **brace expansion** in `bash` to, well expand braces.
```
{.bash .numberLines startFrom=""}
$ echo {a,b,c}1
a1 b1 c1
$ echo a{1..9}z
a1z a2z a3z a4z a5z a6z a7z a8z a9z
$ echo {a..z}
a b c d e f g h i j k l m n o p q r s t u v w x y z
```
### If/else
Use `if/else` in `bash` scripts to make quick **yes/no** decisions.
```
{.bash .numberLines startFrom=""}
if [ $myvariable == 0 ]
then
emycommand1
elif [ $myvariable == 1 ]
then
mycommand2
else
mycommand3
fi
```
### Case
Use `case` in `bash` scripts when a single variable can **many
values**.
```
{.bash .numberLines startFrom=""}
case $myvariable in
0)
mycommand1
;;
a)
mycommand2
;;
*
)
mycommand3
;;
esac
```
### .bashrc
Write a `.bashrc` in your `$HOME`, a script that gets executed
every time you log in.
```
{.bash .numberLines startFrom=""}
#!/bin/false
# define aliases
alias l='ls -1Bhl'
alias sq='squeue -u $USER'
alias rm='rm -i'
# add your own binary directory
export PATH="$PATH:$HOME/bin"
```
An **example** is available at `~training/bashrc_recommended`
Call `source ~/.bashrc` to reload changes.
### Exercise 4
- [ ] Write your name in a file using **nano**
- [ ] Define and run an **alias**
- [ ] **Read & run** the shell script `all_numbers_from_to.sh`
- [ ] **Read & run** the shell script `one_string_two_words.sh`
- [ ] Test different `for j in ...` in `one_string_two_words.sh` using **nano**
- [ ] Write a shell script that **makes a directory** `foobar`
- [ ] Write a shell script that **makes 100 files**
- [ ] **Compile** `fizz_buzz.c` and **run** the resulting program `a.out`
## Bonus Content
### Remote Sync
Use `rsync` (remote sync) on your local machine to **synchronise**
files with remote machine. `Rsync` is like a more complicated but more
powerful `scp`.
```
{.bash .numberLines startFrom=""}
$ rsync myoptions mysource mydestination
$ rsync mylocalfile trainee00@vsc4.vsc.ac.at:myvscfile
$ rsync trainee00@vsc4.vsc.ac.at:myvscfile mylocalfile
$ rsync -a mylocaldir/ trainee00@vsc4.vsc.ac.at:myvscdir
```
The flag `"-a"` (archive) syncs whole directories recursively yet
preserves symbolic links, special and device files, modification
times, groups, owners, and permissions, but needs root.
Without the trailing slash in `"mylocaldir/"` rsync places the whole
directory inside the remote directory `myvscdir/mylocaldir/myfiles`.
### Remote Sync
Use the `"-n"` flag with `rsync` to test your command without copying
anything.
```
{.bash .numberLines startFrom=""}
$rsync -anv mylocaldir/ myvscdir
sending incremental file list
./
myfile1
myfile2
myfile3
...
```
Use the `"-v"` flag (verbose) with `rsync` to get more information.
### Editors
Editors can
- Read and write
- Copy and paste
- Search and replace
Examples
- `nano`: simple and super easy
- `emacs`: a lot of magic using `<CTRL> <ALT> <SHIFT>`
- `vim`: every letter is a command (complicated)
### Nano
::::: columns
::: column
Use `nano` if you are new to linux.
- **search** with `<CTRL>-W`
- **search & replace** with `<CTRL>-\`
- **cut** line with `<CTL>-K`
- **paste** line with `<CTL>-U`
- **undo** with `<ALT>-U`
- **save & quit** with `<CTRL>-x`
:::
::: column
{height=50% style="float: right;"}
:::
:::::
### Emacs
::::: columns
::: column
Use `emacs` if you find `nano` boring.
- **search** with `<CTRL>-s`
- **stop** with `<CTRL>-g`
- **undo** with `<CTRL>-"/"`
- **find and replace** with `<ESC> %`
- **save** with `<CTRL>-x <CTRL>-s`
- **quit** with `<CTRL>-x <CTRL>-c`
:::
::: column
{height=50% style="float: right;"}
:::
:::::
### Vim
::::: columns
::: column
Use `vim` if you find `emacs` boring.
1. | Type `<ESC>` to go into normal mode
| **Every letter** you type is a **command**!
2. | Type `i` for insert mode
| A **letter** is just a **letter**
3. | Type `":"` for command mode
| Enter your command to **execute**
:::
::: column
{height=50% style="float: right;"}
:::
:::::
### Vim
Vim examples
- **delete** with `d`
- **search** with `"/" foo`
- **undo** with `u`
- **find and replace** with `":" s/foo/bar/c`
- **save** with `":" w`
- **quit** with `":" q`
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment