tutoriels

Guides

30 secondes

Pour résoudre un problème, ou pour apprendre une commande, je n'ai pas toujours envie de scroller sur StackOverflow, ou d'ouvrir 4 onglets sur le même sujet pour trouver une solution efficace.

J'essaie donc de faire des tutos les plus courts possibles. 30 secondes est le maximum d'attention dont tu as besoin pour lire les tutos suivants.

Please PR if you find a mistake.

How to install postgresql on Arch Linux ?

Install the postgresql package.

sudo pacman -S postgresql

Switch to postgres user.

sudo -iu postgres

Initialize the database cluster.

[postgres]$ initdb -D /var/lib/postgres/data

Start the postgresql.service.

systemctl start postgresql

Or enable it if you want postgresql launches at startup.

systemctl enable postgresql

How to recursively delete all files of a specific extension in a directory ?

Use it with caution :

find . -name "*.bak" -type f -delete

How to git from another directory ?

git

Requirements:

For example with push :

git -c /your/repo/dir push -v

-v is optional. It's the verbose output.

How to install homebrew in Linux ?

linux

Requirements : On Debian or Ubuntu : sudo apt-get install build-essential procps curl file git

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

test -d ~/.linuxbrew && eval "$(~/.linuxbrew/bin/brew shellenv)"

test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"

test -r ~/.bash_profile && echo "eval \"\\((\)(brew --prefix)/bin/brew shellenv)\"" >> ~/.bash_profile

echo "eval \"\\((\)(brew --prefix)/bin/brew shellenv)\"" >> ~/.profile

How to use pywal with sway ?

sway ricing

Requirements :

Add in your sway config file, and before any color usage :

include "$HOME/.cache/wal/colors-sway"

How to copy text from vim to clipboard ?

linux vim

The system buffer in vim is *.

To select a buffer in vim, you have to press ".

To copy text, use y for yank.

So to copy text from vim to clipboard, type :

"*y

How to continue calculations in python interpreter ?

python

The last printed expression is assigned to the variable _.

Example :

>>> 125 * 23 / 100
28.75
>>> 125 - _
96.25

How to cleanup /var/log/journal ?

Pour connaître la taille du répertoire :

journalctl --disk-usage

En réduisant la taille que doivent prendre vos fichiers de logs, Linux va supprimer les plus anciens :

journalctl --vacuum-size=500M

How to check a file integrity with shasum ?

Requirements :

cat your_file.sha512sum | shasum -a 512 --check filename

How to find a device name ?

df

or

lsblk

How to create a bootable Linux USB stick ?

Requirements :

dd if=~/your_linux_image.iso of=/dev/device_name bs=1M status=progress

You can switch to bs=4M with no hassle.

Display classes and functions in a python file

grep -E "class|def" file.py

How to list installed packages with pip ?

pip list

How to create a simple web server with python ?

To start the server in your current directory.

In command line :

python -m http.server

How to create a video from a music album and its cover

Requirements :

Concatenate audio files :

sox track1.ogg track2.ogg track3.ogg full_album.ogg

Resize cover image if needed :

convert cover.jpg -resize 720x720 small_cover.jpg

Merge audio and image into a video file :

ffmpeg -i small_cover.jpg -i full_album.ogg output.mp4

How to find a string into multiple files ?

grep -r string ./*

-r to search recursively into current directory (./*).


computer