Grimoire

What is it? Well the word Grimoire is a synonym for spell book which is the title of a file I have kept on my computer for a while with the official reason being in the event I need to give someone instructions I can give them this file and they will have all they need to do what I want them to do. However it has evolved as a place for me to put commands that I am too lazy to remember or to retype each time so I just use this and can control+c control+v into the terminal. Since to someone who doesn't have any programming knowledge would think of some of these commands as "magic" I have called it spell book. I then have changed it here as Grimoire as I think of a wizard who is wise enough to know that it is not how much you can remember but how quickly you can call upon what you have once lernt. I have had thought that it is silly of me to keep this file on my computer so I am going to store it here and come back to it every so often to update it as I need.

Table of Contents


Flags and other useful Bash things

  • -y: This will "pipe" the awnser yes to a command. Example: sudo apt upgrade -y, automatically upgrades all patches.
  • -i: This makes it interactive. Example: rm -r -i File, will ask you before deleating each file.
  • -f: This will force a confermation, similar to -y.
  • -r: does something recursively. Example, grep -r /folder/
  • -v: Stands Verbose, will make it so you can see debug information as it happens. Example scp -v file user@location:file, will give you a progress bar
  • echo: this prints whatever you give it. Example: echo "Hello World", prints hello world
  • clear: self explanitory, clears you're screen.
  • grep: looks though a file and spits out lines that contain the argument. Example: grep "Apple" Phone.txt, outputs "I currently own an iphone made by Apple."
  • touch: Creates a new empty file. Example: touch File221.txt, makes a file called File221 in the current directory
  • nano: edits the file that you give it, aslo will creat it if it doesn't already exist. Example nano Grimoire.html, creates a html doc called Grimoire.
  • cd: Change Directory. Example: cd /Music/Liszt, puts me into the folder of /Musci/Liszt.
  • mkdir: Creates an empty Directory. Example mkdir newFolder, makes a new folder in the cureent directory.
  • rm: Removes the file. Example: rm -i File, removes the file and askes me beforehand.
  • mv: stands for Move will move it to a new location and change it's name. Example, mv folder1/file.txt folder2/File.txt, moves the file and changes it's name to File.

Back to the Top?

Maintenance

Debian update

sudo apt update

automatically upgrade

sudo apt update && sudo apt full-upgrade -y

automatically upgrade and remove old files

sudo apt update && sudo apt full-upgrade -y && sudo apt autoremove -y

SSH Login

ssh user@location

Back to the Top?

Git

Clone an already existing Reposiroty

git clone https://user/example

First step in makeing a PR/MR

git checkout -b branch

Stage files for a commit/PR/MR

git add .

Create a Commit message

git commit -m branch "message"

Make push the commit

git push -u origin branch

Back to the Top?

File Moving

Moving a file over SSH to a linux machine from a windows machine

scp -v C:\path\to\file.txt user@location:/end/folder/for/file/

to do it recursively for an entire folder

scp -r -v C:\path\to\folder user@location::/end/folder/for/file/

add this to also remove the file(s)

&&& rmdir /s /q C:\path\to\folder

Moving Larger Files with rsync (I think requires WSL)

rsync -avz C:\path\to\file.txt

NOTE: -avz is not needed but makes it faster and also gives you a pretty progress line to stare at.

Use Wget to get files from any site on the internet

wget http://Site/folder/item.txt

Back to the Top?

Misc

Change Folder Access on a Linux Machine

sudo chown -R user:user /Folder

create a list of IPs on a Network on a Windows Machine

FOR /L %i IN (1,1,254) DO @ping -n 1 -w 100 10.0.0.%i | find "Reply"

Back to the Top?