LittleGreenCat / Improving the readability of commands
最后活跃于
Улучшаем читаемость истории комманд.
Может быть полезно показать, когда была выполнена команда. Определите переменную окружения HISTTIMEFORMAT, чтобы настроить это. Она использует стандартные шаблоны даты и времени Здесь %F указывает дату, а %T — время.
export HISTTIMEFORMAT='%F %T - '
в результете вывод команды history примет красивый читаемый вид с временными метками:
1 2023-04-04 06:20:20 - ls
2 2023-04-04 06:20:25 - cat /etc/passwd
3 2023-04-04 06:20:29 - whoami
LittleGreenCat / Permanently disable IPv6 in linux system
最后活跃于
Перманентно отключить IPv6 в linux системе
vi /etc/sysctl.d/10-ipv6off.conf
и добавить в файл:
# Disabling the IPv6
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
Но можно и через grub:
vi /etc/default/grub
LittleGreenCat / Make NFS a little faster
最后活跃于
Как выжать из NFS еще капельку скорости.
1 | #Команда монтирования для /etc/fstab, но можно и ручками.. |
2 | |
3 | 10.20.30.40:/data /data nfs nfsvers=3,rw,async,hard,intr,timeo=600,bg,retrans=2,noatime 0 0 |
4 | |
5 | # Опубликовано в https://t.me/gitgate |
LittleGreenCat / Copying via SCP via Jumphost
最后活跃于
Наверное все знают, как через джампхост пробрасывать SSH сессию. А если надо скопировать по SCP?
scp -o "ProxyJump <JUMP_USER>@<JUMP_HOST>" dataFile.txt <USER>@<HOST>:/tmp
Отлично работает и с авторизацией по ключам.
Опубликовано в GitGate
LittleGreenCat / Search all man pages by keyword
最后活跃于
Поиск всех man страничек по ключевому слову
LittleGreenCat / Proxy only for apt, not for the whole system
最后活跃于
Прокси только для 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
1 | # Returns true if the numbers are equal |
2 | [[ ${arg1} -eq ${arg2} ]] |
3 | |
4 | # Returns true if the numbers are not equal |
5 | [[ ${arg1} -ne ${arg2} ]] |
6 | |
7 | # Returns true if arg1 is less than arg2 |
8 | [[ ${arg1} -lt ${arg2} ]] |
9 | |
10 | # Returns true if arg1 is less than or equal arg2 |
LittleGreenCat / Conditional expressions for string variables in bash
最后活跃于
Условные выражения для строковых переменных в bash
1 | # True if the shell variable varname is set (has been assigned a value). |
2 | [[ -v ${varname} ]] |
3 | |
4 | # True if the length of the string is zero. |
5 | [[ -z ${string} ]] |
6 | |
7 | # True if the length of the string is non-zero. |
8 | [[ -n ${string} ]] |
9 | |
10 | # 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) |
LittleGreenCat / Conditional expressions for files in bash
最后活跃于
Условные выражения для файлов в bash
1 | ## True if file exists. |
2 | [[ -a ${file} ]] |
3 | |
4 | ## True if file exists and is a block special file. |
5 | [[ -b ${file} ]] |
6 | |
7 | ## True if file exists and is a character special file. |
8 | [[ -c ${file} ]] |
9 | |
10 | ## True if file exists and is a directory. |