126 lines
8.1 KiB
Markdown
126 lines
8.1 KiB
Markdown
![]() |
---
|
||
|
title: 00 Introduction
|
||
|
description: Start Here
|
||
|
published: true
|
||
|
date: 2023-04-28T19:51:11.756Z
|
||
|
tags:
|
||
|
editor: markdown
|
||
|
dateCreated: 2023-04-28T05:31:54.093Z
|
||
|
---
|
||
|
|
||
|
# Introduction
|
||
|
This guide will set you up with a fresh Arch Linux installation, And if you want a Server, Clean installation or Complete general purpose installation with most of the applications you will ever need, And a graphical package manager in the case you need even more.
|
||
|
|
||
|
But before we can go there you need to understand a few things.
|
||
|
|
||
|
# Basic Instructions
|
||
|
Understand a command before you execute it, Executing code you don't understand is the best way to break your machine, let your machine get raped, get scammed, or end up in prison. So understand every letter of a command before you execute it.
|
||
|
|
||
|
Be sure to read everything, On this page but also the output of the terminal. Not only because you need to know what you are doing, but also because there are a lot of parameters that need to be changed.
|
||
|
|
||
|
No response means everything went well, If you get an error back make sure you typed the command correctly
|
||
|
|
||
|
# Basic Commands
|
||
|
Troughout the guide we will use several basic commands, The guide assumes you know what they do, And I do not allow you to run a command you do not understand.
|
||
|
|
||
|
`pwd` print working directory
|
||
|
If you type `pwd` in a terminal and press enter it will show in which directory you are at the moment.
|
||
|
|
||
|
`ls` list
|
||
|
it will display all contents of the current directory. I would recommend using this with the options -a and -l `ls -la` would list all files including hidden files in a list with some handy details.
|
||
|
|
||
|
`mkdir` make directory
|
||
|
creates a directory. `mkdir bla` would create a folder called bla in the current directory
|
||
|
|
||
|
`cd` change directory
|
||
|
change to a different directory. `cd bla` would move you to the folder bla in the current directory.
|
||
|
|
||
|
`touch` touch
|
||
|
it will create a file and update the time if it already exists. `touch bla` would create an empty file called bla
|
||
|
|
||
|
`cp` copy
|
||
|
it will copy a file `cp file1 file2` would copy file1 to file2, `cp -r folder1 ../folder2` would copy folder 1 to folder2 next to this directory.
|
||
|
|
||
|
`mv` move
|
||
|
move does the same as copy, only it will move the file or folder and not leave a duplicate, This command is also used to rename files and folders using `mv file1 file2` will rename file1 into file2.
|
||
|
|
||
|
`ln` link
|
||
|
link is used to create links between files, kind of like "Shortcuts" on Windows. we create links like this `ln -sf realfile linkfile` now linkfile will point to realfile and if you make changes to one both will be affected.
|
||
|
|
||
|
`exit` exit
|
||
|
Kinda obvious, but here we exit the shell, if you open bash by typing `bash` pressing enter and then type `exit` and press enter you would be back in the terminal where you started.
|
||
|
|
||
|
`reboot` reboot
|
||
|
Also very obvious, this one reboots your machine, just type `reboot` and press enter
|
||
|
|
||
|
`chmod` change mode
|
||
|
With this you can change the permissions on a file or folder like so `chmod +x file` it would make file executable for everyone, you can do + and - to add and remove permissions, r is read, w is write and x is execute. You can also use numbers like so `chmod 755 file` it would give all permissions to the owner, but only read and execute for the group and others. 4 is read, 2 is write, 1 is execute, you can add them to give multiple rights, so 4 would be read, 6 would be read and write, 7 would be all rights. `chmod 421 file` would make the file readable for only the owner, writeable for only the group, and executable only for others.
|
||
|
|
||
|
`chown` change owner
|
||
|
This changes the owner of a file, a file has a owner, and a file belongs to a group, you can set both like so `chown owner:group file` file will now be owned by owner and belong to the group group.
|
||
|
|
||
|
`echo` echo
|
||
|
echo simply repeats whatever argument you give it `echo Hello` would print back "Hello"
|
||
|
|
||
|
`sudo` super user do
|
||
|
sudo allows you to execute commands as a different user it is mostly used for executing something as the root user `sudo bash` would open a new terminal as the root user. It is not recommended to use your system as the root user, therefore sudo was invented, just use sudo if you need to do something as root. But again, know what you execute.
|
||
|
|
||
|
There are lots and lots more, but these are all you need to know for this guide.
|
||
|
|
||
|
# Basic Syntax
|
||
|
` ` space
|
||
|
The space is a seperator, it seperates commands from the options and the options from the arguments, different forms of whitespace can be used
|
||
|
|
||
|
`/` forward slash
|
||
|
this means next folder if you lead with it you will get an absolute path `/home/user/file` is an absolute path. `./file` or `file` is a relative path, it will expect file in the current directory
|
||
|
|
||
|
`.` period
|
||
|
Current directory, you can use it as an argument for many commands it is most often used to execute something in or on the current directory like `./executable` or `chown user .`
|
||
|
|
||
|
`..` double period
|
||
|
Upper Directory, probably most often used for `cd` like so `cd ../..` to go up 2 directories you can also use it to execute a file in a relative directory like so `../folder/executable`
|
||
|
|
||
|
`\` backslash
|
||
|
Escape character, is used for lots of things, but we only use it for when we want to use a character that has a special meaning, for example space, if we want open a file with vim called "A B C" we would run this command `vim A\ B\ C`
|
||
|
|
||
|
`>` Is Greater Than
|
||
|
overwrite file, when you see this character in a command it is redirecting the output, for the scope of this guide we will use it to redirect output to a file but appending a file behind it, like so `echo Hello > file` will overwrite the content of file with Hello.
|
||
|
|
||
|
`>>` Double Is Greater Than
|
||
|
add to end of file, it does the same as the Greater Than above, but this one doesn't overwrite but adds the output on a new line in the file.
|
||
|
|
||
|
`*` Asterisk
|
||
|
wildcard, expands to everything you can use it to open all files in the current directory using `vim *` only open .c files with `vim *.c` or open all files in every folder `vim */*` ofcourse this also works with absolute paths.
|
||
|
|
||
|
There are lots and lots more, but this is all the syntax you need to know for this guide
|
||
|
|
||
|
# Vim Basics
|
||
|
Vim is this amazing text editor, it is without a doubt the best text editor in existance, you can do more with it than you will ever be able to remember. all in such a nice small extendable package. Yes emacs can do more, But we just want a text editor, not play tetris and browse the web :P
|
||
|
|
||
|
One important thing to know about vim is that it uses different modes, and in the "normal" mode you can't insert characters normally. There are 3 modes in vim; Normal, Insert and Visual.
|
||
|
|
||
|
Normal mode is the default mode in Vim, you can always go back to it from other modes by pressing `esc` on your keyboard. In Normal mode you can look at the file, execute commands that start with `:` search for something by pressing `/` and much much more.
|
||
|
|
||
|
Insert mode is where we edit the file as if it was a normal text editor, you can press `i` to go into it after the cursor, there are different ways to get into it, but they are out of scope for this guide.
|
||
|
|
||
|
Visual mode is not relevant for this guide, but you can use it, if you press `v` from normal mode you go into visual mode to select text, `d` to cut and `y` to copy. You can also select whole lines with `shift + v` and select a block with `ctrl + v`
|
||
|
|
||
|
The last thing you need to know are commands, with these commands you can save a file, quit vim, or manipulate the text in ways you can't imagine, listing all commands and explaining it alone would make this guide much larger than it is now, so just a few relevant ones.
|
||
|
|
||
|
go to the end of the line by pressing `$`
|
||
|
go to the beginning with `0`
|
||
|
go to the end of file with `G`
|
||
|
go back to the beginning with `g`
|
||
|
go to line 34 with `34gg`
|
||
|
paste content with `p`
|
||
|
cut a line with `dd`
|
||
|
to save a file type `:w` and press enter
|
||
|
to quit vim type `:q` and press enter
|
||
|
to force an action like `q` and `w` add `!` to your command like this `:q!` or `:w!`
|
||
|
You can also combine actions like so `:wq!`
|
||
|
to execute a terminal command type `:! command` and press enter
|
||
|
|
||
|
# Next
|
||
|
Congratulations, You already know more about Linux and Vim than the average person
|
||
|
|
||
|
Next up is the actual installation you can simply click on "01 Base" on the left side
|