Nexolinux
Sistemas Linux, servidores web, certificaciones, LPIC, Linux básico y profesional
Navigation
  • Home
  • Bash
  • LPIC
  • Noticias
  • Seguridad
  • Servicios
  • HowTo’s
You are here: Home › Bash & Comandos › Comando Lsof, Comprobar ficheros abiertos.

Comando Lsof, Comprobar ficheros abiertos.

22 noviembre, 2012 | Filed under: Bash & Comandos, LPIC, Nivel Basico and tagged with: aprender linux, comando lsof, comando lsof linux, comandos basicos linux, cursos on line, ficheros abiertos red, linux training, lpi, lsof linux

La propia palabra Lsof ya nos dice lo que hace, «LS Open Files» . Nos ayuda a listar ficheros abiertos, y nos será super útil en determinadas situaciónes donde no sepamos qué carpetas tiene en uso una determinada herramienta.

1 – Ejecutándolo sin más, nos da una lista de los procesos activos y los ficheros usados:

nexolinux m3t4g4m3 # lsof
COMMAND  PID       USER   FD      TYPE     DEVICE  SIZE/OFF       NODE NAME
init       1       root  cwd       DIR        8,1      4096          2 /
init       1       root  txt       REG        8,1    124704     917562 /sbin/init
init       1       root    0u      CHR        1,3       0t0       4369 /dev/null
init       1       root    1u      CHR        1,3       0t0       4369 /dev/null
init       1       root    2u      CHR        1,3       0t0       4369 /dev/null
init       1       root    3r     FIFO        0,8       0t0       6323 pipe

 

2- Podemos usarlo para saber qué procesos tiene cogidos un fichero:

nexolinux m3t4g4m3 # lsof /var/log/syslog

COMMAND  PID       USER   FD      TYPE     DEVICE  SIZE/OFF       NODE NAME
rsyslogd 488 syslog    1w   REG    8,1     1151 268940 /var/log/sysloge

 

3 – Listar ficheros abiertos en un directorio ( +D directorio )

nexolinux m3t4g4m3 # lsof +D /var/log/

COMMAND   PID   USER  FD   TYPE DEVICE SIZE/OFF   NODE NAME
rsyslogd  488 syslog   1w   REG    8,1     1151 268940 /var/log/syslog
rsyslogd  488 syslog   2w   REG    8,1     2405 269616 /var/log/auth.log
console-k 144   root   9w   REG    8,1    10871 269369 /var/log/ConsoleKit/history

 

4 – Listar ficheros abiertos basados en procesos ( -c proceso )

nexolinux m3t4g4m3 # lsof -c ssh

COMMAND    PID   USER   FD   TYPE DEVICE SIZE/OFF   NODE NAME
ssh-agent 1528 lakshmanan    1u   CHR        1,3      0t0    4369 /dev/null
ssh-agent 1528 lakshmanan    2u   CHR        1,3      0t0    4369 /dev/null
ssh-agent 1528 lakshmanan    3u  unix 0xdf70e240      0t0   10464 /tmp/ssh-sUymKXxw1495/agent.1495

 

5 – Listar ficheros abiertos por un usuario. ( -u ) 

nexolinux m3t4g4m3 # lsof -u m3t4g4m3

COMMAND    PID       USER   FD   TYPE     DEVICE SIZE/OFF       NODE NAME
update-no 1892 m3t4g4m3   20r  FIFO        0,8      0t0      14536 pipe
update-no 1892 m3t4g4m3   21w  FIFO        0,8      0t0      14536 pipe
bash      1995 m3t4g4m3  cwd    DIR        8,1     4096     393218 /home/m3t4g4m3

# Si necesitas un manual del LPIC no dudes en descargarlos de lpic-documentacion-oficial

Comparte esto:

  • Facebook
  • Twitter
  • LinkedIn

Me gusta esto:

Me gusta Cargando...

Categorías.

  • Bases de datos
  • Bash & Comandos
  • HowTo
  • Linux General
  • LPIC
  • LPIC-2
  • Nivel Avanzado
  • Nivel Basico
  • Noticias
  • Seguridad
  • Servicios
  • Servidor Web

Entradas y Páginas Populares

  • Comando fuser, Localizamos procesos que usan un fichero.
    Comando fuser, Localizamos procesos que usan un fichero.
  • Ejemplos usos mount y umount
    Ejemplos usos mount y umount
  • Ficheros de usuarios /etc/passwd y /etc/shadow
    Ficheros de usuarios /etc/passwd y /etc/shadow
  • Instruccion READ en Bash
    Instruccion READ en Bash
  • ¿Cómo cifra linux las contraseñas?
    ¿Cómo cifra linux las contraseñas?
  • Proxy Squid, control de accesos ACL (II)
    Proxy Squid, control de accesos ACL (II)
  • 15 dispositivos que funcionan con Linux
    15 dispositivos que funcionan con Linux
  • fichero fstab
    fichero fstab
  • HowTo:Ejecutar comando como otro usuario.
    HowTo:Ejecutar comando como otro usuario.
  • Comandos más usados para gestionar Iptables
    Comandos más usados para gestionar Iptables

© 2025 Nexolinux

Utilizamos cookies propias y de terceros para mejorar nuestros servicios y mostrar publicidad relacionada con tus preferencias. cerrar Política de cookies
Privacidad y política de cookies

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Siempre activado
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
GUARDAR Y ACEPTAR
%d