Essential Linux Commands

Linux Commands For File System Management

command

description

example

ls

 

 

cat

 

 

cd

 

 

pwd

 

 

mkdir

 

 

file

 

 

cp

 

 

mv

 

 

rm

 

 

ln

 

 

chmod

 

 

chown

 

 

find

 

 

locate

 

 

du

 

 

df

 

 

dd

 

 

mount/umount

 

 

Linux Commands For Text Processing

 

 

 

more/less

 

 

haid/tail

 

 

grep

 

 

sed

 

 

awk

 

 

cut

 

cut -d' '

sort

 

 

uniq

 

 

wc

 

 

diff

 

 

vi/vim/nano

 

 

Linux Commands For Process/Service/Resource Management

command

description

 

systemctl

 

 

journalctl

 

 

shutdown

 

 

top / htop

 

 

ps / pgrep / pstree

 

 

pstree

 

 

kill / xkill / pkill / killall

 

 

renice

 

 

time / uptime / w

prints a summary of the current activity on the system, including what each user is doing, and their process

 

lsof

 

 

free

 

 

df

 

 

strace

 

 

iostat / pidstat / vmstat

 

 

findmnt

 

 

Linux Commands For BASH and User Environment

 

 

 

su / sudo

 

 

date

 

 

alias

 

 

env

 

 

Linux Commands For User / Groups Management

 

 

 

useradd, userdel, usermod

 

 

passwd

 

 

groupadd / groupdel / groupmod

 

groupadd -g group-ID group-name

gpasswd

 

 

getent

display who is a member of a group

getent group group-name

id / groups

 

 

visudo

 

 

Linux Commands For Help / Documentation

 

 

 

man / whatis

 

 

whereis

get executable path

 

Linux Commands For Network

 

 

 

netstat

 

 

netcat

 

 

iptables

 

 

ip

 

 

ping

 

 

nslookup

 

 

ifconfig

 

 

ifup / ifdown

 

 

dig

 

 

lsof -i

reveal information about your network sockets

 

traceroute

 

 

telnet

 

 

ssh

 

 

scp

 

 

nmap

 

 

Linux Commands For Packages management

 

 

 

rpm

 

 

yum

 

 

apt

 

 

pip

 

 

Linux Command for System Info

 

 

 

uname

 

 

 

 

 

 

 

 

 

 

 

Linux Command for performance and Resources consumption

 

 

 

top

 

 

free

 

 

df

 

 

iostat

 

 

pidstat

 

 

vmstat

 

 

Disk Management commands

 

 

 

df -Th

 

 

lsblk

 

 

fdisk -l

show partitions

 

pvs

list out the physical volumes in an LVM group

 

vgs

list out the volume groups within an LVM group

 

lvs

List out the logical volumes within an LVM group

 

parted

 

 

References: https://www.binarytides.com/linux-command-check-disk-partitions/

Troubleshooting commands

 

 

 

journalctl

 

 

less /var/log/auth.log (DEBIAN-based operating systems)

less /var/log/secure (RHEL-based operating systems)

journalctl SYSLOG_FACILITY=10

get user's sudo history

 

free

df

visudo

findmnt

uname

List of Important files and Directories in Linux (Redhat,Centos,Fedora)

 

 

 

 

 

 

VIM tips:

  1. Comment and uncomment multiple lines

https://discuss.devopscube.com/t/how-to-comment-and-uncomment-multiple-line-vi-terminal-editor/64

https://stackoverflow.com/questions/1676632/whats-a-quick-way-to-comment-uncomment-lines-in-vim

2. Copy, cut and paste

https://vim.fandom.com/wiki/Copy,_cut_and_paste

Physical

Physical drive

optical drive /dev/sda

logical volume: A logical volume created by the LVM is a logical storage device which can span multiple physical volumes.

partition /dev/sda1

A volume is created on a dynamic disk -- a logical structure that can span multiple physical disks -- while a partition is created on a basic disk.

Setup Flexible Disk Storage with Logical Volume Management (LVM) in Linux – PART 1

https://www.tecmint.com/create-lvm-storage-in-linux/

How to Extend/Reduce LVM’s (Logical Volume Management) in Linux – Part II

https://www.tecmint.com/extend-and-reduce-lvms-in-linux/

How to Take ‘Snapshot of Logical Volume and Restore’ in LVM – Part III

https://www.tecmint.com/take-snapshot-of-logical-volume-and-restore-in-lvm/

Disk = A block device = A storage device, e.g. SSD, hard disk

A section of a storage device is called as partition which is in no way filesystem that what is done to it via OS.

As to meaning of the volume, there are 2 types either physical or logical.

A physical volume from the point of view of your computer a physical hard disc.

A logical volume is a logical disc which may spread across multiple physical discs.

The easiest way to think of a physical volume (PV) is that it is a physical partition that has a partition type of “Linux LVM” (type 8e - fdisk or type 8e00 - gdisk) and has been "marked" as a PV using pvcreate

  • - meaning that it can now be added to a volume group (VG). From the VG, logical volumes (LV) can be created.

https://wiki.archlinux.org/index.php/Software_RAID_and_LVM

Failed to load

References: