This page will demonstrate the configuration of a Linux operating system.
Tip: By using
man
you can look up the documentation for a certain tool or command.
Updating all installed packages:
sudo apt update
Upgrade packages:
sudo apt full-upgrade -y
Upgrade your system:
sudo apt dist-upgrade -y
Remove automatically installed packages:
sudo apt autoremove -y
Cleanup repositories after updating, deletes unnecessary files:
sudo apt auto-clean -y
Change keyboard layout, for example to german:
sudo setxkbmap -layout de
Re-Evaluate group permissions:
exec su -l $USER
Tip: If a command won’t work, log in as the root user and try again. Since you need elevated privileges to update the system anyway, I would log in as the root user.
Here is a handy shell script that will fully update, upgrade and remove unused dependencies from your system
apt-upd() {
apt update && \
apt full-upgrade -y && \
apt dist-upgrade -y && \
apt autoremove -y && \
apt-get clean && \
apt-get autoclean
if [ -f ~/services/upd-container.sh ]; then
bash ~/services/upd-container.sh
fi
# Check the exit status of the whole process
if [ $? -eq 0 ]; then
printf '%.0s\n' {1..3}
echo -e "\e[92mSystem is updated successfully.\e[0m"
else
echo -e "\e[91mFailed to update the system.\e[0m"
fi
}
apt-upd() {
apt update && \
apt full-upgrade -y && \
apt dist-upgrade -y && \
apt autoremove -y && \
apt-get clean && \
apt-get autoclean &&
fwupdmgr get-devices &&
fwupdmgr get-updates &&
fwupdmgr update &&
if [ -f ~/services/upd-container.sh ]; then
bash ~/services/upd-container.sh
fi
# Check the exit status of the whole process
if [ $? -eq 0 ]; then
printf '%.0s\n' {1..3}
echo -e "\e[92mSystem is updated successfully.\e[0m"
else
echo -e "\e[91mFailed to update the system.\e[0m"
fi
}
To use that script, create a .zsh_aliases
file in your root user directory and paste the code above, into it. After that, you’ll need to add the following code to your .zshrc
file. So that the function can be used in your zsh terminal.
if [ -f ~/.zsh_aliases ]; then
. ~/.zsh_aliases
fi
If you want, you can copy the function directly into the .zshrc
file.
For the changes to be loaded, you’ll need to enter source ~/.zshrc
in your terminal. Now, you can type apt-upd
as root inside of a terminal and your system will be updated.
If Zsh isn’t already pre-installed, install it by using the apt manager
sudo apt install zsh -y
After that, you can install Oh-My-Zsh from GitHub
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
First, change the default theme to Powerlevel10k.
Clone the repository into the directory .oh-my-zsh/custom/themes
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
Edit your ~/.zshrc
file and replace the theme with
ZSH_THEME="powerlevel10k/powerlevel10k"
Or by executing
sed -i '0,/^ZSH_THEME=.*$/s//ZSH_THEME="powerlevel10k\/powerlevel10k"/' ~/.zshrc
All plugins listed on GitHub are pre-installed with Oh-My-Zsh at ~/.oh-my-zsh/plugins
. Custom plugins can be installed at ~/.oh-my-zsh/custom/plugins
. To use a plugin, you can simply add it to the plugins list in your ~/.zshrc
file.
Warning: Add plugins wisely, as too many plugins could slow down the shell startup.
Add a whitespace in between each plugin in the .zshrc
file.
Already installed in ~/.oh-my-zsh/plugins
:
Plugins that are needed to be cloned:
git clone --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting \
${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions \
${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
Download and unzip a patched font with glyphs (icons) from Nerd Font.
Move the .ttf files to ~/.local/share/fonts
, maybe you’ll need to create a fonts directory first via mkdir -p ~/.local/share/fonts
.
Set up the installed font in your terminal as the default font.
To search for an alias, you can use
f() {
alias | grep "$*";
}
To setup SSH public key authentication, you will need to execute the following commands.
First, you have to create a private
and public
key pair.
ssh-keygen -t ed25519 -f ~/.ssh/<certificate-name> -C "your e-mail address or pc name"
Tip: You can use
man ssh-keygen
to get a detailed description about all possible parameters and options.
The output will look like this:
$ ssh-keygen -t ed25519 -f ~/.ssh/test
Generating public/private ed25519 key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/<name>/.ssh/test
Your public key has been saved in /home/<name>/.ssh/test.pub
The key fingerprint is:
SHA256:Jr7aTrZyDNxDEW8vQHl4YEJ/a8n0kiUzTXjB9J6y814 edgar@BEAST-PC
The key's randomart image is:
+--[ED25519 256]--+
| .o == ++. |
| =+.+oo. |
| o+O.o . |
| .* @ . . |
| . o. S + o |
| o.o+ o o |
| o+. o E |
| .+oo o . |
| .== .o |
+----[SHA256]-----+
After that, you can save the public key
to GitHub, on your Linux server or somewhere else.
If the setup is done for the first time, you will have to create a config
file. The config file is needed, so that the host can establish a connection with the server. If you want to have an ssh key for each service or application, you can do this by adding them to the config file.
The convention of the config
file will look like this, for each entry:
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/test
The Host
keyword restricts the following declarations to be only for those hosts that match with the passed host name on the command line. It can be used to declare aliases, thus that will not work on Git repository hosting services like GitHub, GitLab, Bitbucket etc.
HostName
specifies the real host name to log into. Numeric IP addresses are also permitted, e.g. 120.245.228.101
.
With the User
keyword, it is possible to set a username which will be used to log into a server. It can simplify the use of multiple usernames like root, non-root-users, etc. With that, you don’t need to pass the username on the command line.
Last but not least, the IdentityFile
keyword. That keyword specifies a file, from which the user’s private key is read when using public key authentication.
After you’ve set up you SSH key, you can test your connection e.g. GitHub with the following command:
ssh -T git@github.com
It will try to establish a connection with the server by using your SSH key you created earlier. If you set a passphrase for you private key you’ll need to enter it first.
You may see a warning like this:
The authenticity of host 'github.com (IP ADDRESS)' can't be established.
ECDSA key fingerprint is SHA256:p2QAMXNIC1TJYWeIOttrVc98/R1BUFWu3/LiyKgUfQM.
Are you sure you want to continue connecting (yes/no/[fingerprint])?
You can verify if the fingerprint in the message matches with GitHub’s public key fingerprint. If it does, then type yes
:
Hi username! You've successfully authenticated, but GitHub does not provide shell access.
Note: The remote command should exit with code 1.
Verify that the resulting message contains your username. If you receive a “permission denied” message, refer to Error: Permission denied (publickey).