meta data for this page
  •  

Különbségek

A kiválasztott változat és az aktuális verzió közötti különbségek a következők.

Összehasonlító nézet linkje

Előző változat mindkét oldalonElőző változat
Következő változat
Előző változat
Következő változatKövetkező változat mindkét oldalon
linux [2019/12/10 17:22] adminlinux [2020/09/30 15:06] – [~/.vimrc] admin
Sor 1: Sor 1:
 ===== Linux okosságok ===== ===== Linux okosságok =====
 +
 +==== Yum-mal telepített csomagok listázása log fájlból ====
 +
 +  cat /var/log/yum.log | sed "s#.\+: \?\(.\+\)#\1#" | sort
 +==== Disk perf. teszt DD-vel ====
 +
 +<file>
 +#!/bin/bash
 +echo -n "Fajl nev: "
 +read FNEV
 +echo -n "Blokk meret (Byte): "
 +read BS
 +echo -n "Fajl meret (MByte): "
 +read FS
 +COUNT=$((FS*1024*1024 / $BS))
 +COUNT=$(echo $COUNT | sed 's/\..*$/g/')
 +echo -n "Diszk irasa (dd if=/dev/zero of=$FNEV bs=$BS count=$COUNT)… "
 +SEC=$(timex dd if=/dev/zero of=$FNEV bs=$BS count=$COUNT 2>&1 | awk '/real/{print $2}' | awk -F'.' '{print $1}')
 +echo "$(($FS / $SEC)) MB/s"
 +</file>
  
 ==== BOOT probléma ==== ==== BOOT probléma ====
Sor 5: Sor 25:
 GRUB menüben a "quiet" paraméter helyére "dracut rdshell"-t betenni GRUB menüben a "quiet" paraméter helyére "dracut rdshell"-t betenni
  
 +==== ~/.vimrc ====
 +
 +  set number background=dark
 +  syntax on
 +  highlight Comment    ctermfg=119
 +  highlight Identifier ctermfg=99AA00
 +  set ts=4 sw=4
 +  undolevels=1000
 ==== RAID megoldások ==== ==== RAID megoldások ====
  
Sor 28: Sor 56:
   lvdisplay -C -S lv_role=snapshot   lvdisplay -C -S lv_role=snapshot
  
-==== SSH kilép aciklusból az első futás után ====+==== sudo jog másik userhez ==== 
 + 
 +  non-root-user ALL = (appuser) NOPASSWD: ALL
  
-  ssh -n ... 
  
 ==== NMON adatgyűjtés ==== ==== NMON adatgyűjtés ====
Sor 52: Sor 81:
 nmon -f -s $INTERVAL -c $SAMPLES nmon -f -s $INTERVAL -c $SAMPLES
 </file> </file>
- 
-==== Ismétlődő sorok számolása ==== 
- 
-  cat file | sed 's/([^(]*)$/,&/' | awk -F'[,]' '{a[$2]++}END{for(k in a) print $1,k,$3,"("a[k]"x)"}' 
- 
-==== /dev/stdin üres-e? (Van-e adat a pipe-ban?) ==== 
- 
-  [ ! -t 0 ] 
- 
-==== Bekezdésre greppelés Linux alatt (AIX: grep -p) ==== 
- 
-  awk 'BEGIN{RS=ORS="\n\n";FS=OFS="\n"}/Storage Slots/ 
  
 ==== Email címek extraktálása AIX alatt ==== ==== Email címek extraktálása AIX alatt ====
Sor 69: Sor 86:
   perl -wne'while(/[\w\.\-]+@[\w\.\-]+\w+/g){print "$&\n"}'   perl -wne'while(/[\w\.\-]+@[\w\.\-]+\w+/g){print "$&\n"}'
  
-==== Bash színkódok törlése szövegből ==== 
- 
-  sed "s,\x1B\[[0-9;]*[a-zA-Z],,g" 
 ==== Hiányzik az "add-apt-repository": ==== ==== Hiányzik az "add-apt-repository": ====
  
Sor 108: Sor 122:
 # Get current swap usage for all running processes # Get current swap usage for all running processes
 # Erik Ljungstrom 27/05/2011 # Erik Ljungstrom 27/05/2011
 +echo "Swappiness: $(cat /proc/sys/vm/swappiness)"
 SUM=0 SUM=0
 OVERALL=0 OVERALL=0
Sor 124: Sor 139:
 </file> </file>
  
-==== Sztringek hexa értelmezésének kiküszöbölése ==== 
- 
-Pl: 
-  $((10#`date +%H`)) 
- 
-==== A grep "-o" kapcsolójának kiváltása perl-lel ==== 
- 
-  perl -lne '/reguláris kifejezés/ && print $&' 
 ==== Törölt fájlok, amik nem szabadították még fel a helyet ==== ==== Törölt fájlok, amik nem szabadították még fel a helyet ====
   lsof |(sed 1q; grep deleted)   lsof |(sed 1q; grep deleted)
-==== BASH változó manipulációk ==== +    
- +
-^Syntax^Meaning^ +
-|${#var} | String length (number of characters in $var).| +
-|${var%%^^%%} | Uppercase alphanumeric characters in $var.| +
-|${parameter?err_msg},${parameter:?err_msg} | If parameter set, use it, else print err_msg and abort the script with an exit status of 1. Both forms nearly equivalent. The : makes a difference only when parameter has been declared and is null.| +
-|${parameter-default},${parameter:-default} | If parameter not set, use default. ${parameter-default} and ${parameter:-default} are almost equivalent. The extra : makes a difference only when parameter has been declared, but is null.| +
-|${parameter=default},${parameter:=default} | If parameter not set, set it to default. Both forms nearly equivalent. The : makes a difference only when $parameter has been declared and is null.| +
-|${parameter+alt_value},${parameter:+alt_value} | If parameter set, use alt_value, else use null string. Both forms nearly equivalent. The : makes a difference only when parameter has been declared and is null.| +
-|${var#Pattern} | Remove from $var the shortest part of $Pattern that matches the front end of $var.| +
-|${var##Pattern} | Remove from $var the longest part of $Pattern that matches the front end of $var.| +
-|${var%Pattern} | Remove from $var the shortest part of $Pattern that matches the back end of $var.| +
-|${var%%%%Pattern} | Remove from $var the longest part of $Pattern that matches the back end of $var.| +
-|${var:pos} | Variable var expanded, starting from offset pos.| +
-|${var:pos:len} | Expansion to a max of len characters of variable var, from offset pos.| +
-|${var/Pattern/Replacement} | First match of Pattern, within var replaced with Replacement. If Replacement is omitted, then the first match of Pattern is replaced by nothing, that is, deleted.| +
-|${var%%//%%Pattern/Replacement} | Global replacement. All matches of Pattern, within var replaced with Replacement. If Replacement is omitted, then all occurrences of Pattern are replaced by nothing, that is, deleted.| +
-|${var/#Pattern/Replacement} | If prefix of var matches Pattern, then substitute Replacement for Pattern.| +
-|${var/%Pattern/Replacement} | If suffix of var matches Pattern, then substitute Replacement for Pattern.| +
-|${!varprefix*},${!varprefix@} | Matches names of all previously declared variables beginning with varprefix.| +
- +
-forrás: [[http://tldp.org/LDP/abs/html/parameter-substitution.html]] +
- +
-==== Gyakori BASH RC kódok ==== +
- +
-^Exit Code Number ^Meaning ^Example ^Comments^ +
-|1 |Catchall for general errors |let "var1 = 1/0" |Miscellaneous errors, such as "divide by zero" and other impermissible operations| +
-|2 |Misuse of shell builtins (according to Bash documentation) |empty_function() {} |Missing keyword or command| +
-|126 |Command invoked cannot execute |/dev/null |Permission problem or command is not an executable| +
-|127 |"command not found" |illegal_command |Possible problem with $PATH or a typo| +
-|128 |Invalid argument to exit |exit 3.14159 |exit takes only integer args in the range 0 - 255 (see first footnote)| +
-|128+n |Fatal error signal "n" |kill -9 $PPID of script |$? returns 137 (128 + 9)| +
-|130 |Script terminated by Control-C |Ctl-C |Control-C is fatal error signal 2, (130 = 128 + 2, see above)| +
-|255* |Exit status out of range |exit -1 |exit takes only integer args in the range 0 - 255| +
- +
-==== Hiba csatorna színezése ==== +
- +
-   $ parancs 2> >(while read line; do echo -e "\e[01;31m$line\e[0m"; done) +
-    +
-==== Terminál kurzor pozícionálás ==== +
-   +
-- Position the Cursor: +
-  \033[<L>;<C>+
-     Or +
-  \033[<L>;<C>+
-  puts the cursor at line L and column C. +
-- Move the cursor up N lines: +
-  \033[<N>+
-- Move the cursor down N lines: +
-  \033[<N>+
-- Move the cursor forward N columns: +
-  \033[<N>+
-- Move the cursor backward N columns: +
-  \033[<N>+
- +
-- Clear the screen, move to (0,0): +
-  \033[2J +
-- Erase to end of line: +
-  \033[K +
- +
-- Save cursor position: +
-  \033[s +
-- Restore cursor position: +
-  \033[u +
- +
-==== "Homokóra" - progress icon ==== +
-v1: +
-<file> +
-a=1 +
-sp="/-\|" +
-echo -n ' ' +
-while true +
-do +
-    printf "\b${sp:a++%${#sp}:1}" +
-done +
-</file> +
-v2: +
-<file> +
-spinner() +
-+
-    local pid=$1 +
-    local delay=0.75 +
-    local spinstr='|/-\' +
-    while [ "$(ps a | awk '{print $1}' | grep $pid)" ]; do +
-        local temp=${spinstr#?+
-        printf " [%c]  " "$spinstr" +
-        local spinstr=$temp${spinstr%"$temp"+
-        sleep $delay +
-        printf "\b\b\b\b\b\b" +
-    done +
-    printf "    \b\b\b\b" +
-+
-</file> +
- +
-==== Parancsok csoportosítása ==== +
- +
-Új shellben: +
-  (parancs1) +
-   +
-Aktuális shellben: +
-  { parancs1; } +
-  +
 ==== Hosszú processz végeztéről értesítő email ==== ==== Hosszú processz végeztéről értesítő email ====