Bash-Abfragen für alles Mögliche: Unterschied zwischen den Versionen
DG5MGJ (Diskussion | Beiträge) (→Memory) |
DG5MGJ (Diskussion | Beiträge) |
||
| Zeile 90: | Zeile 90: | ||
/dev/sda6: UUID="23090bf2-b747-4048-9b03-544ddbab9eb2" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="home" PARTUUID="251a8385-451c-4915-be64-42b2777a35ba" | /dev/sda6: UUID="23090bf2-b747-4048-9b03-544ddbab9eb2" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="home" PARTUUID="251a8385-451c-4915-be64-42b2777a35ba" | ||
| + | Welche Typ von Festplatte ist verbaut und wie sind die Daten organisiert | ||
| + | $ sudo fdisk -l -u /dev/sdb | ||
| + | Festplatte /dev/sdb: 1,82 TiB, 2000398934016 Bytes, 3907029168 Sektoren | ||
| + | Festplattenmodell: ST2000LX001-1RG1 | ||
| + | Einheiten: Sektoren von 1 * 512 = 512 Bytes | ||
| + | Sektorgröße (logisch/physikalisch): 512 Bytes / 4096 Bytes | ||
| + | E/A-Größe (minimal/optimal): 4096 Bytes / 4096 Bytes | ||
| + | Festplattenbezeichnungstyp: gpt | ||
| + | Festplattenbezeichner: 51C572DD-2585-4665-B097-9A83540278C1 | ||
| + | |||
| + | Gerät Anfang Ende Sektoren Größe Typ | ||
| + | /dev/sdb1 2048 3907028991 3907026944 1,8T Linux-Dateisystem | ||
| − | Wie geht es denn einer bestimmten Festplatte | + | und weitere Informationen zur Hardware |
| + | |||
| + | $ sudo smartctl -i -d scsi /dev/sdb | ||
| + | smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.15.0-112-generic] (local build) | ||
| + | Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org | ||
| + | |||
| + | User Capacity: 2.000.398.934.016 bytes [2,00 TB] | ||
| + | Logical block size: 512 bytes | ||
| + | Physical block size: 4096 bytes | ||
| + | LU is fully provisioned | ||
| + | Rotation Rate: 5400 rpm | ||
| + | Form Factor: 2.5 inches | ||
| + | Logical Unit id: 0x5000c500a955e4e0 | ||
| + | Serial number: WDZ4FEWZ | ||
| + | Device type: disk | ||
| + | Local Time is: Tue Jun 11 17:05:40 2024 CEST | ||
| + | SMART support is: Unavailable - device lacks SMART capability. | ||
| + | |||
| + | hier noch einmal die gezielte Abfrage einer Partition | ||
| + | $ blkid /dev/sdb1 | ||
| + | /dev/sdb1: LABEL="daten" UUID="6eb24451-0ec5-4a0c-bb57-5ea515cf01a4" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="5144b5ca-8634-4dc0-846a-cb291a09e41a" | ||
| + | |||
| + | |||
| + | '''Wie geht es denn einer bestimmten Festplatte''' | ||
$ '''sudo smartctl -A /dev/sdb''' | $ '''sudo smartctl -A /dev/sdb''' | ||
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.15.0-112-generic] (local build) | smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.15.0-112-generic] (local build) | ||
| Zeile 162: | Zeile 197: | ||
30 directories | 30 directories | ||
| − | |||
==Prozesse suchen und anzeigen== | ==Prozesse suchen und anzeigen== | ||
'''Auslastung des Rechners mit Filtermöglichkeiten''' | '''Auslastung des Rechners mit Filtermöglichkeiten''' | ||
Version vom 11. Juni 2024, 16:13 Uhr
Inhaltsverzeichnis
Ein kurzer Griff zum Terminal und schon hat man die Info
Hier liste ich so einige Abfragen auf, welche sicher interessant sind.
Bitte beachten: Wenn eine Befehlszeile mit "$" beginnt, dann ist dies unter einem normalen User ausführbar,
beginnt die Befehlszeile jedoch mit "#", so sind Superuserrechte erforderlich.
Entweder man wechselt mit $ su - in den Superuser root oder man stellt ein $ sudo voran, womit nach Angabe des eigenen Passwortes der Befehl unter SuperUser-Hoheit ausgeführt wird - sofern man dafür berechtigt ist. Siehe auch: https://wiki.ubuntuusers.de/sudo/
Die ersten Zeichen wie "$" oder "#" bitte nicht mitkopieren, diese stellen den Prompt der Shell dar und sind zu obiger Information hier angegeben.
Memory
Welche Memoryausstattung hat mein Rechner und welches Swap wird benutzt?
$ free -h
gesamt benutzt frei gemns. Puffer/Cache verfügbar
Speicher: 15Gi 2,3Gi 9,9Gi 509Mi 3,3Gi 12Gi
Auslager: 23Gi 0B 23Gi
Der Parameter -h lässt die Werte in lesbarer Form (--human) anzeigen
$ swapon -s Filename Type Size Used Priority /dev/sda1 partition 25165820 0 -2
Der Parameter -s (--summary) zeigt diese Auswertung an
Informationen in tabelarischer Form bekommt man mit:
$ less /proc/meminfo
Damit kann man auch gezielt Werte mit grep herausgreifen.
CPU
Was läuft denn für eine CPU und wie viele Kerne und Threds hat diese
$ sed -n '/model name/p' /proc/cpuinfo | sort -u model name : Intel(R) Core(TM) i7-4710MQ CPU @ 2.50GHz
Es werden alle "Modellnamen aus der Liste geholt und dann mit sort vereinzelt.
Genauere Informationen zum ersten Prozessorkern
$ sed -n '1,/^$/p' /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 60 model name : Intel(R) Core(TM) i7-4710MQ CPU @ 2.50GHz stepping : 3 microcode : 0x28 cpu MHz : 800.000 cache size : 6144 KB physical id : 0 siblings : 8 core id : 0 cpu cores : 4 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fm cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt dtherm ida arat pln pts md_clear flush_l1d vmx flags : vnmi preemption_timer invvpid ept_x_only ept_ad ept_1gb flexpriority tsc_offset vtpr mtf vapic ept vpid unrestricted_guest ple bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit srbds mmio_unknown bogomips : 4988.44 clflush size : 64 cache_alignment : 64 address sizes : 39 bits physical, 48 bits virtual power management:
Alle Informationen zu allen Prozessorkernen bekommt man mit less /proc/cpuinfo
Festplatte und SSD
Welche Festplatten sind vorhanden und welche Partitionen sind darauf
$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS sda 8:0 0 953,9G 0 disk ├─sda1 8:1 0 24G 0 part [SWAP] ├─sda2 8:2 0 128M 0 part /boot/efi ├─sda3 8:3 0 52G 0 part ├─sda4 8:4 0 52G 0 part ├─sda5 8:5 0 128G 0 part / └─sda6 8:6 0 697,7G 0 part /home sdb 8:16 0 1,8T 0 disk └─sdb1 8:17 0 1,8T 0 part /data sr0 11:0 1 1024M 0 rom
Welchen Label und UUID haben diese Partitionen
$ blkid /dev/sdb1: LABEL="daten" UUID="6eb24451-0ec5-4a0c-bb57-5ea515cf01a4" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="5144b5ca-8634-4dc0-846a-cb291a09e41a" /dev/sda4: LABEL="home-alt" UUID="53286760-5dcc-41c5-b29e-de5576491656" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="home-alt" PARTUUID="13ef0d09-126c-4d1c-af8a-9133b96689f4" /dev/sda2: LABEL_FATBOOT="EFI" LABEL="EFI" UUID="2547-1779" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="ba4c278c-13a1-48b9-b801-0e81176a8c6e" /dev/sda5: UUID="78b49306-74c5-4e07-a19b-cc92bb153736" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="root" PARTUUID="548eccf0-7d6c-464a-988a-0b435eb1a26e" /dev/sda3: UUID="63e7caac-d7bc-447b-a6a0-ec7365524d9c" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="root-alt" PARTUUID="5cb81689-d726-4990-9fdd-51d777be9198" /dev/sda1: UUID="bf1d7fde-24ca-4e27-bf94-4261e85dd6b2" TYPE="swap" PARTUUID="781d2d5d-a8b7-4dd8-930c-f593ebfd401f" /dev/sda6: UUID="23090bf2-b747-4048-9b03-544ddbab9eb2" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="home" PARTUUID="251a8385-451c-4915-be64-42b2777a35ba"
Welche Typ von Festplatte ist verbaut und wie sind die Daten organisiert
$ sudo fdisk -l -u /dev/sdb Festplatte /dev/sdb: 1,82 TiB, 2000398934016 Bytes, 3907029168 Sektoren Festplattenmodell: ST2000LX001-1RG1 Einheiten: Sektoren von 1 * 512 = 512 Bytes Sektorgröße (logisch/physikalisch): 512 Bytes / 4096 Bytes E/A-Größe (minimal/optimal): 4096 Bytes / 4096 Bytes Festplattenbezeichnungstyp: gpt Festplattenbezeichner: 51C572DD-2585-4665-B097-9A83540278C1 Gerät Anfang Ende Sektoren Größe Typ /dev/sdb1 2048 3907028991 3907026944 1,8T Linux-Dateisystem
und weitere Informationen zur Hardware
$ sudo smartctl -i -d scsi /dev/sdb smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.15.0-112-generic] (local build) Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org User Capacity: 2.000.398.934.016 bytes [2,00 TB] Logical block size: 512 bytes Physical block size: 4096 bytes LU is fully provisioned Rotation Rate: 5400 rpm Form Factor: 2.5 inches Logical Unit id: 0x5000c500a955e4e0 Serial number: WDZ4FEWZ Device type: disk Local Time is: Tue Jun 11 17:05:40 2024 CEST SMART support is: Unavailable - device lacks SMART capability.
hier noch einmal die gezielte Abfrage einer Partition
$ blkid /dev/sdb1 /dev/sdb1: LABEL="daten" UUID="6eb24451-0ec5-4a0c-bb57-5ea515cf01a4" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="5144b5ca-8634-4dc0-846a-cb291a09e41a"
Wie geht es denn einer bestimmten Festplatte
$ sudo smartctl -A /dev/sdb smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.15.0-112-generic] (local build) Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org === START OF READ SMART DATA SECTION === SMART Attributes Data Structure revision number: 10 Vendor Specific SMART Attributes with Thresholds: ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE 1 Raw_Read_Error_Rate 0x000f 079 064 006 Pre-fail Always - 72944751 3 Spin_Up_Time 0x0003 099 099 000 Pre-fail Always - 0 4 Start_Stop_Count 0x0032 077 077 020 Old_age Always - 23958 5 Reallocated_Sector_Ct 0x0033 100 100 036 Pre-fail Always - 2 7 Seek_Error_Rate 0x000f 083 060 045 Pre-fail Always - 4483255039 9 Power_On_Hours 0x0032 070 070 000 Old_age Always - 26663 (227 39 0) 10 Spin_Retry_Count 0x0013 100 100 097 Pre-fail Always - 0 12 Power_Cycle_Count 0x0032 092 092 020 Old_age Always - 8660 184 End-to-End_Error 0x0032 100 100 099 Old_age Always - 0 187 Reported_Uncorrect 0x0032 100 100 000 Old_age Always - 0 188 Command_Timeout 0x0032 100 099 000 Old_age Always - 13 189 High_Fly_Writes 0x003a 100 100 000 Old_age Always - 0 190 Airflow_Temperature_Cel 0x0022 071 037 040 Old_age Always In_the_past 29 (0 130 31 28 0) 191 G-Sense_Error_Rate 0x0032 100 100 000 Old_age Always - 45 192 Power-Off_Retract_Count 0x0032 100 100 000 Old_age Always - 75 193 Load_Cycle_Count 0x0032 087 087 000 Old_age Always - 26975 194 Temperature_Celsius 0x0022 029 063 000 Old_age Always - 29 (0 15 0 0 0) 197 Current_Pending_Sector 0x0012 100 100 000 Old_age Always - 0 198 Offline_Uncorrectable 0x0010 100 100 000 Old_age Offline - 0 199 UDMA_CRC_Error_Count 0x003e 200 200 000 Old_age Always - 0 240 Head_Flying_Hours 0x0000 100 253 000 Old_age Offline - 19670h+56m+08.684s 241 Total_LBAs_Written 0x0000 100 253 000 Old_age Offline - 56645851929 242 Total_LBAs_Read 0x0000 100 253 000 Old_age Offline - 72661152743 254 Free_Fall_Sensor 0x0032 100 100 000 Old_age Always - 0
Inhalt auf Festplatten
Welche Pfade sind denn auf meiner Festplatte (begrenzte Anzeige)
$ tree -dlL 2 /home
/home
├── Backup
│ ├── TuxedoI7_2023-02-12
│ ├── TuxedoI7_2023-02-21
│ └── TuxedoI7_2023-03-07
├── lost+found [error opening dir]
├── rudi
│ ├── Bilder
│ ├── Dokumente
│ ├── Downloads
│ ├── dwhelper
│ ├── EXPORTS
│ ├── Grub-Themen
│ ├── logfiles -> /data/logfiles
│ ├── Musik
│ ├── Öffentlich
│ ├── Old Firefox Data
│ ├── PlayOnLinux's virtual drives -> /home/rudi/.PlayOnLinux//wineprefix/
│ ├── Rudi_hilf_mir
│ ├── Schreibtisch
│ ├── Videos
│ ├── Vorlagen
│ └── Warpinator
└── timeshift
├── snapshots
├── snapshots-boot
├── snapshots-daily
├── snapshots-hourly
├── snapshots-monthly
├── snapshots-ondemand
└── snapshots-weekly
30 directories
Prozesse suchen und anzeigen
Auslastung des Rechners mit Filtermöglichkeiten
$ htop
... zeigt wie top die vorhandenen Prozesse an, bietet aber bessere Auswahlmöglichkeiten
installieren mit $ sudo apt-get install htop
aktive Jobs aus der crontab anzeigen
$ crontab -l | grep -v '^#'
Bei dieser Anzeige werden alle Kommentare ausgeblendet
Prozesse des crond anzeigen - laufende crontab-Jobs
$ pstree -pa `pgrep cron` cron,950 -f -P
Aktuell kein laufender Cron-Job. Ansonsten wird der komplette Prozessbaum angezeigt.