[go: up one dir, main page]

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

Linux Commands Day4 Detailed

This document provides a detailed overview of various Linux commands and their options, including aliasing, job management, process termination, and system monitoring. Key commands such as 'history', 'fg', 'bg', 'kill', 'du', 'df', 'whoami', 'top', and 'htop' are explained with examples. It serves as a practical guide for users to efficiently manage and monitor their Linux systems.

Uploaded by

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

Linux Commands Day4 Detailed

This document provides a detailed overview of various Linux commands and their options, including aliasing, job management, process termination, and system monitoring. Key commands such as 'history', 'fg', 'bg', 'kill', 'du', 'df', 'whoami', 'top', and 'htop' are explained with examples. It serves as a practical guide for users to efficiently manage and monitor their Linux systems.

Uploaded by

supritpujari21
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Linux Commands - Day 4 (Detailed with Options)

alias: Creates an alias for a command

- alias ll='ls -l' - Create a shortcut 'll' for 'ls -l'

- alias gs='git status' - Shortcut for checking Git status

unalias: Removes an alias

- unalias ll - Removes alias named 'll'

- unalias -a - Removes all aliases

history: Displays command history

- history - Shows all history entries

- history 10 - Shows last 10 entries

- !n - Re-executes command number n

fg: Brings a background job to foreground

- fg %1 - Brings job with ID 1 to foreground

bg: Resumes a job in the background

- bg %1 - Resumes job with ID 1 in background

jobs: Lists current jobs

- jobs -l - Lists jobs with process IDs

- jobs -p - Lists only process IDs

kill: Terminates a process by PID

- kill 1234 - Sends TERM signal to PID 1234

- kill -9 1234 - Sends KILL signal (forceful kill)

killall: Kills all processes by name

- killall firefox - Kills all firefox processes

- killall -9 chrome - Forcefully kills chrome processes

xargs: Builds and executes command lines from standard input

- ls | xargs rm - Deletes files listed by ls

- find . -name '*.txt' | xargs grep 'hello'


du: Estimates file space usage

- du -h - Human-readable sizes

- du -a - Includes files as well as directories

- du -sh * - Summary of sizes of subdirs/files

df: Reports file system disk space usage

- df -h - Human-readable format

- df -T - Shows filesystem type

whoami: Displays the current user

- whoami - Shows the current logged-in username

id: Prints user and group information

- id - Shows user ID (UID), group ID (GID), and group memberships

- id -u - Show only UID

- id -g - Show only GID

uptime: Tells how long the system has been running

- uptime - Displays current time, uptime, and load averages

uname: Displays system information

- uname -a - All system info

- uname -r - Kernel version

- uname -s - Kernel name

top: Displays active processes

- top - Real-time view of system processes

- top -u username - Show processes of a specific user

htop: Interactive process viewer (advanced version of top)

- htop - Run htop if installed; supports scrolling and mouse usage

vmstat: Reports system performance

- vmstat - Displays memory, processes, I/O, system activity

- vmstat 2 5 - Updates every 2 seconds, 5 times

iostat: Reports CPU and I/O statistics

- iostat -x - Extended device utilization report


- iostat -d - Only device utilization stats

watch: Executes a command repeatedly

- watch -n 5 df -h - Runs 'df -h' every 5 seconds

- watch -d - Highlights differences between updates

You might also like