Bii o ṣe le yọ awọn iṣiro lati Terminal ti nbere Ikarahun Ikarahun

El Ikarahun ikarahun, O ntokasi si awọn ipaniyan ti awọn ibere eka nipa GNU / Linux Terminal (Console), o wulo pupọ lati ṣe adaṣe adaṣe ati awọn iṣẹ pataki laarin wa - GNU / Linux Operating System, eyi ti o fun wa laaye lati je ki wa Awọn orisun ati Akoko, iyẹn ni pe, pẹlu ohun ti o wa nibi a yoo ṣe iwari bii lati ebute naa a le ṣe awọn aṣẹ ọwọ ti lẹhinna gba wa laaye iṣeto / adaṣiṣẹ awọn iṣẹ nipa fifipamọ ẹgbẹ kan Awọn wakati / Iṣẹ ti Afowoyi tabi ipaniyan oju-oju, imuṣe awọn aṣẹ ti a sọ ni Bash Shell Script tabi ibaramu ati alaye ni ọna ti o wulo ati rọrun.

Aṣayan_007A yoo bo bi ninu aṣẹ aṣẹ kan podemos jade ati ṣafihan awọn iye / alaye lati Ẹrọ Isẹ / Hardware, eyiti a le ṣe lẹhinna laarin kan Bash Shell akosile lati ṣe adaṣe iṣẹ-ṣiṣe kan pato. Fojusi lori awọn Awọn Iṣe Ti o dara julọ pataki lati gba apẹrẹ ti o dara julọ ti Iwe afọwọkọ kan ni ọna daradara siwaju sii ati ilowo.

————————————————————-
Gba orukọ olumulo akọkọ ti a ṣẹda ninu eto naa:
————————————————————-

USER_1000=$(cat /etc/passwd | grep 1000 | cut -d: -f1) ;  echo $USER_1000

USER_1001=$(cat /etc/passwd | grep 1001 | cut -d: -f1) ;  echo $USER_1001

————————————————————————
Gba ọna ti / ile ti olumulo akọkọ ti a ṣẹda lori eto:
————————————————————————

USER_1000=$(cat /etc/passwd | grep 1000 | cut -d: -f1) ; HOME_USER_1000=/home/$USER_1000 ; echo $HOME_USER_1000

USER_1001=$(cat /etc/passwd | grep 1001 | cut -d: -f1) ; HOME_USER_1001=/home/$USER_1001 ; echo $HOME_USER_1001

-------------
Ṣayẹwo Ọjọ Ẹrọ Ẹrọ Lọwọlọwọ:
-------------

FECHA_ACTUAL=$(date +"%d %b %y") ; echo $FECHA_ACTUAL

------------
Ṣayẹwo Akoko Ohun elo Lọwọlọwọ:
------------

HORA_ACTUAL=$(date +"%H:%M") ; echo $HORA_ACTUAL

————————————————--
Ṣayẹwo boya Ogun naa ni asopọ Ayelujara:
————————————————--

if ping -c 1 8.8.8.8 &> /dev/null; then CONEXION_INTERNET=Habilitado; else CONEXION_INTERNET=Deshabilitado; fi ; echo $CONEXION_INTERNET

TEST_PING=$(ping 192.168.3.249 -c 5 | grep packet | awk '{print $6}' | cut -f1 -d%) ; echo $TEST_PING % de Perdida de paquetes
TEST_LATENCIA=$(ping 8.8.8.8 -c 5 | grep packet | awk '{print $10}' | cut -f1 -d%) ; echo $TEST_LATENCIA de Latencia del Enlace
-------------
Ṣayẹwo iru Ẹrọ Ṣiṣẹ:
-------------

SISTEMA_OPERATIVO=$(uname -o) ; echo $SISTEMA_OPERATIVO

———————————————————————-
Ṣayẹwo orukọ, ẹya ati ifasilẹ ti Eto Isẹ:
———————————————————————-
NOMBRE_SISTEMA=$(cat /etc/os-release | grep NAME | grep -v "VERSION" | sed -n '2p' | cut -f2 -d\") ; echo $NOMBRE_SISTEMA
VERSION_SISTEMA=$(cat /etc/os-release | grep VERSION= | sed -n '1p' | sed 's/VERSION=//' | sed 's/"//g') ; echo $VERSION_SISTEMA

SUBVERSION_SISTEMA=$(lsb_release -d | awk '{print $4}') ; echo $SUBVERSION_SISTEMA

----------------
Ṣayẹwo faaji ti Eto Isẹ:
----------------

ARQUITECTURA=$(uname -m) ; echo $ARQUITECTURA

ARQUITECTURA=$(uname -m) ; if [[ "$ARQUITECTURA" = "x86" ]]; then ARQ_SISTEMA=32; else ARQ_SISTEMA=64; fi ; echo $ARQ_SISTEMA

------------------
Ṣayẹwo ẹya ekuro ti Eto Isẹ:
------------------

VERSION_KERNEL=$(uname -r) ; echo $VERSION_KERNEL

----------
Ṣayẹwo orukọ alejo:
----------

NOMBRE_HOST=$(cat /etc/hostname) ; echo $NOMBRE_HOST
———————————————————————-
Ṣayẹwo Inu IP ati ti Ita (Ifilelẹ Intanẹẹti Akọkọ):
———————————————————————-

IP_INTERNA=$(hostname -I) ; echo $IP_INTERNA

IP_EXTERNA=$(curl -s ipecho.net/plain;echo) ; echo $IP_EXTERNA

------------------
Ṣayẹwo Awọn Iye (IP / MAC) ti Awọn wiwo Awọn Nẹtiwọọki:
------------------

IP_ETH0=$(ifconfig eth0 | grep inet | grep -v inet6 | cut -d ":" -f 2 | cut -d " " -f 1) ; echo $IP_ETH0

MAC_ETH0=$(ifconfig eth0 | sed -n '1p' | awk '{print $5}') ; echo $MAC_ETH0

IP_WLAN0=$(ifconfig wlan0 | grep inet | grep -v inet6 | cut -d ":" -f 2 | cut -d " " -f 1) ; echo $IP_WLAN0

MAC_WLAN0=$(ifconfig wlan0 | sed -n '1p' | awk '{print $5}') ; echo $MAC_WLAN0
——————————————————
Ṣayẹwo Aṣoju / Ẹnubode ti Ẹrọ Iṣiṣẹ:
——————————————————

PROXY_GATEWAY=$(route -n | sed -n '3p' | awk '{print $2}') ; echo $PROXY_GATEWAY

————————————————--
Ṣayẹwo Orukọ Ile-iṣẹ Nẹtiwọọki Gbalejo:
————————————————--

DOMINIO=$(cat /etc/resolv.conf | sed '2 d' | grep search | sed -n '1p' | awk '{print $2}') ; echo $DOMINIO

---------------------
Ṣayẹwo Adirẹsi Nẹtiwọọki (IP) ti Olupin DNS Server
---------------------

IP_SERVIDOR_DNS=$(cat /etc/resolv.conf | sed '1 d' | awk '{print $2}') ; echo $IP_SERVIDOR_DNS

---------------
Ṣayẹwo awọn olumulo ti o ti sopọ si Alejo naa:
---------------

who>/tmp/who ; echo -e "Usuarios conectados al Host :"  && echo "" && echo "Usuarios Puertos      Fecha      Hora  Pantalla" ; echo "*************************************************************************" && cat /tmp/who

USUARIOS_CONECTADOS=$(who | awk '{print $1}') ; echo $USUARIOS_CONECTADOS

USER_ONLINE1=$(who | awk '{print $1}') ; echo $USER_ONLINE1 | wc -w

USER_ONLINE2=$(top -n 1 -b | grep "load average:" | awk '{print $6}') ; echo $USER_ONLINE2
————————————————————————————————————————————————
Ṣayẹwo Folda Olumulo pẹlu data diẹ sii (# ti Awọn faili / Iwọn ni Awọn Baiti) ninu Eto Isẹ:
----------------------------------

CARPETA_USUARIO1=$(ls -l /home | sed '1 d' | sort -k2 | sed q | awk '{print $9}') ; echo $CARPETA_USUARIO1

DATA_USUARIO1=$(du -sh /home/* | sort -r | sed q | awk '{print $1}') ; echo $DATA_USUARIO1

———————————————————————————————
Ṣayẹwo Iwọn ni Awọn baiti ti folda Superuser tabi folda miiran ti Eto Iṣẹ:
———————————————————————————————

DATA_ROOT=$(du -sh /root | awk '{print $1}') ; echo $DATA_ROOT

DATA_CARPETA1=$(du -sh /var | awk '{print $1}') ; echo $DATA_CARPETA1

--------------------
Ṣayẹwo Awọn folda Olumulo Ti a Ṣẹda (Awọn orukọ ati Nọmba):
--------------------

NOMBRES_CARPETAS=$(ls -l /home | sed '1 d' | awk '{print $9}') ; echo $NOMBRES_CARPETAS

NUMERO_CARPETAS=$(ls -l /home | sed '1 d' | awk '{print $9}') ; echo $NUMERO_CARPETAS | wc -w

---------------------
Ṣayẹwo Awọn olumulo pẹlu UID 0 ATI GID 0 (SUPERUSERS) ti ṣẹda:
---------------------

SUPERUSUARIOS_UID=$(awk -F: '{if ($3==0) print $1}' /etc/passwd) ; echo $SUPERUSUARIOS_UID

SUPERUSUARIOS_GID=$(awk -F: '{if ($3==0) print $1}' /etc/passwd) ; echo $SUPERUSUARIOS_GID

--------------
Ṣayẹwo ipo ti Ramu ati iranti Swap:
--------------

MEM_TOTAL=$(free -h | sed '1 d' | grep Mem: | awk '{print $2}') ; echo $MEM_TOTAL

MEM_USADA=$(free -h | sed '1 d' | grep Mem: | awk '{print $3}') ; echo $MEM_USADA

MEM_LIBRE=$(free -h | sed '1 d' | grep Mem: | awk '{print $4}') ; echo $MEM_LIBRE

MEM_COMPARTIDA=$(free -h | sed '1 d' | grep Mem: | awk '{print $5}') ; echo $MEM_COMPARTIDA

MEM_ALMACENADA=$(free -h | sed '1 d' | grep Mem: | awk '{print $6}') ; echo $MEM_ALMACENADA

MEM_CACHEADA=$(free -h | sed '1 d' | grep Mem: | awk '{print $7}') ; echo $MEM_CACHEADA

SWAP_TOTAL=$(free -h | sed '1 d' | grep Swap: | awk '{print $2}') ; echo $SWAP_TOTAL

SWAP_USADA=$(free -h | sed '1 d' | grep Swap: | awk '{print $3}') ; echo $SWAP_USADA


SWAP_LIBRE=$(free -h | sed '1 d' | grep Swap: | awk '{print $4}') ; echo $SWAP_LIBRE

------------------------
Ṣayẹwo Ipinle ti awọn ipin / aaye oke ti Disiki SATA:
------------------------

PART1_TOTAL=$(df -h | sed '1 d' | grep /dev/sda5 | awk '{print $2}') ; echo $PART1_TOTAL

PART1_USADO=$(df -h | sed '1 d' | grep /dev/sda5 | awk '{print $3}') ; echo $PART1_USADO

PART1_DISPONIBLE=$(df -h | sed '1 d' | grep /dev/sda5 | awk '{print $4}') ; echo $PART1_DISPONIBLE

PART1_PORCENTAJE=$(df -h | sed '1 d' | grep /dev/sda5 | awk '{print $5}') ; echo $PART1_PORCENTAJE

PART1_PUNTOMONTAJE=$(df -h | sed '1 d' | grep /dev/sda5 | awk '{print $6}') ; echo $PART1_PUNTOMONTAJE

---------------------
Ṣayẹwo Fifuye Eto Apapọ (Awọn ilana isinyi):
---------------------

CARGA_1MIN=$(top -n 1 -b | grep "load average:" | awk '{print $10}' | sed 's/,//2') ; echo $CARGA_1MIN

CARGA_5MIN=$(top -n 1 -b | grep "load average:" | awk '{print $11}' | sed 's/,//2') ; echo $CARGA_5MIN

CARGA_15MIN=$(top -n 1 -b | grep "load average:" | awk '{print $12}' | sed 's/,//2') ; echo $CARGA_15MIN

CARGA_1MIN=$(uptime | awk '{print $8}' | sed 's/,//2') ; echo $CARGA_1MIN

CARGA_5MIN=$(uptime | awk '{print $9}' | sed 's/,//2') ; echo $CARGA_5MIN

CARGA_15MIN=$(uptime | awk '{print $10}' | sed 's/,//2') ; echo $CARGA_15MIN

——————————————————
Ṣayẹwo awọn ilana Ebora ninu Ẹrọ Ṣiṣẹ:
——————————————————

PROC_ZOMBIE=$(top -n 1 -b | grep "zombie" | awk '{print $10}') ; echo $PROC_ZOMBIE

---------------------
Ṣayẹwo Akoko Iṣẹ Gbogbo (Ibẹrẹ / Tan):
---------------------

TIEMPO_ENCENDIDO=$(uptime | awk '{print $3,$4}' | cut -f1 -d,) ; echo $TIEMPO_ENCENDIDO

---------------
Ṣayẹwo awọn iṣiro kaadi fidio:
---------------

============

Ẹlẹda:

FAB_TVIDEO=$(lspci -v | grep "VGA" | cut -d " " -f05) ; echo $FAB_TVIDEO

============

Iranti Ramu:

MEM_TVIDEO=$(lspci -v -s `lspci | awk '/VGA/{print $1}'` | sed -n '/Memory.*, prefetchable/s/.*\[size=\([^]]\+\)M\]/\1/p') ; echo $MEM_TVIDEO

================

Module (Awakọ):

DRV_TVIDEO=$(lspci -nnk | grep -i vga -A3 | grep 'in use' | cut -d " " -f05) ; echo $DRV_TVIDEO

===============

3D isare:

A3D_TVIDEO=$(glxinfo | grep "direct rendering: Yes" | awk '{print $3}') ; echo $A3D_TVIDEO

--------------
Ṣayẹwo Awọn iṣiro isise (Sipiyu):
--------------

===========

Ẹlẹda:

FABRICANTE_CPU=$(grep "vendor_id" /proc/cpuinfo | sed q | awk '{print $3}') ; echo $FABRICANTE_CPU

=======

Awoṣe:

MODELO_CPU=$(grep "model name" /proc/cpuinfo | sed q | cut -d ":" -f 2 | awk '{print $0}') ; echo $MODELO_CPU

=========

Opolopo:

NUM_CPU=$(grep "processor" /proc/cpuinfo | sort -r | sed q | awk '{print $3}') ; TOTAL_CPU=$((`expr $NUM_CPU + 1`)) ; echo $TOTAL_CPU

================

Awọn ohun kohun fun Sipiyu:

NUCLEO_CPU=$(grep "cpu cores" /proc/cpuinfo | sed q | awk '{print $4}') ; echo $NUCLEO_CPU

==========================

Lapapọ Awọn ohun kohun fun awọn Sipiyu:

NUM_CPU=$(grep "processor" /proc/cpuinfo | sort -r | sed q | awk '{print $3}') ; TOTAL_CPU=$((`expr $NUM_CPU + 1`)) ; NUCLEO_CPU=$(grep "cpu cores" /proc/cpuinfo | sed q | awk '{print $4}') ; TOTAL_NUCLEO_CPU=$((`expr $TOTAL_CPU \* $NUCLEO_CPU`)) ; echo $TOTAL_NUCLEO_CPU

====================

Sipiyu kaṣe iranti:

CACHE_CPU=$(grep "cache size" /proc/cpuinfo | sed q | cut -d ":" -f 2 | awk '{print $0}') ; echo $CACHE_CPU

Mo nireti pe awọn ọmọ kekere wọnyi "Awọn imọran" jẹ ki o rọrun fun wọn lati ṣe awọn ipilẹ ti o dara ṣugbọn ti o wulo, eyiti o wa ni apapọ nikan fun awọn amoye ni Imọ-ẹrọ, Iṣiro, Sọfitiwia ọfẹ ati GNU / Linux.

AWO IWE

jalbert: bash - Konsole_008

jalbert: bash - Konsole_009

ÌREMNT:: Ti eyikeyi laini aṣẹ ba kuna lati ṣe tabi ṣe afihan iye ti o tọ, rii daju lati fi ọwọ ṣe idanwo apakan kọọkan ti aṣẹ aṣẹ lati gbiyanju ati ṣatunṣe awọn iye tabi sintasi ti diẹ ninu awọn oniyipada.


Awọn akoonu ti nkan naa faramọ awọn ilana wa ti awọn ilana olootu. Lati jabo aṣiṣe kan tẹ nibi.

Awọn asọye 7, fi tirẹ silẹ

Fi ọrọ rẹ silẹ

Adirẹsi imeeli rẹ yoo ko le ṣe atejade. O beere aaye ti wa ni samisi pẹlu *

*

*

  1. Lodidi fun data naa: Miguel Ángel Gatón
  2. Idi ti data naa: SPAM Iṣakoso, iṣakoso ọrọ asọye.
  3. Ofin: Iyọọda rẹ
  4. Ibaraẹnisọrọ data: Awọn data kii yoo ni ifọrọhan si awọn ẹgbẹ kẹta ayafi nipasẹ ọranyan ofin.
  5. Ibi ipamọ data: Alaye data ti o gbalejo nipasẹ Awọn nẹtiwọọki Occentus (EU)
  6. Awọn ẹtọ: Ni eyikeyi akoko o le ni opin, gba pada ki o paarẹ alaye rẹ.

  1. Mo ṣeun pupọ.

    Gan wulo.

  2.   HO2Gi wi

    O dara pupọ o ṣeun.

  3. Idunnu lati ṣepọ! Laipẹ Emi yoo gbe ọpọlọpọ diẹ sii lori lilo Ikọwe ikarahun ni awọn ọran ti o wulo pupọ.

  4.   cr0t0 wi

    Onimọ-ẹrọ ti o dara pupọ! Ireti pe awọn nkan Mimọ Ikarahun Shell diẹ sii.

  5.   Francisco Tovar wi

    Awọn aṣẹ ti o han nibẹ ni o dara julọ ati wulo pupọ.

  6.   userarch wi

    O ṣeun fun alaye ti o niyelori; ṣugbọn ninu ọran mi diẹ ninu awọn ofin ko fun abajade ti a reti, fun apẹẹrẹ aṣẹ “tani” ati “w” maṣe fi ohunkohun han; Eyi ti ṣẹlẹ si mi niwon Mo ṣe diẹ ninu imudojuiwọn eto (Mo lo archlinux pẹlu oluṣakoso iboju "lxdm" ati ayika ayaworan "xfce 4.12"). Eyikeyi imọran kini o ṣẹlẹ (abajade jẹ kanna paapaa ti Mo lo gbongbo olumulo).
    O ṣeun

  7. Wọn yoo fẹran Eto amoye ti a ṣe pẹlu Ikarahun Ikarahun pe lori ibeere yoo ṣe agbejade isediwon ti gbogbo awọn ipele ti eto ni irisi Ijabọ kan.

    Apẹẹrẹ ti kini o le ṣe pẹlu Ikarahun Shell:

    Iboju Idanwo LPI-SB8Cast (LINUX POST INSTALL - SCRIPT BICENTENARIO 8.0.0)
    (lpi_sb8_adecuación-audiovisual_2016.sh / 43Kb)

    Wo Iboju iboju: https://www.youtube.com/watch?v=cWpVQcbgCyY