Essential Linux Commands- 2

KALPESH MOHANTAKALPESH MOHANTA
2 min read

Shortcuts:

Ctrl + R then type the command you want to search then Tab

Commands:

Info of Command

# brief description of command
whatis cat

Real time process info

# Real time process
top

# Wrapper: Graphical
htop

List Process & Hierarchy

# List Process not a Real time
ps

# Detail process list
ps aux

# Process Hierarchy
pstree -p

# Port used by Process
lsof -i :8085

Inspect Network Connection

# Get active ports in Use
netstat -tuln

# Network Interface Info
ifconfig

# Network Troubleshoot (Can WireShark tool)
# enX0: Network Interface
sudo tcpdump -i enX0 port 80

# Test Connectivity
ping google.com

# Tarce the path packet to reach destination
traceroute google.com

Disk Space, Size & Memory

# Check Disk Space
df -h

# Size of dir or file
# opt: directory
du -sh opt

# Memory (RAM)
free -h

Services

  • Systemd manages services
# Logs of Services
journalctl

# Particular Service
journalctl -u nginx

# Logs of services from Last Boot
journalctl -b

Logs Filter

# Last 10 line of logs
tail -n 10 /var/log/auth.log

# First 10 line of logs
head -n 10 /var/log/auth.log

Alias

alias detail_list='ls -la'

# Want to persist the Alias, add in '~/.bashrc'
  • Soft Link (Like Windows Shortcuts)- It can be broken

      # ln: link
      # -s: flag for soft link 
      # myfile: file you want to crate soft link
      # slink: name of soft link file created
      ln -s myfile slink
    
  • Hard Link (Actual Copy)- Doesn’t break the other one

      # ln: link
      # myfile: file you want to crate soft link
      # hlink: name of hard link file created
      ln myfile hlink
    

Refer Linux Journey

Linux Journey

0
Subscribe to my newsletter

Read articles from KALPESH MOHANTA directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

KALPESH MOHANTA
KALPESH MOHANTA

πŸ‘‹ Hi there! Welcome to my DevOps adventure! πŸš€ I'm Kalpesh, a DevOps Engineer, and I'm thrilled to share my journey in the dynamic world of DevOps and Cloud Technologies. 🌐 πŸ”§ Tech Arsenal: CI/CD Automation: Streamlining workflows for seamless deployments. Containers & Orchestration: Docker & Kubernetes. Cloud Platforms: Azure, AWS. Version Control: Git. Configuration Management: YAML, Linux commands. πŸš€ My Journey: I've had the privilege to work on diverse projects, including a notable deployment for PepsiCo. My expertise spans CI/CD automation, containerization, cloud services, and scripting to enhance system performance and reliability. πŸ’‘ Why Follow Me? Join me as I delve into: Cutting-edge DevOps practices. Automation techniques. Cloud innovations. Tips & tricks for aspiring DevOps professionals. 🀝 Connect & Collaborate: Let's build, learn, and innovate together. Whether you're a fellow tech enthusiast, a professional looking to share insights, or someone eager to learn, let's connect and grow in this vibrant community. πŸ“’ Follow my LinkedIn & Hashnode blog for insights, tutorials, and updates. Together, we'll embrace the ever-evolving DevOps landscape!