For some reason when using chsh -s /bin/bash I had to restart my computer to take it affect. What nicely worked was sudo usermod -s /usr/bin/zsh
sed
This command substitutes all colons in the PATH to newlines making the echo outpur easier to read
echo $PATH |seds/\:/\\n/g
Replace all http to https in a file
sed-i's/http/https/g'/etc/apt/sources.list
-i for in-place change
Append to a line
sed -i '\|^#AuthorizedKeysFile| s|$| /etc/ssh/authorized_keys/\%u|' sshd_config-i means do it in the file on the fly (Do it live)
| means use | as a delimiter for sed, as we have / in the string we want to append
^#Auth# look for for the Line that starts with #AuthorizedKeysFile followed by a delimiter
s for replace (substitue)
$ for matching the end of the line
/etc/ssh the string we want to append
/%u an escaped %, as %u is a variable for user interpreted by ssh
sshd_config the file we want to change
Updating Value in a Yaml File
This updates the Value of key with whatever is stored in the Variable $B64
grep
find something recusively in the files of a folder grep <path> -rne <pattern> -n shows line number -e defines the pattern to look for -r sets recursively See here
find
Find files in a folder with excluding a path
Find all files ending in .md and find the lines that contain django in those files.
for loop
Find all Files in current directory where the filesize is bigger the 50Kb and copy them into another directory
Create 10 folders with the number and _stringname as the folder name and do something with all results from find.
rename
Remove string from the beginning of all files in the current directory using rename
use rename for my kindle exports
du
Getting disk usage with excluding one or more pathes
certbot
I use this to install certbot from letsencrypt on Debian 9.3(stretch) with nginx
Making it update every 2nd month and log into /var/log/certbot/certbot.log
turning off screen
Turning off the screen on Linux Mint 18.2 Sonya 4.13.0-41-generic #46~16.04.1-Ubuntu
CommandLine Tools
Installing colorls
sort Files in reversed order by size, i.e. biggest files on bottome hence easy to see
Install bat
Bat is more eye-friendly cat alternative, on Github. Replace the release number down there with the latest from the Release Page Release.
Install buildtools, buildessentials, ruby and then a too complicated bash expression that should work independent of ruby version (famous last words).
Auto Sugges
Tmux
Creating a new session tmux new -s session-name Leaving/detaching from a session press<prefix> : and type detach Listing existing sessions tmux ls Entering/attaching to an existing session tmux attach -s session-name/session-number
Veracrypt
This downloads Veracrypt from Vercrypt.fr Version 1.23 the latest as of October 2019, unpacks it and installs it. Careful there is some user input neccessary.