Hoy les quiero entregar la primera parte de vaya a saber cuantas – porque realmente no tengo idea de cuantas serán – de comandos que nos serán útiles en la administración y uso diario de nuestros equipos con GNU/Linux. Sin llegar a ser un curso de Carrera Linux para certificación LPI, sirve para ir «Aprendiendo Linux» 🙂
Lejos de pretender crear «un manual» de GNU/Linux, la idea es simplemente poder ubicar este post en un «favorito» de tu navegador…
Antes de ponerme mas poético (¿?) empecemos:
Observación 1: más adelante les explicaré de que se trata el comando sudo, por ahora les diré que permite que un usuario SIN SER ROOT pueda ejecutar comandos que normalmente no podría por su jerarquía en el sistema.
Observación 2: hay casos en los que el resultado de la ejecución del comando es demasiado extenso por lo que solo «pego» algunas líneas (al fin de cuentas lo que importa es la información de tu equipo!)
Comandos para obtener información del sistema
arch: información de la arquitectura del equipo
blog@cla:~$ arch
x86_64
blog@cla:~$
uname -m: también nos mostrará la arquitectura del equipo
blog@cla:~$ arch
x86_64
blog@cla:~$
uname -r: versión del kernel usado
blog@cla:~$ uname -r
3.13.0-77-generic
blog@cla:~$
dmidecode -q: lista los componentes de hardware del equipo
blog@cla:~$ sudo dmidecode -q
BIOS Information
Vendor: Hewlett-Packard
Version: 68AZZ Ver. F.21
Release Date: 06/13/2012
Address: 0xF0000
Runtime Size: 64 kB
ROM Size: 2560 kB
Characteristics:
PCI is supported
PC Card (PCMCIA) is supported
BIOS is upgradeable
BIOS shadowing is allowed
Boot from CD is supported
Selectable boot is supported
EDD is supported
Print screen service is supported (int 5h)
8042 keyboard services are supported (int 9h)
Serial services are supported (int 14h)
Printer services are supported (int 17h)
ACPI is supported
USB legacy is supported
Smart battery is supported
BIOS boot specification is supported
Function key-initiated network boot is supported
Targeted content distribution is supported
BIOS Revision: 15.33
Firmware Revision: 57.36
System Information
Manufacturer: Hewlett-Packard
Product Name: HP ProBook 4720s
Version: 12345
Serial Number: 2CE03409JM
UUID: F7F499D7-0678-11DF-8011-143C10000062
Wake-up Type: Power Switch
SKU Number: WQ426LA
Family: 103C_5336AN
hdparm -i /dev/sda: características del disco rígido
blog@cla:~$ sudo hdparm -i /dev/sda
/dev/sda:
Model=ST1000LM024 HN-M101MBB, FwRev=2AR10002, SerialNo=S2R8J9CD208283
Config={ Fixed }
RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=4
BuffType=unknown, BuffSize=8192kB, MaxMultSect=16, MultSect=off
CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=1953525168
IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
PIO modes: pio0 pio1 pio2 pio3 pio4
DMA modes: mdma0 mdma1 mdma2
UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6
AdvancedPM=yes: unknown setting WriteCache=enabled
Drive conforms to: unknown: ATA/ATAPI-0,1,2,3,4,5,6,7
* signifies the current active mode
blog@cla:~$
blog@cla:~$ sudo hdparm -tT /dev/sda
/dev/sda:
Timing cached reads: 6934 MB in 2.00 seconds = 3467.67 MB/sec
Timing buffered disk reads: 324 MB in 3.01 seconds = 107.72 MB/sec
blog@cla:~$
cat /proc/cpuinfo: información de la CPU.
blog@cla:~$ cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 37
model name : Intel(R) Core(TM) i5 CPU M 520 @ 2.40GHz
stepping : 5
microcode : 0x2
cpu MHz : 1199.000
cache size : 3072 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 2
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 11
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 rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 popcnt aes lahf_lm ida arat dtherm tpr_shadow vnmi flexpriority ept vpid
bogomips : 4788.11
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:
processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 37
model name : Intel(R) Core(TM) i5 CPU M 520 @ 2.40GHz
stepping : 5
microcode : 0x2
cpu MHz : 1199.000
cache size : 3072 KB
physical id : 0
siblings : 2
core id : 2
cpu cores : 2
apicid : 4
initial apicid : 4
fpu : yes
fpu_exception : yes
cpuid level : 11
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 rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 popcnt aes lahf_lm ida arat dtherm tpr_shadow vnmi flexpriority ept vpid
bogomips : 4788.11
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:
blog@cla:~$
cat /proc/interrupts: mostrar las interrupciones
blog@cla:~$ cat /proc/interrupts
CPU0 CPU1
0: 45 0 IO-APIC-edge timer
1: 7 5 IO-APIC-edge i8042
8: 0 1 IO-APIC-edge rtc0
9: 73 80 IO-APIC-fasteoi acpi
12: 101 94 IO-APIC-edge i8042
16: 123 120 IO-APIC-fasteoi ehci_hcd:usb1
19: 49360 130 IO-APIC-fasteoi ath9k
20: 43702 45042 IO-APIC-fasteoi ehci_hcd:usb2
23: 0 0 IO-APIC-edge lis3lv02d
40: 0 0 PCI-MSI-edge PCIe PME
41: 0 0 PCI-MSI-edge PCIe PME
42: 0 0 PCI-MSI-edge PCIe PME, pciehp
43: 0 0 PCI-MSI-edge PCIe PME
44: 0 0 PCI-MSI-edge PCIe PME, pciehp
45: 593 182780 PCI-MSI-edge eth0
46: 65552 61306 PCI-MSI-edge ahci
47: 117422 114438 PCI-MSI-edge radeon
48: 7 7 PCI-MSI-edge mei_me
49: 7686 6140 PCI-MSI-edge snd_hda_intel
50: 2077 1866 PCI-MSI-edge snd_hda_intel
NMI: 800 790 Non-maskable interrupts
LOC: 1191599 1192672 Local timer interrupts
SPU: 0 0 Spurious interrupts
PMI: 800 790 Performance monitoring interrupts
IWI: 63333 63692 IRQ work interrupts
RTR: 1 0 APIC ICR read retries
RES: 200319 215908 Rescheduling interrupts
CAL: 517 467 Function call interrupts
TLB: 23181 18159 TLB shootdowns
TRM: 0 0 Thermal event interrupts
THR: 0 0 Threshold APIC interrupts
MCE: 0 0 Machine check exceptions
MCP: 16 16 Machine check polls
ERR: 0
MIS: 0
blog@cla:~$
cat /proc/meminfo: verificar el uso de memoria.
blog@cla:~$ cat /proc/meminfo
MemTotal: 8028688 kB
MemFree: 3155020 kB
Buffers: 433688 kB
Cached: 1756288 kB
SwapCached: 0 kB
Active: 3212928 kB
Inactive: 1165224 kB
Active(anon): 2192444 kB
Inactive(anon): 58280 kB
Active(file): 1020484 kB
Inactive(file): 1106944 kB
Unevictable: 3824 kB
Mlocked: 3824 kB
SwapTotal: 15624188 kB
SwapFree: 15624188 kB
Dirty: 104 kB
Writeback: 0 kB
AnonPages: 2192088 kB
Mapped: 395668 kB
Shmem: 60096 kB
Slab: 310208 kB
SReclaimable: 267592 kB
SUnreclaim: 42616 kB
KernelStack: 5512 kB
PageTables: 53660 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 19638532 kB
Committed_AS: 6850312 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 300960 kB
VmallocChunk: 34359432128 kB
HardwareCorrupted: 0 kB
AnonHugePages: 337920 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 112396 kB
DirectMap2M: 8128512 kB
blog@cla:~$
cat /proc/swaps: mostrar ficheros swap.
blog@cla:~$ cat /proc/swaps
Filename Type Size Used Priority
/dev/sda2 partition 15624188 0 -1
blog@cla:~$
cat /proc/version: mostrar la versión del kernel.
blog@cla:~$ cat /proc/version
Linux version 3.13.0-77-generic (buildd@lcy01-30) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) ) #121-Ubuntu SMP Wed Jan 20 10:50:42 UTC 2016
blog@cla:~$
cat /proc/net/dev: mostrar adaptadores de red y estadísticas.
blog@cla:~$ cat /proc/net/dev
Inter-| Receive | Transmit
face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed
eth0: 88419736 123243 0 524 0 0 0 0 13117446 75567 0 0 0 0 0 0
lo: 347428 949 0 0 0 0 0 0 347428 949 0 0 0 0 0 0
wlan0: 686023 4182 0 0 0 0 0 0 65591 291 0 0 0 0 0 0
blog@cla:~$
cat /proc/mounts: mostrar el sistema de ficheros montado.
blog@cla:~$ cat /proc/mounts
rootfs / rootfs rw 0 0
sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
udev /dev devtmpfs rw,relatime,size=3999060k,nr_inodes=999765,mode=755 0 0
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
tmpfs /run tmpfs rw,nosuid,noexec,relatime,size=802872k,mode=755 0 0
/dev/disk/by-uuid/0ed9943b-ef06-451e-9846-976fe53a7f4f / ext4 rw,relatime,errors=remount-ro,data=ordered 0 0
none /sys/fs/cgroup tmpfs rw,relatime,size=4k,mode=755 0 0
none /sys/fs/fuse/connections fusectl rw,relatime 0 0
none /sys/kernel/debug debugfs rw,relatime 0 0
none /sys/kernel/security securityfs rw,relatime 0 0
none /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0 0
none /run/shm tmpfs rw,nosuid,nodev,relatime 0 0
none /run/user tmpfs rw,nosuid,nodev,noexec,relatime,size=102400k,mode=755 0 0
none /sys/fs/pstore pstore rw,relatime 0 0
/dev/sda1 /boot ext4 rw,relatime,data=ordered 0 0
/dev/sda4 /home ext4 rw,relatime,data=ordered 0 0
binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw,nosuid,nodev,noexec,relatime 0 0
rpc_pipefs /run/rpc_pipefs rpc_pipefs rw,relatime 0 0
systemd /sys/fs/cgroup/systemd cgroup rw,nosuid,nodev,noexec,relatime,name=systemd 0 0
nfsd /proc/fs/nfsd nfsd rw,relatime 0 0
blog@cla:~$
lspci -tv: mostrar los dispositivos PCI.
blog@cla:~$ lspci -tv
-+-[0000:ff]-+-00.0 Intel Corporation Core Processor QuickPath Architecture Generic Non-core Registers
| +-00.1 Intel Corporation Core Processor QuickPath Architecture System Address Decoder
| +-02.0 Intel Corporation Core Processor QPI Link 0
| +-02.1 Intel Corporation 1st Generation Core i3/5/7 Processor QPI Physical 0
| +-02.2 Intel Corporation 1st Generation Core i3/5/7 Processor Reserved
| \-02.3 Intel Corporation 1st Generation Core i3/5/7 Processor Reserved
\-[0000:00]-+-00.0 Intel Corporation Core Processor DRAM Controller
+-01.0-[01]–+-00.0 Advanced Micro Devices, Inc. [AMD/ATI] RV710/M92 [Mobility Radeon HD 4350/4550]
| \-00.1 Advanced Micro Devices, Inc. [AMD/ATI] RV710/730 HDMI Audio [Radeon HD 4000 series]
+-16.0 Intel Corporation 5 Series/3400 Series Chipset HECI Controller
+-1a.0 Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller
+-1b.0 Intel Corporation 5 Series/3400 Series Chipset High Definition Audio
+-1c.0-[02]–
+-1c.1-[03-43]–
+-1c.3-[44]—-00.0 Qualcomm Atheros AR9285 Wireless Network Adapter (PCI-Express)
+-1c.5-[45]—-00.0 Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
+-1d.0 Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller
+-1e.0-[46]–
+-1f.0 Intel Corporation HM57 Chipset LPC Interface Controller
+-1f.2 Intel Corporation 5 Series/3400 Series Chipset 6 port SATA AHCI Controller
\-1f.6 Intel Corporation 5 Series/3400 Series Chipset Thermal Subsystem
blog@cla:~$
lsusb -tv: mostrar los dispositivos USB.
blog@cla:~$ lsusb -tv
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/8p, 480M
|__ Port 2: Dev 3, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 1: Dev 4, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 1: Dev 5, If 0, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 1: Dev 5, If 1, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 1: Dev 5, If 2, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 2: Dev 29, If 0, Class=Vendor Specific Class, Driver=, 480M
|__ Port 2: Dev 29, If 1, Class=Printer, Driver=usblp, 480M
|__ Port 2: Dev 29, If 2, Class=Mass Storage, Driver=usb-storage, 480M
|__ Port 2: Dev 29, If 3, Class=Vendor Specific Class, Driver=, 480M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M
|__ Port 1: Dev 3, If 0, Class=Wireless, Driver=btusb, 12M
|__ Port 1: Dev 3, If 1, Class=Wireless, Driver=btusb, 12M
|__ Port 1: Dev 3, If 2, Class=Vendor Specific Class, Driver=, 12M
|__ Port 1: Dev 3, If 3, Class=Application Specific Interface, Driver=, 12M
|__ Port 3: Dev 4, If 0, Class=Vendor Specific Class, Driver=, 12M
|__ Port 5: Dev 5, If 0, Class=Video, Driver=uvcvideo, 480M
|__ Port 5: Dev 5, If 1, Class=Video, Driver=uvcvideo, 480M
blog@cla:~$
date: mostrar la fecha del sistema.
blog@cla:~$ date
mie feb 17 20:18:41 ART 2016
blog@cla:~$
cal 2016: muestra el almanaque del año especificado
Aquí no coloco la salida del comando porque no es legible, de todas maneras, mucho para explicar no hay!
cal 05 1810: muestra el almanaque para el mes y año especificado
blog@cla:~$ cal 05 1810
Mayo 1810
do lu ma mi ju vi sá
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
blog@cla:~$
Bueno gente! eso es todo por hoy!
Espero les sea de utilidad, hasta el próximo post!
Eduardo