Connect with us

Linux

i comandi ls* sono ancora più utili di quanto si possa pensare


ETutto è un file sotto Linux e ls* e gli amici possono aiutarti a estrarre più informazioni dal sistema di quanto pensassi inizialmente. Questi suggerimenti su Linux possono tornare utili quando hai bisogno di trovare informazioni rapidamente senza passare attraverso /proc o sysfs.

#1: lsscsi

Vedi l’elenco dei dispositivi SCSI (o host) e dei loro attributi nei sistemi operativi Linux:
$ lsscsi -g
Uscite di esempio:


[0:0:0:0]    disk    Adaptec  RAID1-A          V1.0  /dev/sda   /dev/sg0
[0:1:0:0]    disk    SEAGATE  ST373455SS       0006  -         /dev/sg1
[0:1:1:0]    disk    SEAGATE  ST373455SS       0006  -         /dev/sg2
[1:0:0:0]    cd/dvd  TEAC     DV-28E-R         1.8A  /dev/sr0   /dev/sg3

#2: lsblk

Usa questo comando per elencare i dispositivi di blocco
# lsblk
Uscite di esempio:


NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    1  68.3G  0 disk 
├─sda1   8:1    1   716M  0 part /boot
├─sda2   8:2    1     8G  0 part [SWAP]
└─sda3   8:3    1  59.6G  0 part /
sr0     11:0    1  1024M  0 rom  

Per vedere il tipo di file system:
# lsblk -f
Uscite di esempio:


NAME   FSTYPE LABEL MOUNTPOINT
sda                 
├─sda1 ext2         /boot
├─sda2 swap         [SWAP]
└─sda3 ext4         /
sr0                 

Per generare informazioni sui permessi:
# lsblk -m
Uscite di esempio:

NAME     SIZE OWNER GROUP MODE
sda     68.3G root  disk  brw-rw----
├─sda1   716M root  disk  brw-rw----
├─sda2     8G root  disk  brw-rw----
└─sda3  59.6G root  disk  brw-rw----
sr0     1024M root  cdrom brw-rw----

#3: lsb_release

Usa questo comando per vedere le informazioni specifiche della distribuzione Linux, inserisci:
# lsb_release
# lsb_release -a

Uscite di esempio:


LSB Version:	:core-4.0-amd64:core-4.0-ia32:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-ia32:printing-4.0-noarch
Distributor ID:	CentOS
Description:	CentOS release 5.8 (Final)
Release:	5.8
Codename:	Final

#4: lsusb

Usa questo comando per vedere i bus USB nel sistema basato su Linux e i dispositivi ad essi collegati:
$ lsusb
Uscite di esempio:

Bus 002 Device 004: ID 045e:00db Microsoft Corp. Natural Ergonomic Keyboard 4000 V1.0
Bus 002 Device 003: ID 046d:c52f Logitech, Inc. Wireless Mouse M305
Bus 002 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 007: ID 413c:8160 Dell Computer Corp. Wireless 365 Bluetooth
Bus 001 Device 006: ID 413c:8162 Dell Computer Corp. Integrated Touchpad [Synaptics]
Bus 001 Device 005: ID 413c:8161 Dell Computer Corp. Integrated Keyboard
Bus 001 Device 004: ID 0a5c:4500 Broadcom Corp. BCM2046B1 USB 2.0 Hub (part of BCM2046 Bluetooth)
Bus 001 Device 003: ID 0a5c:5800 Broadcom Corp. BCM5880 Secure Applications Processor
Bus 001 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

#5: lscpu

Il comando lscpu mostra informazioni sull’architettura della CPU come numero di CPU, thread, core e molto altro sotto Linux:
$ lscpu
Uscite di esempio:

Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
CPU(s):                8
Thread(s) per core:    2
Core(s) per socket:    4
CPU socket(s):         1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 30
Stepping:              5
CPU MHz:               1199.000
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              8192K

#6: lspci

Il comando lspci mostra informazioni sui bus PCI nel sistema e sui dispositivi ad essi collegati:
$ lspci
Uscite di esempio:


00:00.0 Host bridge: VIA Technologies, Inc. VX800 Host Bridge (rev 14)
00:00.1 Host bridge: VIA Technologies, Inc. VX800/VX820 Error Reporting
00:00.2 Host bridge: VIA Technologies, Inc. VX800/VX820 Host Bus Control
00:00.3 Host bridge: VIA Technologies, Inc. VX800 PCI to PCI Bridge
00:00.4 Host bridge: VIA Technologies, Inc. VX800/VX820 Power Management Control
00:00.5 PIC: VIA Technologies, Inc. VX800/VX820 APIC and Central Traffic Control
00:00.6 Host bridge: VIA Technologies, Inc. VX800/VX820 Scratch Registers
00:00.7 Host bridge: VIA Technologies, Inc. VX800/VX820 North-South Module Interface Control
00:01.0 VGA compatible controller: VIA Technologies, Inc. VX800/VX820 Chrome 9 HC3 Integrated Graphics (rev 11)
00:02.0 PCI bridge: VIA Technologies, Inc. VX800/VX820 PCI Express Root Port
00:03.0 PCI bridge: VIA Technologies, Inc. VX800/VX820 PCI Express Root Port
00:03.1 PCI bridge: VIA Technologies, Inc. VX800/VX820 PCI Express Root Port
00:0f.0 IDE interface: VIA Technologies, Inc. VX800 Serial ATA and EIDE Controller
00:10.0 USB controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev a0)
00:10.1 USB controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev a0)
00:10.2 USB controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev a0)
00:10.4 USB controller: VIA Technologies, Inc. USB 2.0 (rev 90)
00:11.0 ISA bridge: VIA Technologies, Inc. VX800/VX820 Bus Control and Power Management
00:11.7 Host bridge: VIA Technologies, Inc. VX8xx South-North Module Interface Control
00:13.0 PCI bridge: VIA Technologies, Inc. VX855/VX875/VX900 PCI to PCI Bridge
02:00.0 Ethernet controller: VIA Technologies, Inc. VT6120/VT6121/VT6122 Gigabit Ethernet Adapter (rev 82)
03:00.0 Ethernet controller: VIA Technologies, Inc. VT6120/VT6121/VT6122 Gigabit Ethernet Adapter (rev 82)

Il comando lspci può essere utilizzato per scoprire se un determinato hardware PCI è supportato dal kernel Linux attualmente in esecuzione. In questo esempio scopri se il controller Ethernet VT6120/VT6121/VT6122 di VIA Technologies è supportato o meno:
# lspci | grep VT6120
Uscite di esempio:
02:00.0 Ethernet controller: VIA Technologies, Inc. VT6120/VT6121/VT6122 Gigabit Ethernet Adapter (rev 82)
03:00.0 Ethernet controller: VIA Technologies, Inc. VT6120/VT6121/VT6122 Gigabit Ethernet Adapter (rev 82)

l identificatore nel primo campo 02:00.0 e 03:00.0. Ora usa il lspci -n come segue per ottenere il risultato per il dispositivo 02:00.0 e 03:00.0:
# lspci -n | grep '0[2|3]:00.0'
Uscite di esempio:

Guide solo per i sostenitori di Patreon ????

  • Nessuna pubblicità e tracciamento
  • Guide approfondite per sviluppatori e amministratori di sistema su Opensourceflare✨
  • Unisciti al mio Patreon per supportare i creatori di contenuti indipendenti e iniziare a leggere le ultime guide:

Aderire Patreon ?

02:00.0 0200: 1106:3119 (rev 82)
03:00.0 0200: 1106:3119 (rev 82)

Utilizzare l’ID modello #3119 per cercare il driver, come segue:
# grep 3119 /lib/modules/$(uname -r)/modules.alias
Uscite di esempio:

alias pci:v00001106d00003119sv*sd*bc*sc*i* via_velocity

È necessario utilizzare il driver via_velocity per l’adattatore Ethernet Gigabit della famiglia di velocità di rete VIA:
# modinfo via_velocity
Uscite di esempio:


filename:       /lib/modules/2.6.32-5-amd64/kernel/drivers/net/via-velocity.ko
description:    VIA Networking Velocity Family Gigabit Ethernet Adapter Driver
license:        GPL
author:         VIA Networking Technologies, Inc.
alias:          pci:v00001106d00003119sv*sd*bc*sc*i*
depends:        crc-ccitt
vermagic:       2.6.32-5-amd64 SMP mod_unload modversions 
parm:           RxDescriptors:Number of receive descriptors (array of int)
parm:           TxDescriptors:Number of transmit descriptors (array of int)
parm:           rx_thresh:Receive fifo threshold (array of int)
parm:           DMA_length:DMA length (array of int)
parm:           IP_byte_align:Enable IP header dword aligned (array of int)
parm:           txcsum_offload:Enable transmit packet checksum offload (array of int)
parm:           flow_control:Enable flow control ability (array of int)
parm:           speed_duplex:Setting the speed and duplex mode (array of int)
parm:           ValPktLen:Receiving or Drop invalid 802.3 frame (array of int)
parm:           wol_opts:Wake On Lan options (array of int)
parm:           int_works:Number of packets per interrupt services (array of int)
parm:           rx_copybreak:Copy breakpoint for copy-only-tiny-frames (int)

#7: lshw / lshw-gtk

Il comando lshw trova informazioni dettagliate sulla configurazione hardware del server o della macchina:

lshw
 
### See hardware in a compact format##
lshw -short
 
###  Only see disks and storage controllers in the system ###
lshw -class disk -class storage
 
### Only show all network interfaces in HTML fomrat ###
lshw -html -class network
 
## Graphical information about hardware configuration ###
lshw-gtk

Esempi di output (presi da lshw -breve comando):

Fig.01: lshw in azione

Guarda come usare il comando lshw per trovare maggiori informazioni su disco rigido, velocità della ram, dispositivi PCI e molto altro. Puoi anche utilizzare questi comandi Linux che raccolgono informazioni su un sistema e hardware Linux.

#8: ls

Usa il comando ls per elencare il contenuto della directory:

 ## common examples of ls, see man page more info ##
ls
ls -l ## long format 
ls -F ## appends a character revealing the nature of a file
ls -a ## Show all files including hidden files
ls -R ## recursively lists subdirectories
ls -d ## Get info about a symbolic link or directory
ls -t ## Sort the list of files by modification time
ls -h ## Show sizes in human readable format
ls -B ## In directories, ignore files that end with ‘~’ (backup files)
ls -Z ## Display the SELinux security context
ls --group-directories-first -l ## Show directories first (group directories). Useful on server.
ls --color ##  Colorize the ls output 
ls --hide='*.txt' -l ## Hide or  ignore files whose names ends with .txt

#9: lsof

Usa questo comando per elencare file aperti, porte di rete, processi attivi e molto altro:

 ### command lsof command examples ##
lsof | less # List all open file
lsof -u vivek -i # See all files  opened by user "vivek"
lsof -i 4 -a -p 7007 # List all open IPv4 network files in use by the process whose PID is 7007
lsof -i TCP:80  # Find process running on tcp port 80
lsof -i 6 # List only open IPv6 network files
lsof -i 4 # List only open IPv4 network files
lsof -i TCP:1-1024 # List process open in port range 1 to 1024
lsof -i @server1.cyberciti.biz:2000-2005 # List all files using any protocol on ports 2000 to 2005 of host server1.cyberciti.biz, use:              
lsof /dev/sr0 # List all open files on device /dev/sr0
lsof /dev/dvd # Find out why my DVD drive does not eject?
lsof -i -u^root # See all files open by all users except root
lsof /etc/foobar # Find out who's looking at the /etc/foobar file?

#10: lsattr

Utilizzare lsattr per elencare gli attributi del file su un secondo file system esteso. Non riesci a modificare o eliminare il file anche se sei root? Usa lsattr per elencare il file:
$ lsattr /etc/passwd
Uscite di esempio:

------------------- /etc/passwd

Usa il comando chattr per scrivere i file di protezione sotto il sistema operativo Linux:
# echo 'Test' > foobar
# chattr +i foobar
# lsattr foobar

Uscite di esempio:

----i-------------- foobar

Prova a rimuovere (eliminare) foobar come utente root:
# rm foobar
Uscite di esempio:

rm: cannot remove `foobar': Operation not permitted

Rimuovi la capacità IMMUTABILE cioè il file non può essere modificato: non può essere cancellato o rinominato, nessun collegamento può essere creato a questo file e nessun dato può essere scritto nel file:
# chattr -i foobar

#11: lshal

Utilizzare il comando lshal per visualizzare gli elementi nel database del dispositivo HAL (Hardware Abstraction Layer). HAL fornisce alle applicazioni un modo semplice per scoprire l’hardware sul sistema:
# lshal | less
### get info about your hardware
# lshal -u /org/freedesktop/Hal/devices/computer

Uscite di esempio:

udi = '/org/freedesktop/Hal/devices/computer'
  info.addons = {'hald-addon-cpufreq', 'hald-addon-acpi'} (string list)
  info.callouts.add = {'hal-storage-cleanup-all-mountpoints'} (string list)
  info.interfaces = {'org.freedesktop.Hal.Device.SystemPowerManagement'} (string list)
  info.product="Computer"  (string)
  info.subsystem = 'unknown'  (string)
  info.udi = '/org/freedesktop/Hal/devices/computer'  (string)
  org.freedesktop.Hal.Device.SystemPowerManagement.method_argnames = {'num_seconds_to_sleep', 'num_seconds_to_sleep', '', '', '', 'enable_power_save'} (string list)
  org.freedesktop.Hal.Device.SystemPowerManagement.method_execpaths = {'hal-system-power-suspend', 'hal-system-power-suspend-hybrid', 'hal-system-power-hibernate', 'hal-system-power-shutdown', 'hal-system-power-reboot', 'hal-system-power-set-power-save'} (string list)
  org.freedesktop.Hal.Device.SystemPowerManagement.method_names = {'Suspend', 'SuspendHybrid', 'Hibernate', 'Shutdown', 'Reboot', 'SetPowerSave'} (string list)
  org.freedesktop.Hal.Device.SystemPowerManagement.method_signatures = {'i', 'i', '', '', '', 'b'} (string list)
  org.freedesktop.Hal.version = '0.5.14'  (string)
  org.freedesktop.Hal.version.major = 0  (0x0)  (int)
  org.freedesktop.Hal.version.micro = 14  (0xe)  (int)
  org.freedesktop.Hal.version.minor = 5  (0x5)  (int)
  power_management.acpi.linux.version = '20110623'  (string)
  power_management.can_hibernate = true  (bool)
  power_management.can_suspend = true  (bool)
  power_management.can_suspend_hybrid = true  (bool)
  power_management.is_powersave_set = false  (bool)
  power_management.quirk.dpms_on = true  (bool)
  power_management.quirk.vbe_post = true  (bool)
  power_management.type="acpi"  (string)
  system.board.product="0R1203"  (string)
  system.board.serial=".XXXXXXX.CN4864304M0335."  (string)
  system.board.vendor="Dell Inc."  (string)
  system.board.version = ''  (string)
  system.chassis.manufacturer="Dell Inc."  (string)
  system.chassis.type="Portable"  (string)
  system.firmware.release_date="12/06/2011"  (string)
  system.firmware.vendor="Dell Inc."  (string)
  system.firmware.version = 'A08'  (string)
  system.formfactor="laptop"  (string)
  system.hardware.primary_video.product = 1567  (0x61f)  (int)
  system.hardware.primary_video.vendor = 4318  (0x10de)  (int)
  system.hardware.product="Precision M6500"  (string)
  system.hardware.serial="XXXXXXX"  (string)
  system.hardware.uuid = 'ZZZZC-XXXXXXX-104C-XXXXXXX-YYYYY'  (string)
  system.hardware.vendor="Dell Inc."  (string)
  system.hardware.version = ''  (string)
  system.kernel.machine="x86_64"  (string)
  system.kernel.name="Linux"  (string)
  system.kernel.version = '3.2.0-0.bpo.1-amd64'  (string)
  system.kernel.version.major = 3  (0x3)  (int)
  system.kernel.version.micro = 0  (0x0)  (int)
  system.kernel.version.minor = 2  (0x2)  (int)

#12: lsinitramfs

Usa questo comando per mostrare il contenuto di determinate immagini initramfs. Consente di controllare rapidamente il contenuto di uno (o più) file initramfs specificati. Questo è utile per scoprire se un determinato driver (come il driver del dispositivo RAID) è incluso o meno nelle immagini initramfs:

# See initramfs content of current running Linux kernel
lsinitramfs /boot/initrd.img-$(uname -r) 
 
## See if nvme driver included or not using the [nixcmd name="grep"] ##</small>
lsinitramfs /boot/initrd.img-$(uname -r) | grep nvme
 
## long and verbose mode ##
lsinitramfs -l /boot/initrd.img-$(uname -r)
 
# Find out if transparent encryption / decryption driver included or not
lsinitramfs /boot/initrd.img-$(uname -r) | grep 'dm-'

Output di esempio (significa che posso crittografare l’intero disco rigido sotto Linux e il supporto incluso al momento dell’avvio):


lib/modules/2.6.32-5-amd64/kernel/drivers/md/dm-snapshot.ko
lib/modules/2.6.32-5-amd64/kernel/drivers/md/dm-crypt.ko
lib/modules/2.6.32-5-amd64/kernel/drivers/md/dm-mirror.ko
lib/modules/2.6.32-5-amd64/kernel/drivers/md/dm-region-hash.ko
lib/modules/2.6.32-5-amd64/kernel/drivers/md/dm-mod.ko
lib/modules/2.6.32-5-amd64/kernel/drivers/md/dm-log.ko

#13: lsmod

Usa questo comando per elencare tutti i driver di dispositivo caricati attualmente nel kernel Linux:
# lsmod
Output di esempio (presi dal mio router Asus RT-16 in esecuzione su firmware Tomato open source)


Module                  Size  Used by    Tainted: P  
ohci_hcd               21552  0 
ehci_hcd               40752  0 
ext2                   67712  0 
ext3                  136576  0 
jbd                    62080  1 ext3
mbcache                 7280  2 ext2,ext3
usb_storage            50048  0 
sd_mod                 27440  0 
scsi_wait_scan           960  0 
scsi_mod              105376  3 usb_storage,sd_mod,scsi_wait_scan
usbcore               147344  4 ohci_hcd,ehci_hcd,usb_storage
nf_nat_pptp             2592  0 
nf_conntrack_pptp       6000  1 nf_nat_pptp
nf_nat_proto_gre        2128  1 nf_nat_pptp
nf_conntrack_proto_gre     4160  1 nf_conntrack_pptp
wl                   1884144  0 
igs                    17936  1 wl
emf                    22720  2 wl,igs
et                     59744  0 

Per scoprire se stai eseguendo il modulo chiamato ath_pci, inserisci (verifica che il modulo sia caricato per un determinato dispositivo):
# lsmod | grep ath_pci

#14: lspcmcia

Vedere le informazioni sui socket PCMCIA e sui dispositivi presenti nel sistema alimentato da Linux:
# lspcmcia
Uscite di esempio:

Socket 0 Bridge:   	[yenta_cardbus] 	(bus ID: 0000:03:01.0)

#15: lswm

Usa questo comando per scoprire nuovi wiimote (Wii Remote), il controller principale per la console Wii di Nintendo. Può essere usato con X per controllare il cursore e molto altro:
# lswm

#16: lsdvd

Utilizzare questo comando per leggere i contenuti di un DVD e stampare i contenuti sul display e scaricarli per un’ulteriore elaborazione in applicazioni esterne.

lsdvd     # Default output, show info in human readable 
lsdvd -a  # See information about audio streams
lsdvd -c  # See chapter information
lsdvd -s  # See subpicture information (e.g. subtitles)
lsdvd -s -t track-number
lsdvd -a -t 1

Uscite di esempio:


libdvdread: Using libdvdcss version 1.2.10 for DVD access
Disc Title: DVD_VIDEO
Title: 01, Length: 00:22:01.000 Chapters: 06, Cells: 06, Audio streams: 04, Subpictures: 21
	Audio: 1, Language: en - English, Format: ac3, Frequency: 48000, Quantization: drc, Channels: 2, AP: 0, Content: Undefined, Stream id: 0x80
	Audio: 2, Language: fr - Francais, Format: ac3, Frequency: 48000, Quantization: drc, Channels: 2, AP: 0, Content: Undefined, Stream id: 0x81
	Audio: 3, Language: de - Deutsch, Format: ac3, Frequency: 48000, Quantization: drc, Channels: 2, AP: 0, Content: Undefined, Stream id: 0x82
	Audio: 4, Language: en - English, Format: ac3, Frequency: 48000, Quantization: drc, Channels: 2, AP: 0, Content: Undefined, Stream id: 0x83

Puoi usare mplayer per riprodurre dvd:
$ mplayer dvd://1 -dvd-device /dev/dvd

#17: lslk

Utilizzare questo comando per elencare tutti i blocchi associati ai file locali del sistema:
# lslk
Uscite di esempio:


SRC            PID   DEV     INUM        SZ TY M         ST WH        END LEN NAME
portmap       1354 254,1  4309006         5  w 0          0  0          0   0 /var/run/portmap.pid
atd           2124 254,1  4309014         5  w 0          0  0          0   0 /var/run/atd.pid
mysqld        2404 254,1  6824038   5242880  w 0          0  0          0   0 /var/lib/mysql/ib_logfile1
mysqld        2404 254,1  6824037   5242880  w 0          0  0          0   0 /var/lib/mysql/ib_logfile0
mysqld        2404 254,1  6824036  27262976  w 0          0  0          0   0 /var/lib/mysql/ibdata1
(unknown)     2807 254,1  4309033            w 0          0  0          0   0 / (rootfs)
compiz        3398 254,1  7815224     81090  w 0          0  0          0   0 /home/vivek/.nv/GLCache/a147bc5d819e1646d5baf3c8f0a017e4/8bdcca7527c339d4/736353d788902c9e.bin
compiz        3398 254,1  7815223      7668  w 0          0  0          0   0 /home/vivek/.nv/GLCache/a147bc5d819e1646d5baf3c8f0a017e4/8bdcca7527c339d4/736353d788902c9e.toc
python        3427 254,1  4030467         0  w 0          0  0          0   0 /home/vivek/.hplip/hp-systray.lock
chrome        3567 254,1  3956948     12288  w 0 1073741824  0 1073742335   0 /home/vivek/.config/google-chrome/Default/Login Data
chrome        3567 254,1  3957700 135782400  w 0 1073741824  0 1073742335   0 /home/vivek/.config/google-chrome/Default/History Index 2012-06
chrome        3567 254,1  3957049 120713216  w 0 1073741824  0 1073742335   0 /home/vivek/.config/google-chrome/Default/History Index 2012-07
chrome        3567 254,1  3956937  15605760  w 0 1073741824  0 1073742335   0 /home/vivek/.config/google-chrome/Default/Favicons
chrome        3567 254,1  3957883   1155072  w 0 1073741824  0 1073742335   0 /home/vivek/.config/google-chrome/Default/Shortcuts
chrome        3567 254,1  3957138  61657088  w 0 1073741824  0 1073742335   0 /home/vivek/.config/google-chrome/Default/History Index 2012-08
chrome        3567 254,1  3956932  24100864  w 0 1073741824  0 1073742335   0 /home/vivek/.config/google-chrome/Default/History
chrome        3567 254,1  3957892   3702784  w 0 1073741824  0 1073742335   0 /home/vivek/.config/google-chrome/Default/Network Action Predictor
chrome        3567 254,1  3956926    552960  w 0 1073741824  0 1073742335   0 /home/vivek/.config/google-chrome/Default/Web Data
chrome        3567 254,1  3956809     57344  r 0 1073741826  0 1073742335   0 /home/vivek/.config/google-chrome/Default/Archived History
firefox       3575 254,1  3964960    425984  w 0 1073741824  0 1073742335   0 /home/vivek/.mozilla/firefox/j7nk7e8h.default/addons.sqlite
firefox       3575 254,1  3964948   1114112  r 0 1073741826  0 1073742335   0 /home/vivek/.mozilla/firefox/j7nk7e8h.default/extensions.sqlite
firefox       3575 254,1  3973490    983040  r 0 1073741826  0 1073742335   0 /home/vivek/.mozilla/firefox/j7nk7e8h.default/StumbleUpon/user6896004.sqlite
firefox       3575 254,1  8364042     32768  r 0        128  0        128   0 /home/vivek/.mozilla/firefox/j7nk7e8h.default/places.sqlite-shm
firefox       3575 254,1  3964949  20971520  r 0 1073741826  0 1073742335   0 /home/vivek/.mozilla/firefox/j7nk7e8h.default/places.sqlite
firefox       3575 254,1  8364040     32768  r 0        128  0        128   0 /home/vivek/.mozilla/firefox/j7nk7e8h.default/cookies.sqlite-shm
firefox       3575 254,1  3964961   1048576  r 0 1073741826  0 1073742335   0 /home/vivek/.mozilla/firefox/j7nk7e8h.default/cookies.sqlite
firefox       3575 254,1  3964944         0  w 0          0  0          0   0 /home/vivek/.mozilla/firefox/j7nk7e8h.default/.parentlock
chrome        6326 254,1  7815216     88822  w 0          0  0          0   0 /home/vivek/.nv/GLCache/a147bc5d819e1646d5baf3c8f0a017e4/8bdcca7527c339d4/bc35a2d21bc47b1d.bin
chrome        6326 254,1  7815215      2676  w 0          0  0          0   0 /home/vivek/.nv/GLCache/a147bc5d819e1646d5baf3c8f0a017e4/8bdcca7527c339d4/bc35a2d21bc47b1d.toc
transmission 10465 254,1 11468802         0  w 0          0  0          0   0 /home/vivek/.config/transmission/lock

#18: lsmbox

Utilizzare questo comando per visualizzare il numero di messaggi in una casella di posta. È possibile elencare sia i messaggi totali, non letti ma vecchi, sia i nuovi messaggi, per uno o più file della casella di posta:

lsmbox !     # Get information about your inbox
lsmbox spam support family   # Get information about the mailboxes spam, support, and family  
lsmbox ~/foo # Get information about the mailbox foo which resides in your home directory

#19: lscgroup

Utilizzare questo comando per elencare tutti i cgroup (gruppi di controllo) che una funzionalità del kernel Linux consente di limitare, contabilizzare e isolare l’utilizzo delle risorse (come CPU, memoria, I/O del disco, ecc.) dei gruppi di processi.
# lscgroup

#20: lsdiff

Usa questo comando per vedere quali file vengono modificati da una patch. o ordinare l’ordine dei file toccati in una patch, puoi usare:
$ lsdiff patch | sort -u | xargs -rn1 filterdiff patch -i
Per mostrare solo i file aggiunti in una patch:
$ lsdiff -s patch | grep '^+' | cut -c2- | xargs -rn1 filterdiff patch -i
Per mostrare le intestazioni di tutti i blocchi di file:
$ lsdiff -n patch | (while read n file do sed -ne "$n,$(($n+1))p" patch done)

#21: lspst

Utilizzare questo comando per elencare i dati dei file PST (cartelle personali di MS Outlook). Produce un semplice elenco dei dati (contatti, soggetti email, ecc):
$ lspst mypst-file

#22: lsdnssec

Utilizzare il comando lsdnssec per riassumere le informazioni sui file relativi a DNSSEC. Questi file possono essere specificati sulla riga di comando o trovati nelle directory fornite sulla riga di comando. Il flag -d controlla la quantità di dettagli nell’output di lsdnssec.
# lsdnssec file
lsdnssec visualizza le seguenti informazioni su ciascuna zona per la quale raccoglie informazioni:


keys
    Key information is shown about the keys currently in use. A bar graph is included that shows the age of the key with respect to the configured expected key-life time.
    This information is collected from any .krf files lsdnssec finds. 

rolling status
    If any zone keys are being rolled via rollerd, then the status of the rolling state is shown. The time needed to reach the next state is also displayed.
    This information is collected from any .rollrec files found by lsdnssec. 

#23: lsmem

Il comando lsmem elenca gli intervalli di memoria disponibile con il relativo stato in linea. I blocchi di memoria elencati corrispondono alla rappresentazione dei blocchi di memoria in sysfs. La sintassi è:

lsmem
## List each individual memory block ##
lsmem -a
## Print the SIZE column in bytes rather than in a human-readable format ##
lsmem -b

#24: lsdev

Il comando lsdev ottiene informazioni sull’hardware installato del computer dai file interrupt, ioports e dma nella directory /proc, fornendo così una rapida panoramica di quale hardware utilizza quali indirizzi I/O e quali canali IRQ e DMA:

#25: lslock

Vuoi elencare le informazioni su tutti i blocchi di file attualmente detenuti in un sistema Linux? Provare:
lslocks
L’output include i seguenti dati:

  • COMANDO : il nome del comando del processo che mantiene il blocco.
  • PID : L’ID del processo che contiene il blocco o -1 per OFDLCK.
  • GENERE : il tipo di serratura; può essere FLOCK (creato con flock(2)), POSIX (creato con fcntl(2) e lockf(3)) o OFDLCK (creato con fcntl(2).
  • DIMENSIONE : Dimensione del file bloccato.
  • MODALITÀ : I permessi di accesso della serratura (lettura, scrittura). Se il processo è bloccato e in attesa del blocco, la modalità viene preceduta da un ‘*’ (asterisco).
  • m : se il blocco è obbligatorio; 0 significa no (significa che il blocco è solo consultivo), 1 significa sì. (Vedi fcntl(2).)
  • COMINCIARE : Offset di byte relativo del blocco.
  • FINE : Offset finale del blocco.
  • IL PERCORSO : Percorso completo della serratura. Se non ne viene trovato nessuno o non ci sono autorizzazioni per leggere il percorso, tornerà al punto di montaggio del dispositivo e verrà aggiunto “…” al percorso. Il percorso potrebbe essere troncato; usa –notruncate per ottenere il percorso completo.
  • BLOCCANTE : Il PID del processo che blocca il blocco.

#26: lsar

Vuoi visualizzare/elencare i contenuti dei file di archivio? Prova lsar:
lsar file.tar.gz
lsar docs.zip

Stampa l’elenco in formato JSON:
lsar -j data.tar.gz
Possiamo anche testare l’integrità dei file nell’archivio:
lsar -t bar.tgz
È possibile fornire la password da utilizzare per decifrare gli archivi protetti:
lsar -p MY_PASSWORD /path/to/arhive.file

#27: lslogins

Gli amministratori di sistema e gli sviluppatori Linux possono visualizzare le informazioni sugli utenti conosciuti nel sistema:
lslogins
Possiamo stampare tutti i dettagli disponibili solo sull’utente specificato. Ad esempio, vedi le informazioni sull’utente denominato ‘vivek’:
lslogins vivek

#28: lsgpu

Elenca GPU nel tuo sistema:
lsgpu
Per ulteriori informazioni, vedere “I 7 migliori strumenti della riga dei comandi di diagnostica e monitoraggio della GPU Linux”.

#29: lstopo

Vuoi vedere la topologia del sistema Linux? Provare:
lstopo

Dal mio post “10 comandi Linux per conoscere il sistema” {clicca sull’immagine per leggerla}

#30: lsipc

Il comando lsipc mostra informazioni sulle strutture di comunicazione tra processi per le quali il processo chiamante ha accesso in lettura:
lsipc

RESOURCE DESCRIPTION                                              LIMIT  USED  USE%
MSGMNI   Number of message queues                                 32000     0 0.00%
MSGMAX   Max size of message (bytes)                               8192     -     -
MSGMNB   Default max size of queue (bytes)                        16384     -     -
SHMMNI   Shared memory segments                                    4096    27 0.66%
SHMALL   Shared memory pages                       18446744073692774399 27868 0.00%
SHMMAX   Max size of shared memory segment (bytes) 18446744073692774399     -     -
SHMMIN   Min size of shared memory segment (bytes)                    1     -     -
SEMMNI   Number of semaphore identifiers                          32000     2 0.01%
SEMMNS   Total number of semaphores                          1024000000     2 0.00%
SEMMSL   Max semaphores per semaphore set.                        32000     -     -
SEMOPM   Max number of operations per semop(2)                      500     -     -
SEMVMX   Semaphore max value                                      32767     -     -

Riassumendo

Questo post ha lo scopo di introdurti ai comandi ls* conosciuti e sconosciuti per i sistemi Linux. Ovviamente, hai bisogno di pagine man per ottenere informazioni complete sulla sintassi e sulle opzioni della riga di comando usando il comando man. Per esempio:
man lsipc
man lslogins

Hai un comando o uno script Linux ls* preferito? Condividi nei commenti qui sotto.


ANNUNCIO



Ti e piaciuto questo articolo?
Supporta il mio lavoro, facendo una donazione!

Click to comment

Leave a Reply

Esegui l'accesso per Commentare

Di tendenza

Close Popup
Questo sito utilizza i cookie per migliorare servizi ed esperienza dei lettori. Se decidi di continuare la navigazione senza blocchi premi su Accetto, oppure continua tranquillamente la navigazione, nessun dato sulla tua navigazione verrà raccolto.
Close Popup
Privacy Settings saved!
Impostazioni

Quando visiti un sito Web, esso può archiviare o recuperare informazioni sul tuo browser, principalmente sotto forma di cookies. Controlla qui i tuoi servizi di cookie personali.

Questi cookie sono necessari per il funzionamento del sito Web e non possono essere disattivati nei nostri sistemi.

Cookie tecnici
Per utilizzare questo sito web usiamo i seguenti cookie tecnici necessari:
  • wordpress_test_cookie
  • wordpress_logged_in_
  • wordpress_sec
  • swpm_session

Google Adsense
Usiamo la pubblicità di Google solo per mantenere attivi i nostro sito. Con ip anonimizzati.

Rifiuta tutti i Servizi
Save
Accetta tutti i Servizi