# CentOS 8 minimal installation on RPi 3+ ๐Ÿ‡ฌ๐Ÿ‡ง # Installation [CentOS](https://wiki.centos.org/SpecialInterestGroup/AltArch/armhfp?action=show&redirect=SpecialInterestGroup%2FAltArch%2FArm32#head-f2a772703b3caa90cc284e01bc87423ce9a87bcd) tuto for installation on RaspberryPi [ยน](https://raspberrytips.com/install-centos-raspberry-pi/) [ยฒ](https://rharmonson.github.io/cos7instpi.html). *Just for memory: Fedora [link](https://fedoraproject.org/wiki/Architectures/ARM) for arm architecture.* ## SSH To know ip on local network: ```sh arp -a ``` ### Hosts On the client machine add the [server ip address](https://library.netapp.com/ecmdocs/ECMP1114171/html/GUID-DBF81E5C-CF3C-4B07-AF01-83A625F2B4BF.html) in `/etc/hosts`. ### Add to known hosts ```sh ssh-keyscan mycentos8 >> ~/.ssh/known_hosts ``` After, edit the file to keep the _ecdsa_ line. ## Repo ### Install EPEL Repo ```sh dnf info epel-release dnf install epel-release ``` ## Adduser ### Adduser ```sh adduser passwd ``` Adding user to [group wheel](https://devconnected.com/how-to-add-a-user-to-sudoers-on-centos-8/): ```sh gpasswd -a wheel ``` Manage [users and groups](https://www.howtogeek.com/50787/add-a-user-to-a-group-or-second-group-on-linux/). ### Change shell for zsh ```sh usermod --shell /bin/zsh ``` #### Oh-my-zsh Install [Oh-my-zsh](https://ohmyz.sh): ```sh sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" ``` Copy [theme](https://github.com/ohmyzsh/ohmyzsh/wiki/Themes) '_amuse_' to the same folder for '_01amuse_' ```sh vim ~/.zshrc ``` ```sh ZSH_THEME='01amuse' ``` Add information to the ligne `PROMPT=` without delete previous options (more tips [here](https://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/)): ```sh vim ~/.oh-my-zsh/themes/01amuse.zsh-theme ``` ```sh PROMPT='[...keep prev...]%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%}' ``` Use [plugins](https://github.com/ohmyzsh/ohmyzsh/wiki/Plugins): ```sh plugins=(git dnf history tmux) ``` - [_dnf_](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/dnf)
AliasCommandDescription
dnfldnf listList packages
dnflidnf list installedList installed packages
dnfgldnf grouplistList package groups
dnfmcdnf makecacheGenerate metadata cache
dnfpdnf infoShow package information
dnfsdnf searchSearch package
dnfusudo dnf upgradeUpgrade package
dnfisudo dnf installInstall package
dnfgisudo dnf groupinstallInstall package group
dnfrsudo dnf removeRemove package
dnfgrsudo dnf groupremoveRemove package group
dnfcsudo dnf clean allClean cache
- [_git_](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git) - [_history_](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/history)
AliasCommandDescription
hhistoryPrints your command history
hshistory | grepUse grep to search your command history
hsihistory | grep -iUse grep to do a case-insensitive search of your command history
- [_vscode_](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/vscode) - [_npm_](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/npm) - [_tmux_](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/tmux)
AliasCommandDescription
tatmux attach -tAttach new tmux session to already running named session
tadtmux attach -d -tDetach named tmux session
tstmux new-session -sCreate a new named tmux session
tltmux list-sessionsDisplays a list of running tmux sessions
tksvtmux kill-serverTerminate all running tmux sessions
tksstmux kill-session -tTerminate named running tmux session
tmux_zsh_tmux_plugin_runStart a new tmux session
- [_nmap_](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/nmap)
AliasDescription
nmap_open_portsscan for open ports on target
nmap_list_interfaceslist all network interfaces on host where the command runs
nmap_slowslow scan that avoids to spam the targets logs
nmap_finscan to see if hosts are up with TCP FIN scan
nmap_fullaggressive full scan that scans all ports, tries to determine OS and service versions
nmap_check_for_firewallTCP ACK scan to check for firewall existence
nmap_ping_through_firewallhost discovery with SYN and ACK probes instead of just pings to avoid firewall restrictions
nmap_fastfast scan of the top 300 popular ports
nmap_detect_versionsdetects versions of services and OS, runs on all ports
nmap_check_for_vulnsuses vulscan script to check target services for vulnerabilities
nmap_full_udpsame as full but via UDP
nmap_traceroutetry to traceroute using the most common ports
nmap_full_with_scriptssame as nmap_full but also runs all the scripts
nmap_web_safe_osscanlittle "safer" scan for OS version as connecting to only HTTP and HTTPS ports doesn't look so attacking
nmap_ping_scanICMP scan for active hosts
_**Note :** elements in zsh arrays are separated by **spaces**. Do not use commas._ ### Execute sudo without Password Link [here](https://askubuntu.com/questions/147241/execute-sudo-without-password). You can configure sudo to never ask for your password. Open a Terminal window and type: ```sh sudo visudo ``` In the bottom of the file, add the following line: ```sh $USER ALL=(ALL) NOPASSWD: ALL ``` Where $USER is your username on your system. Or, in my case, uncomment : ```sh ## Allows people in group wheel to run all commands %wheel ALL=(ALL) ALL ``` ### SSH keys First create a ssh rsa key on computer: ```sh ssh-keygen -t rsa ``` Then : ```sh ssh myuser@server.com mkdir .sshscp ~/.ssh/id_rsa.pub myuser@server.com:.ssh/authorized_keys ``` ## GitHub ### Use SSH keys First, check if existing SSH keys are present: ```sh ls -al ~/.ssh ``` Generate key pair: ```sh ssh-keygen -t rsa -b 4096 -C "your_email@example.com" ``` Start the SSH agent in background: ```sh eval "$(ssh-agent -s)" ``` Add the SSH private key to the ssh-agent: ```sh ssh-add ~/.ssh/id_rsa ``` Copy the **public** key to the clipboard and paste it in [Github](https://github.com/settings/keys). To test the connection: ```sh ssh -T git@github.com ``` ## Personnalize motd Edit motd file: ```sh vim /etc/motd ``` For ASCII check [this site](http://patorjk.com/software/taag). Or, much better, create `motd.sh` in `/etc/profile.d/` with: ```sh #!/bin/sh # printf "\n" printf " โ”Œโ”ฌโ”โ”ฌ โ”ฌโ•”โ•โ•—โ”Œโ”€โ”โ”Œโ”โ”Œโ”Œโ”ฌโ”โ•”โ•โ•—โ•”โ•โ•—\n" printf " โ”‚โ”‚โ”‚โ””โ”ฌโ”˜โ•‘ โ”œโ”ค โ”‚โ”‚โ”‚ โ”‚ โ•‘ โ•‘โ•šโ•โ•—\n" printf " โ”ด โ”ด โ”ด โ•šโ•โ•โ””โ”€โ”˜โ”˜โ””โ”˜ โ”ด โ•šโ•โ•โ•šโ•โ•\n" printf " โ•”โ•ฆโ•—โ”ฌโ”Œโ”€โ”โ”ฌโ”Œโ”€โ”Œโ”€โ”โ”Œโ”€โ”โ”ฌ\n" printf " โ•‘โ•‘โ•‘โ”‚โ”‚ โ”œโ”ดโ”โ”œโ”€โ”คโ”œโ”ค โ”‚\n" printf " โ•ฉ โ•ฉโ”ดโ””โ”€โ”˜โ”ด โ”ดโ”ด โ”ดโ””โ”€โ”˜โ”ดโ”€โ”˜\n" printf "\n" printf "\t- %s\n\t- Kernel %s\n" "$(cat /etc/redhat-release)" "$(uname -r)" printf "\n" date=`date` load=`cat /proc/loadavg | awk '{print $1}'` root_usage=`df -h / | awk '/\// {print $(NF-1)}'` memory_usage=`free -m | awk '/Mem:/ { total=$2 } /buffers\/cache/ { used=$3 } END { printf("%3.1f%%", used/total*100)}'` swap_usage=`free -m | awk '/Swap/ { printf("%3.1f%%", "exit !$2;$3/$2*100") }'` users=`users | wc -w` time=`uptime | grep -ohe 'up .*' | sed 's/,/\ hours/g' | awk '{ printf $2" "$3 }'` processes=`ps aux | wc -l` ethup=$(ip -4 ad | grep 'state UP' | awk -F ":" '!/^[0-9]*: ?lo/ {print $2}') ip=$(ip ad show dev $ethup |grep -v inet6 | grep inet|awk '{print $2}') echo "System information as of: $date" echo printf "System load:\t%s\tIP Address:\t%s\n" $load $ip printf "Memory usage:\t%s\tSystem uptime:\t%s\n" $memory_usage "$time" printf "Usage on /:\t%s\tSwap usage:\t%s\n" $root_usage $swap_usage printf "Local Users:\t%s\tProcesses:\t%s\n" $users $processes echo [ -f /etc/motd.tail ] && cat /etc/motd.tail || true ``` _(Idea from [here](https://blog.tian.it/dynamic-motd-on-centos7/).)_ ## Vim ### Config File `.vimrc`: ```sh # choose theme color colo desert # enable syntax highlighting syntax on # set mouse set mouse=a # you can show line numbers set number # show the editing mode on the last line set showmode # tell vim to keep a backup file set backup # tell vim where to put its backup files but the file must be created set backupdir=~/.vim_backup/ # tell vim where to put swap files # set dir=/private/tmp # i don't use autoindent, but here's how to configure it: # set autoindent # highlight matching search strings # set hlsearch # make searches case insensitive # set ignorecase ``` ### Plugins ### Vim-powerline ```sh sudo dnf install vim-powerline ```` ## Tmux ### Installation > [Tmux](http://man.openbsd.org/OpenBSD-current/man1/tmux.1) is a Terminal Multiplexer. It enables a number of terminals to be created, accessed and controlled from a single screen. Install with `dnfi tmux -y` to get version 1.8, but there isn't plugins available... so, see next! ### Build Tmux [Source here](https://jdhao.github.io/2018/10/16/tmux_build_without_root_priviledge/). First, install C compiler: ```sh sudo dnf install -y gcc ``` #### Build Libevent Libevent source [releases](https://github.com/libevent/libevent/releases). ```sh wget https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz tar zxvf libevent-*.tar.gz cd libevent-2.1.8-stable mkdir -p $HOME/.local ./configure --prefix="$HOME/.local" make -j && make install ``` #### Build Ncurses Ncurses source [releases](http://ftp.gnu.org/pub/gnu/ncurses/). ```sh wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.1.tar.gz tar zxvf ncurses-6.1.tar.gz cd ncurses-6.1 ./configure --prefix="$HOME/.local" make -j && make install ``` #### Build Tmux Tmux source [releases](https://github.com/tmux/tmux/releases). ```sh wget https://github.com/tmux/tmux/releases/download/2.8/tmux-2.8.tar.gz tar zxvf tmux-2.8.tar.gz cd tmux-2.8 ./configure --prefix=$HOME/.local \ > CPPFLAGS="-I$HOME/.local/include -I$HOME/.local/include/ncurses" \ > LDFLAGS="-L$HOME/.local/lib" make -j && make install export PATH=$HOME/.local/bin:$PATH export LD_LIBRARY_PATH=/home/mickael/.local/lib ``` To make folders persistent: ```sh echo 'export PATH=$HOME/.local/bin:$PATH' >> ~/.zshrc echo 'export LD_LIBRARY_PATH=$HOME/.local/lib' >> ~/.zshrc ``` Chech with : ```sh $PATH env | grep '^LD_LIBRARY_PATH' ``` ### Configuration #### First param Edit an other configuration file: ```sh vim ~/.tmux.conf ``` *[Here](https://github.com/tangledhelix/dotfiles/blob/master/tmux.conf) an example of config's file.* And write: ```sh # C-b is not acceptable -- Vim uses it set-option -g prefix C-a bind C-a last-window # windows starts at 1 set -g base-index 1 set -g pane-base-index 1 # display messages for a second set -g display-time 2500 # List of plugins #set -g @plugin 'tmux-plugins/tpm' #set -g @plugin 'tmux-plugins/tmux-sensible' # Mouse support - set to on if you want to use the mouse set -g mode-mouse on # Toggle mouse mode to allow mouse copy/paste # set mouse on with prefix m bind m \ set -g mouse on \; \ display-message "Mouse: ON" # set mouse off with prefix M bind M \ set -g mouse off \; \ display-message "Mouse: OFF" # bind reload bind r source-file ~/.tmux.conf # Use Vi mode set -g mode-keys vi # Other examples: # set -g @plugin 'github_username/plugin_name' # set -g @plugin 'git@github.com/user/plugin' # set -g @plugin 'git@bitbucket.com/user/plugin' # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) #run -b '~/.tmux/plugins/tpm/tpm' ``` It gives access to vim keys: |Function |vi| |Function |vi| |:--|:--:|---|:--|:--:| |Back to indentation |^| |Half page up |C-u| |Clear selection |Escape| |Next page |C-f| |Copy selection |Enter| |Next word |w| |Cursor down |j| |Paste buffer |p| |Cursor left |h| |Previous page |C-b| |Cursor right |l| |Previous word |b| |Cursor to bottom line |L| |Quit mode |q| |Cursor to middle line |M| |Scroll down |C-Down or J| |Cursor to top line |H| |Scroll up |C-Up or K| |Cursor up |k| |Search again |n| |Delete entire line |d| |Search backward |?| |Delete to end of line |D| |Search forward |/| |End of line |$| |Start of line |0| |Goto line |:| |Start selection |Space| |Half page down |C-d| | #### Second param Edit the tmux.plugin.zsh. ```sh vim ~/.oh-my-zsh/plugins/tmux/tmux.plugin.zsh ``` Set autostart: ```sh # Automatically start tmux : ${ZSH_TMUX_AUTOSTART:=true} ``` Full: ```sh if ! (( $+commands[tmux] )); then print "zsh tmux plugin: tmux not found. Please install tmux before using this plugin." >&2 return 1 fi # ALIASES alias ta='tmux attach -t' alias tad='tmux attach -d -t' alias ts='tmux new-session -s' alias tl='tmux list-sessions' alias tksv='tmux kill-server' alias tkss='tmux kill-session -t' # CONFIGURATION VARIABLES # Automatically start tmux : ${ZSH_TMUX_AUTOSTART:=true} # Only autostart once. If set to false, tmux will attempt to # autostart every time your zsh configs are reloaded. : ${ZSH_TMUX_AUTOSTART_ONCE:=true} # Automatically connect to a previous session if it exists : ${ZSH_TMUX_AUTOCONNECT:=true} # Automatically close the terminal when tmux exits #: ${ZSH_TMUX_AUTOQUIT:=$ZSH_TMUX_AUTOSTART} : ${ZSH_TMUX_AUTOQUIT:=false} # Set term to screen or screen-256color based on current terminal support : ${ZSH_TMUX_FIXTERM:=true} # Set '-CC' option for iTerm2 tmux integration : ${ZSH_TMUX_ITERM2:=false} # The TERM to use for non-256 color terminals. # Tmux states this should be screen, but you may need to change it on # systems without the proper terminfo : ${ZSH_TMUX_FIXTERM_WITHOUT_256COLOR:=screen} # The TERM to use for 256 color terminals. # Tmux states this should be screen-256color, but you may need to change it on # systems without the proper terminfo : ${ZSH_TMUX_FIXTERM_WITH_256COLOR:=screen-256color} # Set the configuration path : ${ZSH_TMUX_CONFIG:=$HOME/.tmux.conf} # Set -u option to support unicode : ${ZSH_TMUX_UNICODE:=false} # Determine if the terminal supports 256 colors if [[ $terminfo[colors] == 256 ]]; then export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITH_256COLOR else export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITHOUT_256COLOR fi # Set the correct local config file to use. if [[ "$ZSH_TMUX_ITERM2" == "false" && -e "$ZSH_TMUX_CONFIG" ]]; then export ZSH_TMUX_CONFIG export _ZSH_TMUX_FIXED_CONFIG="${0:h:a}/tmux.extra.conf" else export _ZSH_TMUX_FIXED_CONFIG="${0:h:a}/tmux.only.conf" fi # Wrapper function for tmux. function _zsh_tmux_plugin_run() { if [[ -n "$@" ]]; then command tmux "$@" return $? fi local -a tmux_cmd tmux_cmd=(command tmux) [[ "$ZSH_TMUX_ITERM2" == "true" ]] && tmux_cmd+=(-CC) [[ "$ZSH_TMUX_UNICODE" == "true" ]] && tmux_cmd+=(-u) # Try to connect to an existing session. [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach # If failed, just run tmux, fixing the TERM variable if requested. if [[ $? -ne 0 ]]; then if [[ "$ZSH_TMUX_FIXTERM" == "true" ]]; then tmux_cmd+=(-f "$_ZSH_TMUX_FIXED_CONFIG") elif [[ -e "$ZSH_TMUX_CONFIG" ]]; then tmux_cmd+=(-f "$ZSH_TMUX_CONFIG") fi $tmux_cmd new-session fi if [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]]; then exit fi } # Use the completions for tmux for our function compdef _tmux _zsh_tmux_plugin_run # Alias tmux to our wrapper function. alias tmux=_zsh_tmux_plugin_run # Autostart if not already in tmux and enabled. if [[ -z "$TMUX" && "$ZSH_TMUX_AUTOSTART" == "true" && -z "$INSIDE_EMACS" && -z "$EMACS" && -z "$VIM" ]]; then # Actually don't autostart if we already did and multiple autostarts are disabled. if [[ "$ZSH_TMUX_AUTOSTART_ONCE" == "false" || "$ZSH_TMUX_AUTOSTARTED" != "true" ]]; then export ZSH_TMUX_AUTOSTARTED=true _zsh_tmux_plugin_run fi fi ``` ### Plugins - [Tpm](https://github.com/tmux-plugins/tpm) is a plugin manager: - `prefix` + `I` to install new plugin. - `prefix` + `U` to update plugins. - `prefix` + `alt` `u` to remove/uninstall plugins not on the plugin list. - [Tmux-resurrect](https://github.com/tmux-plugins/tmux-resurrect) to save & restore session after reboot: - `prefix` + `Ctrl` `s` to save. - `prefix` + `Ctrl` `r` to restore. - [Tmux-yank](https://github.com/tmux-plugins/tmux-yank) to copy to system clipboard (need configuration steps). - [Tmux-copycat](https://github.com/tmux-plugins/tmux-copycat) enable regex search with `prefix` + `/`: - `prefix` + `ctrl` `f` : simple file search. - `prefix` + `ctrl` `g` : jumping over git status files (best used after git status command). - `prefix` + `alt` `h` : jumping over SHA-1/SHA-256 hashes (best used after git log command). - `prefix` + `ctrl` `u` : url search (http, ftp and git urls). - `prefix` + `ctrl` `d` : number search (mnemonic d, as digit). - `prefix` + `alt` `i` : ip address search. - [Themes pack](https://github.com/jimeh/tmux-themepack). - To unable theme packs like powerline, you need to install powerline fonts on ssh machine as well ([here](https://github.com/powerline/fonts)) and change font for a powerline font in the terminal preferencies. ## Various app - Links : Web browser running in both graphics and text mode `sudo dnf install -y links`. - Tree : Tree structure for folders `sudo dnf install -y tree` ([tips](https://www.cyberciti.biz/faq/linux-show-directory-structure-command-line/)). ## Security ### SSH Key authentication From [Nicolas Kovacs](https://gitlab.com/kikinovak/howtos/-/blob/master/Linux-HOWTOs/SSH-Key-Authentication-HOWTO.txt) from [microlinux.fr](https://www.microlinux.fr). From host machin (it takes a while): ```sh ssh-keygen -t rsa -b 16384 > Generating public/private rsa key pair. > Enter file in which to save the key (/Users/mickael/.ssh/id_rsa): > Enter passphrase (empty for no passphrase): > Enter same passphrase again: > Your identification has been saved in /Users/mickael/.ssh/id_rsa. > Your public key has been saved in /Users/mickael/.ssh/id_rsa.pub. > The key fingerprint is: [...] ``` Send public key to the distant server: ```sh ssh-copy-id -i .ssh/id_rsa.pub mycentos > /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: ".ssh/id_rsa.pub" > /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed > /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys > @mycentos's password: > Number of key(s) added: 1 > Now try logging into the machine, with: "ssh 'mycentos'" and check to make sure that only the key(s) you wanted were added. ``` Connect and check: ```sh ssh mycentos > Last login: Tue Apr 28 14:01:03 2020 from 192.168.1.198 cat ~/.ssh/authorized_keys ``` ### GPG Keys Check gpg keys: ```sh gpg --list-keys ``` Create: ```sh gpg --gen-key ``` Re-check. [Echanging key](https://www.gnupg.org/gph/en/manual/x56.html): ```sh # For export gpg --output .gpg --export ``` ```sh # For ASCII format gpg --armor --export ``` Edit `~/.zshrc` and [add](https://www.gnupg.org/documentation/manuals/gnupg/Invoking-GPG_002dAGENT.html): ```sh # Fix gpg passphrase export GPG_TTY=$(tty) ``` To test: ```sh echo "test" | gpg2 --clearsign ``` ### Packages [Packages search for Linux & Unix](https://pkgs.org/). #### Nmap > Nmap is one of the most popular tools for network mapping. You can discover active hosts within a network, and a wide range of other detection features. Nmap has functions for host discovery, port scanning, OS detection, app versions, and other scripting interactions. ```sh sudo dnf install -y nmap ``` #### Others - Kismet Wireless - John the Ripper - THC Hydra - Metasploit Framework - OpenVAS ### Configuration - [FirewallD sur un serveur LAN](https://archives.microlinux.fr/firewalld-serveur-lan/) by [MicroLinux][linkMicroLinux] ๐Ÿ‡ซ๐Ÿ‡ท. - [FirewallD sur un serveur dรฉdiรฉ](https://archives.microlinux.fr/firewalld-dedibox/) by [MicroLinux][linkMicroLinux] ๐Ÿ‡ซ๐Ÿ‡ท. - [Bloquer les attaques par force brute](https://archives.microlinux.fr/fail2ban-centos-7/) avec [Fail2ban](https://www.fail2ban.org/wiki/index.php/Main_Page) sous CentOS 7 by [MicroLinux][linkMicroLinux] ๐Ÿ‡ซ๐Ÿ‡ท. ### Check For check open ports and write it in a file: ```sh mkdir tmp nmap -p 0-65535 portquiz.net > tmp/nmaptest grep filtered tmp/nmaptest ``` ## Git ### Config Git tools - [signing your work](https://git-scm.com/book/en/v2/Git-Tools-Signing-Your-Work) ```sh git config --global user.email git config --global user.name git config --global user.signingkey = git config --global color.ui = always git config --global color.branch = always git config --global color.diff = always git config --global color.interactive = always git config --global color.status = always git config --global push.default = simple git config --global gpg.program = gpg2 git config --global commit.gpgSign = true ``` To get in `.gitconfig`: ```sh [user] email = name = signingkey = [color] ui = always branch = always diff = always interactive = always status = always [push] default = simple [gpg] program = gpg2 [commit] gpgSign = true ``` # Tips ## Zsh - [Official site](http://zsh.sourceforge.net/). - Find all files in `path` that contain `text` : `sudo grep -Rnil 'text' path`. - [75 dnf commands, tips & plugins](https://www.sitepoint.com/zsh-commands-plugins-aliases-tools/). - Fonction used for ignore tmux.plugin.zsh: ```sh var="$HOME/.oh-my-zsh" ; find "$var" | while read -r line; do echo "$var/$line"; done >> ~/.gitignore ``` - Add timestamp to a file: ```sh h >> "~/list-$(date '+%s').txt" ``` - Test script with [ShellCheck](https://www.shellcheck.net/). - Make dir and cd it: ```sh mkdir "" && cd "$_" ``` - Or paste following lines in `.zshrc` and refresh after: ```sh mkcdir () { mkdir -p -- "$1" && cd -P -- "$1" } ``` ## Dnf - [Dnf doc](https://dnf.readthedocs.io/en/latest/index.html). - [25 useful dnf command examples](https://www.rootusers.com/25-useful-dnf-command-examples-for-package-management-in-linux/). - [How to install and remove packages with DNF in Fedora](https://linoxide.com/how-tos/yum-replace-dnf/). - [Dnf, le gestionnaire de paquets de Fedora](https://doc.fedora-fr.org/wiki/DNF,_le_gestionnaire_de_paquets_de_Fedora) ๐Ÿ‡ซ๐Ÿ‡ท. ## Tmux - [Shortcuts & cheatsheet](https://gist.github.com/MohamedAlaa/2961058). - [Cheat sheet 1](http://cheat.errtheblog.com/s/tmux). - [Cheat sheet 2](https://tmuxcheatsheet.com/). - [Cheat sheet 3](https://gist.github.com/henrik/1967800). - [Manual](http://man7.org/linux/man-pages/man1/tmux.1.html). - Help : `Ctrl` `b` + `?` (or `Ctrl` `a` + `?` in my case). ## Git - [Git tutorial](https://riptutorial.com/fr/git). - [Git tutorial from Bitbucket](https://www.atlassian.com/git/tutorials). - [Devenez un expert de git](https://www.atlassian.com/fr/git/tutorials). - List files not add and not in .ignore file : `git ls-files -o --exclude-standard | cut -d/ -f1 | uniq`. - [Add user sign key](https://git-scm.com/book/fr/v2/Personnalisation-de-Git-Configuration-de-Git): `git config --global user.signingkey `. - Sign a commit : `git commit -a -S -m 'commit signรฉ'`. ## Vim - [Vim The editor](https://vim.fandom.com/wiki/Vim_Tips_Wiki) original tips. - [Cheat sheet](https://vim.rtorr.com/). - Save sudo [without root permission](https://www.cyberciti.biz/faq/vim-vi-text-editor-save-file-without-root-permission/): `:w! sudo tee %`. - [Delete tips](https://alvinalexander.com/linux/vi-vim-delete-line-commands-to-end/). - Comment lines 66 to 70: `:66,70s/^/#` - To yank all the lines and copy to the clipboard : `:% y +` or `:g g " + y G`. - [Clear the last search](https://stackoverflow.com/questions/657447/vim-clear-last-search-highlighting): `:let @/ = ""` or `noh`. - [Search & Replace](https://vim.fandom.com/wiki/Search_and_replace). - [Vim Tips](https://alvinalexander.com/taxonomy/term/3023/) form [Alvin Alexander](https://alvinalexander.com/). ## pip - Upgrade pip: `pip install --upgrade pip` ## Various - Check if a package if present `rpm -qa | grep -i packageName`. - [Use `history`](https://www.howtogeek.com/465243/how-to-use-the-history-command-on-linux/). - Interactive search : `Ctrl` `r`. - [How to install an RPM package into a different directory in CentOS/RHEL/Fedora](https://www.thegeekdiary.com/how-to-install-an-rpm-package-into-a-different-directory-in-centos-rhel-fedora/). - [Special-use IPv4 addresses](https://www.ietf.org/rfc/rfc3330.txt). - To know its ip address: `host myip.opendns.com resolver1.opendns.com`. - [Remove user and every trace](https://www.howtogeek.com/656549/how-to-delete-a-user-on-linux-and-remove-every-trace/). - [Tar command with examples](https://www.fosslinux.com/34665/15-tar-command-in-linux-uses-with-examples.htm). - [Bash reference manual](https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Compound-Commands). - [Command not found](https://command-not-found.com/). # Various ## Sources [linkMicroLinux]:https://archives.microlinux.fr/ - [MicroLinux][linkMicroLinux] ๐Ÿ‡ซ๐Ÿ‡ท. - [It-Connect.fr](https://www.it-connect.fr/) ๐Ÿ‡ซ๐Ÿ‡ท. - [Pwet/man/linux](http://pwet.fr/man/linux/) ๐Ÿ‡ซ๐Ÿ‡ท. - [IP addresses tools](https://ipaddressguide.com/). - [Linux help](https://www.linuxhelp.com/). - [PhoenixNAP](https://phoenixnap.com/kb/). - [GPG with LinuxPedia](https://linuxpedia.fr/doku.php/expert/gnupg). ## Go further - [How to set up your own private Git server on Linux](https://tumblr.intranation.com/post/766290565/how-set-up-your-own-private-git-server-linux). - [RaspberryPi OwnCloud](https://www.instructables.com/id/Raspberry-Pi-Owncloud-dropbox-clone/). - [RaspberryPi projetcs](https://sites.google.com/site/cartwrightraspberrypiprojects/home). - [Installer un serveur de rรฉseau local](https://archives.microlinux.fr/serveur-lan-centos-7/) & [Make a samba server on RHEL 7](https://www.lisenet.com/2016/samba-server-on-rhel-7/). - [How to cross-compile](https://releases.llvm.org/8.0.1/docs/HowToCrossCompileBuiltinsOnArm.html) ## Todo - [ ] Find cross-compiling for [nodeJS](https://nodejs.org/dist/latest-v10.x/) : [1](https://blog.kitware.com/cross-compiling-for-raspberry-pi/) [2](https://github.com/nodejs/build/issues/1724) [3](https://stackoverflow.com/questions/19162072/how-to-install-the-raspberry-pi-cross-compiler-on-my-linux-host-machine). - [ ] To try to install [Joplin](https://github.com/laurent22/joplin/). - [ ] Find to install on hdd or ssd.