0% found this document useful (0 votes)
10 views3 pages

Directory Listing and Management Commands

Uploaded by

veenusmalik02
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views3 pages

Directory Listing and Management Commands

Uploaded by

veenusmalik02
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Ls command

Lists the files and folders in the current directory.

Flag Command Example Description


-l ls -l Long listing format (shows permissions, owner, size, date)
-a ls -a Shows all files, including hidden files (starting with .)
-h ls -lh Shows sizes in human-readable format (KB, MB)
-t ls -lt Sorts files by modification time (newest first)
-r ls -lr Reverses the order of the listing
-R ls -R Lists files recursively in all subdirectories
-d ls -ld */ Shows directories only without listing contents
-i ls -i Shows inode number of files
-S ls -lS Sorts files by size

Command What it shows Works for Level of detail


man Manual page Most commands Medium (concise)
info Info page Most commands Detailed, tutorial-like
help Built-in help Shell built-ins Short & simple

The kill command in Linux/Unix is used to stop or terminate processes that are running on your
system. Think of it as telling your computer: “Stop that program!”

kill PID

 PID = Process ID (a unique number assigned to each running process).

 By default, kill sends the TERM (terminate) signal to the process.

Option/Signal Example Description


-9 kill -9 PID Force kill a process (SIGKILL)
-l kill -l Lists all available signals
-15 kill -15 PID Default graceful terminate (SIGTERM)

Root Directory (/)

 The top-most directory.


 Everything in Linux is under /.

Important Directories under /


Directory Purpose
/bin Essential binary executables (commands like ls, cat)
/sbin System administration binaries (commands like fdisk, ifconfig)
/boot Boot files (kernel, GRUB bootloader)
/dev Device files (hardware devices like /dev/sda)
/etc Configuration files (system-wide configs)
/home User home directories (e.g., /home/username)
/root Home directory for root user (not /home/root)
/lib Shared libraries needed by system programs
/media Mount point for removable media (USB, CD-ROM)
/mnt Temporary mount point for manual mounting
/opt Optional software packages
/tmp Temporary files (deleted after reboot)
/usr User programs and data (apps, docs, binaries)
/var Variable files (logs, mail, spool files)
/srv Data for services (websites, FTP)

 Everything starts at / (root).

 Home directories of users are under /home.

 Programs live in /bin and /usr/bin.

 Configs are in /etc.

 Logs and variable data are in /var.

/ → Root

├── bin

├── etc

├── home

├── var

└── usr

/proc (Process & Kernel Info)

 Contains information about running processes and system info.


 Each running process has a directory named by its PID.
 Can be used to check memory, CPU, uptime, and other kernel info.

Examples:

cat /proc/cpuinfo # Information about CPU

cat /proc/meminfo # Memory usage

cat /proc/uptime # System uptime

ls /proc/[PID] # Info about a process

/proc is read-only for users (except some files that allow tweaking kernel settings).

/sys (Kernel Interface)

 Provides a modern interface to kernel objects (devices, drivers, subsystems).


 Allows you to view and sometimes modify kernel settings.
 Used by udev and system tools to manage hardware dynamically.

Examples:

ls /sys/class/ # Lists device classes (like network, block devices)

cat /sys/class/net/eth0/address # MAC address of network interface

/sys is mostly used for hardware info and kernel parameters, whereas /proc is used more for process
and system info.

Feature /proc /sys


Type Virtual filesystem Virtual filesystem
Purpose Process & kernel info Kernel objects & hardware info
Example /proc/cpuinfo, /proc/[PID] /sys/class/net, /sys/block
Modifiable? Mostly read-only Some files can be changed

You might also like