Useful Tools | Linux | GitOps | DevOps
6.09K subscribers
211 photos
3 videos
7 files
776 links
Полезные бесплатные opensource инструменты на все случаи жизни, а иногда и советы.

Понравился проект из поста - поддержи автора звездой!

Web: https://gitgate.d3.ru

Сотрудничество: @maxgrue
Обсуждение: @gittalk
Download Telegram
Совет дня:

Как заблокировать пакеты для обновления и все таки обновить их потом при необходимости (для apt дистрибутивов)

после установки защитите версии пакетов от обновления.

apt-mark hold <PACKAGENAME>


при необходимости обновления можно принудительно разрешить

apt-get install -y --allow-change-held-packages <PACKAGENAME>


опубликовано в @gitgate

#tips #apt
👍49🔥10
Совет дня:

Как быстро посмотреть версию и название дистрибутива linux, а так же на базе чего он построен.

cat /etc/*release*

опубликовано в @gitgate

#tips #linux #info
👍27🔥10
Совет дня:

Разные варианты команды grep и ключи для смены режимов в базовом grep

grep = grep -G # базовое регулярное выражение (BRE)
fgrep = grep -F # фиксированный текст, игнорирующий мета-символы
egrep = grep -E # расширенное регулярное выражение (ERE)
rgrep = grep -r # рекурсивный


опубликовано в @gitgate

#tips #grep
👍22🔥7
Совет дня:

Звуковой сигнал в консоли заданного тона и длительности. Например для оповещений об ошибках.

TONE=3500 #от 500 до 3500
(speaker-test -t sine -f $TONE) & pid=$!;sleep 0.1s;kill -9 $pid


Вообще интересная утилитка, позволяющая проигрывать и WAV, и раздельно левый правый канал и много чего еще.

опубликовано в @gitgate

#tips #speaker #beep
👍15🔥8
Совет дня:

Условные выражения для файлов в bash

## True if file exists.
[[ -a ${file} ]]

## True if file exists and is a block special file.
[[ -b ${file} ]]

## True if file exists and is a character special file.
[[ -c ${file} ]]

## True if file exists and is a directory.
[[ -d ${file} ]]

## True if file exists.
[[ -e ${file} ]]

## True if file exists and is a regular file.
[[ -f ${file} ]]

## True if file exists and is a symbolic link.
[[ -h ${file} ]]

## True if file exists and is readable.
[[ -r ${file} ]]

## True if file exists and has a size greater than zero.
[[ -s ${file} ]]

## True if file exists and is writable.
[[ -w ${file} ]]

## True if file exists and is executable.
[[ -x ${file} ]]

## True if file exists and is a symbolic link.
[[ -L ${file} ]]


PS. в линукс все есть файл или поток :)

PPS. И переменные окружения.


опубликовано в @gitgate

#tips #bash
👍39🔥13
Совет дня:

Условные выражения для строковых переменных в bash

# True if the shell variable varname is set (has been assigned a value).
[[ -v ${varname} ]]

# True if the length of the string is zero.
[[ -z ${string} ]]

# True if the length of the string is non-zero.
[[ -n ${string} ]]

# True if the strings are equal. = should be used with the test command for POSIX conformance. When used with the [[ command, this performs pattern matching as described above (Compound Commands)
[[ ${string1} == ${string2} ]]

# True if the strings are not equal.
[[ ${string1} != ${string2} ]]

# True if string1 sorts before string2 lexicographically.
[[ ${string1} < ${string2} ]]

# True if string1 sorts after string2 lexicographically.
[[ ${string1} > ${string2} ]]



опубликовано в @gitgate

#tips #bash
👍32🔥10
Совет дня:

Арифметические операции в bash

# Returns true if the numbers are equal
[[ ${arg1} -eq ${arg2} ]]

# Returns true if the numbers are not equal
[[ ${arg1} -ne ${arg2} ]]

# Returns true if arg1 is less than arg2
[[ ${arg1} -lt ${arg2} ]]

# Returns true if arg1 is less than or equal arg2
[[ ${arg1} -le ${arg2} ]]

# Returns true if arg1 is greater than arg2
[[ ${arg1} -gt ${arg2} ]]

# Returns true if arg1 is greater than or equal arg2
[[ ${arg1} -ge ${arg2} ]]

# As with other programming languages you can use AND & OR conditions:
[[ test_case_1 ]] && [[ test_case_2 ]] # And
[[ test_case_1 ]] || [[ test_case_2 ]] # Or



опубликовано в @gitgate

#tips #bash
👍15🔥10
Совет дня:

прокси только для apt, но не для системы в целом

cat <<EOF | sudo tee /etc/apt/apt.conf.d/90curtin-aptproxy
Acquire::http::Proxy "http://10.20.30.40:3128";
Acquire::https::Proxy "http://10.20.30.40:3128";
EOF


Альтернативный способ, чтобы не прописывать прокси в систему (мы же за безопасность) можно ее прям команде скормить, например:

http_proxy=http://10.20.30.40:3128  https_proxy=http://10.20.30.40:3128  HTTP_PROXY=http://10.20.30.40:3128  HTTPS_PROXY=http://10.20.30.40:3128 apt update


(это все одной строкой, просто переменные прокси указываются перед командой)

опубликовано в @gitgate

#tips #apt #proxy
👍30🔥13
Совет дня:

Чтобы найти все man  странички по ключевому слову - используйте хитрый ключик.

man -K <command>


(последовательно выводит все найденные маны с этим словом) Полезно для поиски редких кулябек.


Добавка от Andrew - @avz10

еще и команда apropos только удобнее

опубликовано в @gitgate

#tips #man
👍23🔥10
Совет дня:

Наверное все знают как через джампхост пробрасывать SSH сессию. А если надо скопировать по SCP ?

scp -o "ProxyJump <JUMP_USER>@<JUMP_HOST>" dataFile.txt  <USER>@<HOST>:/tmp


Отлично работает и с авторизацией по ключам.

опбубликовано в @gitgate

#tips #scp #jumphost
🔥27👍18
Совет дня:

Как выжать из NFS еще капельку скорости. Команда монтирования для /etc/fstab, но можно и ручками..

10.20.30.40:/data  /data  nfs  nfsvers=3,rw,async,hard,intr,timeo=600,bg,retrans=2,noatime 0 0


Пояснения (если нужны), добавления и вопросы - в каментах.

опубликовано в @gitgate

#tips #nfs
1👍15🔥5