initial commit

This commit is contained in:
Malin Freeborn
2020-01-02 01:04:35 +01:00
commit 6befc5d3c1
162 changed files with 19086 additions and 0 deletions

58
fundamentals/archives.md Normal file
View File

@@ -0,0 +1,58 @@
# Automatic Backups with `find`
> find /home/"$(whoami)" -type f -size -2M | xargs zip -u backup
# Tar Archives
Create ze files:
> tar czf file.tar.gz file1 file2
Extract ze files:
> tar xzf file.tar.gz
The .tar extension means two or more files are bundled together into a single file. The .tar.gz means compression.
Tarballs come with a number of arguments.
- c means 'create'.
- v means 'verbose'.
- f means 'this is the file' and must always be the ultimate argument.
- z means compression.
So we can compress file1 and file2 into a single tar called 'archive' with:
> tar czvf archive.tar.gz file1 file2
Extraction uses 'x' instead of 'c'.
> tar xzvf archive.tar.gz
Create a very compressed file:
> tar cfj super-compressed.tar.gz file1 file2
# Example - Compressing all Latex Files in /home/
> sudo find ~ -maxdepth 4 -name "*.txt" | xargs tar cvf latex-bundle.tar.gz
# ssh backup
Back up an unmounted partition with ssh:
> sudo dd if=/dev/sda1 | ssh -C ghost@192.168.0.10 "dd of=/home/ghost/backup.img" status=progress
# img.xz
Unzip the image with:
> unxz void.img.xz
This then deletes the .xz file. To keep it:
> unxz --keep void.img.xz

34
fundamentals/at.md Normal file
View File

@@ -0,0 +1,34 @@
`at` must be installed with:
> sudo apt-get install at
Then jobs can be specified with absolute time, such as:
> at 16:20
> at noon
> at midnight
> at teatime
The jobs can also be specified relative to the current time:
> at now +15 minutes
Finally, accept the jobs with ^D.
# Managing `at` Jobs
Display a list of commands to run with:
> atq
`2 Sat Oct 20 16:00:00 2018 a roach-1`
This will print all pending IDs. Remove a job by the ID with:
> atrm 2
Check /var/spool/cron/

154
fundamentals/bash.md Normal file
View File

@@ -0,0 +1,154 @@
# STIN, STOUT, STERR
Input is 0, output is 1, error is 2.
Pipe standard output to log.txt while also outputting it.
> cat file.txt |& tee -a log.txt
Copy file and *if* that's successful, delete it where it stands.
> scp archive.tar.gz pi@192.168.0.31:/home/pi && rm archive.tar.gz
A double pipe will try one, and do the other if that fails.
> cp -r ~/Archive ~/Backup || tar czf Archive.tar.gz *
# REGEX
Regular expression characters include:
\\ ^ $ . | ? * + () [] {}
As a result, grep cannot read these characters as literal characters unless they are escaped. E.g.
> grep wtf\? log.txt
... will search the string 'wtf?' in the file log.txt. Another version is egrep (now used with 'grep -e') which uses more characters as special characters, or fgrep, which treats all characters as literal strings.
# Environmental Variables
PWD, USER, PATH
To display all environmental (but not local) variables, use
> env
Set a variable with
> colour=red
Display your variable with
> echo $colour
Export this to the entire system using:
> export colour=blue
# Search commands
> apropos cat
# Working with Text
Convert every tab to ten spaces.
> expand -t 10 file.txt
Or the reverse, with 3 spaces converting to a tab.
> unexpand -t 3 file.txt
Format a file by cutting text after 60 characters.
> fmt -w 60 file.txt
Indent all but the first line of a paragraph.
> fmt -t file.txt
Look at the new lines of a file only:
> tail -f /var/log/syslog
The sort function arranges lines alphabetically. Use -r to reverse and -n to sort by number.
# Sed
> sed -i s/hey/hoi/g greetings.txt
Edit all examples of hey to hoi in greetings and print that to the file.
# Measurement
Measure how long a script takes for super-autism powers.
> time [bash script]
# Functions
> function my_funct(){ do_thing $1; }
Remove a function with
> unset my_function
# Paths
Every shell has various paths from where it can execute binary files. Find out your current one with:
> echo $PATH
To add a directory to a path, e.g. /usr/share/bin, you can declare it in addition to the old path with:
> PATH=$PATH:/usr/share/bin
And then check it by echoing the path again.
Before this, probably best to check the path exists with:
> if [ -e /usr/share/bin ]; then
> echo yes
> fi
# Pipes, Pedantry and Brackets
Things that [[ ]] statements can do which [ ] statements cannot:
- Intuitive and easy 'and' statements.
- [[ -z $var && -d ~/LK ]]
- Intuitive and easy 'or' statements.
- [[ -d LK || -f ghost-backup.zip ]]
- Simple expression comparisons
- [[ $v1 > $v2 ]]
- Simple expression comparisons with clumsy strings
- [[ item-1 > item-2 ]]
- Vague comparisons
- [[ $answer =~ ^y(es)?$ ]]
# exec
exec will start a process running as just that process. In a bash script, the line:
> unison rat
... will startup `unison` as a sub-process of bash. But:
> exec unison rat
... starts unison as its own process.
# Brace expansion
> mv picture{,-1}.jpg
This expands to
> mv picture.jpg picture-1.jpg
# `for` Statements
for f in *tiff;do
convert "$f" "${f/.tiff/.png}"
done

93
fundamentals/basics.md Normal file
View File

@@ -0,0 +1,93 @@
# Processes
Process id 1 is systemd. All other processes are child processes.
> ps -sH
This has every process on the system, and -H shows the hierarchy. This can be piped to less to view easily.
> ps -u ghost
Looking at processes spawned from user 'ghost'.
> ps -e --forest
Like tree, but more.
> ps -sfH
The fucking lot.
All of this is from /proc, which is a direct line to the kernel. Commands like `free', `top' et c. pulls from /proc.
# Top
In `top' we can take the pid and then press `k' in order to kill that process.
# check what's going on with qutebrowser
> ps aux | grep qutebrowser
# Check open ports
sudo netstat -tulpn
#Check that udev process
systemctl status udev
# Show net interface
> ip addr show
This can also take arguments, such as the name of an interface.
# Find
> find . -name 'bob cv'
Find file 'bob cv'
> find . -size +7G
Find files of 7Gig or more.
> find -name *hidden* -type l
Find a symbolic link containing 'hidden' in the name.
> find -name *txt -delete
Delete all files from here of the *txt type.
> find -type d -empty
Find empty directories.
> find . mtime 50
Find all file modified precisely 50 days ago. There's also:
* -mtime +20
* file modified more than 20 days ago.
* -atime -13
* file *accessed* less than 13 days ago.
* -cmin 20
* file *modified* 20 minutes ago.
* -mmin +70
* files modified more than 70 minutes ago.
# Logs
> cat /var/logs/auth.log | grep fail
# Files
> file example.txt
This shows info about a file.
# Further reading
[Hund](https://hund0b1.gitlab.io/2019/02/11/a-collection-of-handy-ways-of-manipulating-text-in-bash.html) has some fantastic examples.

98
fundamentals/boot.md Normal file
View File

@@ -0,0 +1,98 @@
# Basic Startup
BIOS > MBR > GRUB > Kernel > Init > Run Level
- The BIOS identifies system hardware.
- The Master Boot Record contains partition and filesystem data.
- The Grand Unified Bootloader executes the kernel.
- The Init Executes designates run level (via SysVinit, Upstart, or Systemd).
- Run Level starts the user's session.
The Master Boot Record is a 512 byte file called boot.img which starts the first sectore of core.img into memory (GRUB Stage 1.5), which then executes /boot/grub.
# Access system
Ctrl+c at boot then add in
> rw init=bash
# Run Levels
0: Half
1: Single user mode
2: Multi-user, without NFS
3: Full multi-user mode
4: Unused
5: X11
6: Reboot
None of this is used by humans anymore - it's all systemd.
# Systemd
See what's running with ....
> systemctl list-units
Stop, start, whatever with:
systemctl enable|stop|start httpd
This starts httpd (Fedora's word for Apache2).
# Boot Records
'File System Tab' under /etc/fstab keeps track of the partitions and boot order.
The logical voluem manager (LVM) can make non-hardware partitions.
The nomenclature is:
- PV = physical volume
- LV = logical volume
- VG = volume group
# Volume Groups
> sudo vgcreate work-volume /dev/sdb2 /dev/sdb4
This creates the volume group 'work-volume', consisting in sdb2 and sdb4.
Now you ahve a volume group, you can use it as part of a new logical volume.
> sudo lvcreate -n noob-lv work-volume
Then scan for all logical volumes on the system with lvscan.
> sudo lvscan
# GRUB
Install a grub with either:
> sudo grub-install /dev/sda
or
> sudo grub2-install /dev/sda
This takes all settings from /etc/fstab.
Then when done editing settings update the script in /boot/grub/grub.cfg (in Debian) or /boot/boot/grub/menu (in other systems).
There are default examples in /etc/grub.d/ (but not on Ubuntu).
Finalize your settings with grub-mkconfig (or grub2-mkconfig), or update-grub.
# Cowardice
If you can't do that, use boot-repair:
> help.ubuntu.com/community/Boot-Repair

View File

@@ -0,0 +1,18 @@
Convert a text file from one encoding type to another with:
> iconv -f ascii -t utf8 oldfilename > newfilename
Available options are:
* ISO-8859-15
* UTF-8
* ASCII
* Lots more
Generate a full list of encoding types available with:
> iconv -l

34
fundamentals/clock.md Normal file
View File

@@ -0,0 +1,34 @@
# Basics
Show system time:
> date
Show hardware time:
> sudo hwclock -r
Change system time to match hardware time:
> sudo hwclock --hctosys
Change hardware time to match system time:
> sudo hwclock --systohc
Manually set the hardware time to a specified date:
> sudo hwclock --set --date="8/25/19 13:30:00"
# Network Time Providers
Servers which take their time from an observatory we call Stratum 1 servers. Servers which takes their time from Stratum n servers are Stratum n+1 servers.
Install ntp with:
> sudo apt-get install -y ntp
The shell command for this is `ntpq`. Monitor the service providers using:
> ntpq -p

View File

@@ -0,0 +1,84 @@
# If statements
Test statement equality as so:
```
read t1
read t2
if test $t1 != $t2; then
echo 'variables do not match'
else
echo 'variables match'
fi
exit 0
```
# Case Structure
These deal with multiple states rather than forking conditions.
Example:
```
#!/bin/bash
# Simple case demonstration
echo "What's your favourite creature?"
read CRE
case $CRE in
human | humanoids ) echo "Why is $CRE always standard?"
;;
troll | monsters ) echo "Not exactly known for their character ..."
;;
owlbears | monsters ) echo "Really you're a wizard fan"
;;
esac
# While and Until
This prints from 10 until 2.
> declare -i COUNTER
> COUNTER=10
> while [ $COUNTER -gt 2 ]; do
> echo The counter is $COUNTER
> COUNTER=COUNTER-1
> done
> exit 0
```
There's also 'until', which stops when something is true, rather than keeping going when something is true.
# For
> for i in $( ls ); do
> du -sh $i
> done
# Sequences
The sequences tool counts up from X in jumps of Y to number Z.
Count from 1 to 10.
> seq 10
Count from 4 to 11.
> seq 4 11
Count from 1 to 100 in steps of 5.
> seq 1 5 100

44
fundamentals/cron.md Normal file
View File

@@ -0,0 +1,44 @@
Anacron manages crontabs which might not have run because the machine was turned off. The first value shows the days between runs, the second shows how many minutes to wait after a boot to run.
For example:
> cat /etc/anacrontab
`7 15 cron.daily run-parts --report /etc/cron.daily`
This would run crontab every 7 days, and wait 15 minutes until after boot to run.
Various services from cron exist, e.g.
> sudo apt -y install cronie
start the cronie with
> sudo systemctl start cronie
start a cron with
> cron -e
You can run a script with:
*/10 * * * * /home/pi/script.sh
... which would run every 10 minutes.
To run something as root, do:
> sudo crontab -e
For example, you can update the database, meaning searches with 'locate' command will be faster.
> */30 * * * * /usr/bin/updatedb
# Testing with runparts
Run-parts runs all executable scripts in a directory.
> run-parts /etc/cron.hourly

21
fundamentals/defaults.md Normal file
View File

@@ -0,0 +1,21 @@
Change defaults with the `update-alternatives` command.
> sudo update-alternatives --config x-www-browser
Other defaults include:
* x-cursor-theme
* x-session-manager
* x-terminal-emulator
* x-window-manager
* x-www-browser
# Config Location
The appropriate files are located in /etc/alternatives/x-*

24
fundamentals/hardware.md Normal file
View File

@@ -0,0 +1,24 @@
# Motherboard information
> sudo dmidecode
Motherboard info, upgrading BIOS, memory capacity, LAN connections.
# Disk Format information
> df
> df -h
# CPU
> cat /proc/cpuinfo
# Displays
xrandr, probably.
List displays ...
> xrandr --query

12
fundamentals/kernel.md Normal file
View File

@@ -0,0 +1,12 @@
# Living Space
Kernel modules live in lib/modules/$(uname -r)
Load them with
> sudo modprobe ath9k
Or remove one with
> sudo modprove uvcvideo

15
fundamentals/keyboard.md Normal file
View File

@@ -0,0 +1,15 @@
# Set Layout
Set layout to British English.
> setxkbmap -layout gb
| Language | short |
|:--------|:------|
| Polish | pl |
| Serbian | rs |
Set 'alt + shift', as the command which cycles through the British English, Polish and Serbian keyboard layout.
> setxkbmap -layout gb,pl,rs -option grp:alt_shift_toggle

10
fundamentals/kill.md Normal file
View File

@@ -0,0 +1,10 @@
# Basic Signals
To see an ordered list of termination signals:
> kill -l
1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP
6) SIGABRT 7) SIGBUS 8) SIGFPE 9) SIGKILL 10) SIGUSR1
11) SIGSEGV 12) SIGUSR2 13) SIGPIPE 14) SIGALRM 15) SIGTERM

8
fundamentals/links.md Normal file
View File

@@ -0,0 +1,8 @@
Link from X to Y.
> ln -s X ../otherdir/Y
Links cause ownership headaches. Solve this with -h:
> chown -h user1 mysymlink

40
fundamentals/locale.md Normal file
View File

@@ -0,0 +1,40 @@
A list of supported locales is available at /usr/share/i18n/SUPPORTED
See a full list with:
> cat /usr/share/i18n/SUPPORTED
Take the first portion to generate full locale information for a region:
> locale-gen ru_RU.UTF-8
Then use this for the current shell session with
> LANG=ru_RU.utf8
Expand this to the entire system with:
> export LANG=ru_RU.utf8
You can make this permanent for one user by adding this line to the ~/.profile or ~/.bashrc.
Make it permanent for the entire system by editing:
> sudo vim /etc/defaults/locale
# Variables
While generally set together, the variables setable are:
| Variable | Description |
|:-------------:|:------------|
| LC_TIME | Date and time |
| LC_NUMERIC | Nonmonetary numeric formats |
| LC_PAPER | A4 vs wrong paper |
| LC_ADDRESS | Address formats, for those amazingly concise Polish addresses. |
| LC_TELEPHONE | Telephone number formats. |
| LC_MEASUREMENT | Metric or Imperial, but no Impetric available. |
| LC_IDENTIFICATION | Metadata about the locale information |
| LC_ALL | Just everything at once. |

20
fundamentals/locating.md Normal file
View File

@@ -0,0 +1,20 @@
# Quick Search for Files
`locate file*`
Locate is fast because it only accesses a database of files which it regularly updates. You can update this with:
`sudo updatedb`
# Whereis
`whereis angband`
... shows where the angband program is, along with configuration files, and binaries.
Also `which` shows where a binary file is, and `type` shows aliases.
`which cmus`
`type cmus`

57
fundamentals/logs.md Normal file
View File

@@ -0,0 +1,57 @@
# Syslog Management Protocols
Let's look at the programs filling in things on our /var/log/ directory.
* rsyslog (common)
* syslog (old)
* syslog-ng (lots of content-based filtering)
* klogd (kernel-focussed)
# `rsyslog`
The config rests in /etc/rsyslog.conf, which then references /etc/rsyslog.d/.
# Systemd
This thing makes its own logs with journald, and the journal's own logging system writes to /var/log/journal/ directory, which is then filled with nonsense.
You can obtain nonsense in systemd's own format by entering:
journalctl -e
This thing generates so much nonsense it can crash your system, but can at least be checked with:
> journalctl --disk-usage
... in case you can't remember the `du` command.
You can limit the nonsense by editing the /etc/systemd/journald.conf file, and finding `#SystemMaxFileSize=`
# Logger
You can log things at any time with the logger:
> logger Server is being a dick!
Put things into a specific log with `-p`. They can enter into, e.g., lpr (printer) log file with a priority of "critical", with:
> logger -p lpr.crit Help!
Logfiles rotate around and eventually get deleted. Rotation means they get compressed.
Edit the config in /etc/logrotate.conf.
A few apps have their own special log rotation rules, kept in /etc/logrotate.d/.
The major variables to change are `weekly`, which compresses log files weekly, and `rotate 4`, which keeps 4 weeks worth of backlogs before deletion.
# Force Log Rotation
> sudo systemctl kill --kill-who=main --signal=SIGUSR2 systemd-journald.service
or just
> sudo systemctl restart systemd-journald.service

48
fundamentals/packages.md Normal file
View File

@@ -0,0 +1,48 @@
# Looking
Your package has something to do with unzipping. Find out more:
> apropos unzip
# Maintenance
> dpkg -l
List what's installed.
# Libraries
Libraries under /lib/ typically contain an .so suffix when they're dynamic. It means 'shared object' as a number of programs will refer to it.
Others will have an /a/ suffix, meaning that they're static, and will be loaded at runtime.
We can check the dependencies of a program using the ldd command upon anything in a library. For example:
> ldd/usr/bin/md5sum
... shows us that md5sum depends upon:
- linux-vdso.so.1
- libc.so.6
- lib64/ld-linux-x86-64.so.2
To list all libraries, run:
> ldconfig -p
For example, if looking at /usr/lib/x86_64-linux-gnu/libXcomposite.so.1, we might wonder what it's for. We can then run:
> ldconfig -p | grep libXcomposite
... and find out nothing except that it redirects /usr/lib/x86...
So at least we know where it is.
> ldconfig -p | grep usb
... this will show where things which nominally relate to usbs live.
You can add to the libarary path by putting just any text file in /etc/ld.so.cache, e.g. in Arch where the path to the fakeroot environment is placed there.

16
fundamentals/pam.md Normal file
View File

@@ -0,0 +1,16 @@
The Pluggabble Authentication Module controls minimum security requirements, such as password lengths.
Configuration rests in `/etc/pam.d/common-password`, or sometimes `system-auth`.
The file might be edited to contain:
```
password required pam_cracklib.so minlen=12 lcredit=1
ucredit=1 dcredit=2 ocredit=1
```
This would enforce a minimum length of 12 characters for a password, one lowercase character, one upper case character, two digits, and one other (special) character.

74
fundamentals/processes.md Normal file
View File

@@ -0,0 +1,74 @@
# Free
See free space with:
> free
and make it human readable with:
> free -h
Or `-m` for megabytes.
# Proccesses
See running items in current terminal with
> ps
or more with
> ps -a
Or the entire system with
> ps -e
Or the entire system with more information, BSD style, with:
> ps aux
And then search for a particular program with
> ps aux | grep cmus
# Jobs
Pause a job with ^z. Put it in the background with the '&' suffix.
List jobs in the current shell with
> jobs
And then you can pull number 1 up again with
> fg 1
Or continue running a stopped job with:
> bg 1
# Nice
This changes how nice a program is, from -20 (horrid) to 19.
Install a program, but nicely, at nice value '10':
> nice -10 sudo apt -y install libreoffice
Aggressively use Steam, with a nice value of '-13'.
> nice --13 steam&
Find out that Steam's fucking everything up, so you change its nice value with 'renice':
> renice --5 -p 3781
Nerf all of roach-1's processes:
> renice 10 -u roach-1
... or the entire group
> renice -14 -g hackers

36
fundamentals/shell.md Normal file
View File

@@ -0,0 +1,36 @@
# Shells
Dash - fast but limited funcionality, great for scripts.
sh - primitive and ubiquitous.
bash - the standard
elvish - user-friendly, but new, with a full file-browser embedded into the system.
# Login
All shells launch either as login or non-login. All remote sessions without a GUI withl require authentication, and therefore will be login.
## Login
These shells start by reading /etc/profile then the first of ~/.bash_profile, ~/.bash_login or ~/.profile, and load all given values.
## Non-Login
Non-login shells will read /etc/bash.bashrc and then the ~/.bashrc file. You can summon the different shell perameters with the command `.`.
For example, so summon the file ~/.bashrc, you can perform:
`. ~/.bashrc`
How the logout is handled depends upon ~/.bash_logout
# Defaults
The default shell config files to create for a new user are under /etc/skel.
# Shellcheck
Run `shellcheck script.sh` on your scripts to check them for mistakes.

45
fundamentals/swap.md Normal file
View File

@@ -0,0 +1,45 @@
# Making a Swap File
> sudo mkdir -v /var/cache/swap
> cd /var/cache/swap
> sudo dd if=/dev/zero of=swapfile bs=1K count=4M
This creates a swapfile of (1k x 4M) 4 Gigs.
Change 4M to XM for an XGig swap.
> sudo chmod 600 swapfile
> sudo mkswap swapfile
> sudo swapon swapfile
Test it's working with top
> top -bn1 | grep -i swap
or:
> echo "/var/cache/swap/swapfile none swap sw 0 0" | sudo tee -a /etc/fstab
Test it'll work at boot with:
> sudo swapoff swapfile
> sudo swapon -va
# Partition Swaps
Put this in /etc/fstab:
`UUID=blah-blah none swap sw 0 0`
Then test it works with:
> sudo swapon -va
Test other partitions in fstab with:
> sudo mount -a

62
fundamentals/time.md Normal file
View File

@@ -0,0 +1,62 @@
# systemd
Set time to synchronize with an ntp server:
> timedatectl set-ntp true
This info stays in /usr/share/zoneinfo
# Local Time
Local time is kept in /etc/localtime.
According to Dave's LPIC guide, you can set the local time by making asymboling link from your timezone to /etc/localtime, as so:
> sudo ln -sf /usr/share/zoneinfo/Europe/Belgrade /etc/localtime
...however this produced the wrong time for me. Further, /etc/localtime produces an output with cat, while the zoneinfo files do not.
# Locale
See local time, language and character settings with:
> locale
List available locales with:
> locale -a
To see additional locales which are available (but not necessarily installed):
> cat /usr/share/i18n/SUPPORTED
Set a supported locale with:
> locale-gen pl_PL.UTF-8
Then set that language, with:
> LANG=pl_PL.UTF-8
... then reboot.
# Network Time Protocol
Enter the shell with:
> ntpq
Or just glimpse and overview with:
> ntpq -q
This clock can drift, which is then listed under /var/log/ntp.drift
The config is under /etc/ntp.conf. If a line for the stats directory is listed, it'll log stats, e.g.:
`statsdir /var/log/ntpstats/`
This can show if clock drift occurs.
The config file also lets you specify servers to obtain time from.

56
fundamentals/users.md Normal file
View File

@@ -0,0 +1,56 @@
See list of logged on users.
> w
See last logons:
> last
or all logon attempts, including bad attempts:
> lastb
List recently accessed files:
> last -d
See files opened by steve
> lsof -t -u steve
See files opened by anyone but steve
> lsof -u ^steve
Fuser can also track people loggingin:
> fuser /var/log/syslog
... and fuser can kill everything accessing the home directory:
> fuser -km /home
# Looking for dodgy files
Some files can be executed by people as if they had super user permissions, and that's okay... sometimes.
Let's start with files executable by user:
> sudo find / -type f -perm -g=s -ls
And then those executable by the group:
> find / -type f -perm -g=s -ls
And finally, worrying files, executable by anyone as if sie were the owner:
> find / -xdev \( -o -nogroup \) -print
Then have a look at resource usage per user.
#SGID
> sudo chmod u+s process.sh
This will modify process.sh to that instead of being simply executable, anyone executing it will have the permissions as if owner while executing it.

60
fundamentals/wifi.md Normal file
View File

@@ -0,0 +1,60 @@
# Netstat Stuff
iftop -p -n
Stats on local net usage within domain.
whois domain.com
dig domain.com
info on domain, whether it's taken, et c.
> ifconfig
Like ipconfig.
> nmcli
Versatile wifi tool.
# Examples
You want to connect to the internet.
>sudo iwconfig
Get knowledge of wireless state. The output might be:
`wlp3s0 IEEE 802.11 ESSID:"Gandalf WajFaj"`
`Mode:Managed Frequency:2.412 GHz Access Point: 10:05:01:90:AC:1A`
`Bit Rate=144.4 Mb/s Tx-Power=15 dBm`
`Retry short limit:7 RTS thr:off Fragment thr:off`
`Encryption key:off`
`Power Management:on`
`Link Quality=64/70 Signal level=-46 dBm`
`Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag`
`Tx excessive retries:0 Invalid misc:363 Missed beacon`
This tells you that your ESSID is 'Gandalf WajFaj', and the access point name is 10:05:......
> nmcli radio
You get an overview of your radio devices. You're told that eth0 deals with your ethernet and wlan0 deals with wifi. wlan0 is a file which represents your wifi device.
> nmcli wlan0 wifi rescan
> nmcli device wifi list
Now to connect.
> nmcli device wifi connect [SSID] [your password] [wifi password]
Alternatively, you can use
> nmcli -ask device wifi connect [SSID]
And it'll ask for your password, so you're not typing it in in full view.