ls commands

See list SCSI devices (or hosts) and their attributes under Linux operating systems
# lsscsi -g

Use this command to list block devices
# lsblk

To see file system type
# lsblk -f

To output info about permissions
# lsblk -m

Use this command to see Linux distribution-specific information, enter
# lsb_release
# lsb_release -a

Use this command to see USB buses in the Linux based system and the devices connected to them
# lsusb

lscpu command shows information about CPU architecture information like number of CPUs, threads, cores
# lscpu

lspci command shows information about PCI buses in the system and devices connected
# lspci

lspci command can be used to find out if a given PCI hardware
# lspci | grep VT6120

lshw command finds detailed information about the hardware configuration
# lshw / lshw-gtk

Use ls command to list directory contents
# 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

Use this command list open files, network ports, active process

#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 TCP80
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 TCP1-1024
List process open in port range 1 to 1024

#lsof -i @server.host.example1200-1205
List all files using any protocol on ports 1200 to 1205 of host server.host.example, 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?

Use lsattr to lists the file attributes on a second extended file system
# lsattr /etc/passwd

Use lshal command to display items in the HAL (Hardware Abstraction Layer)
# lshal | less

Use this command to show the content of given initramfs images
# lsinitramfs /boot/initrd.img

Use this command to list all device driver loaded currently in the Linux Kernel
# lsmod

See information about the PCMCIA sockets and devices
# lspcmcia

Use this command to to lists all locks associated with the local files of the system
# lslk

Use this command to display the number of messages in a mailbox
# lsmbox

No comments: